//+------------------------------------------------------------------+ //| informindicatorML8.mq4 | //| MOLET | //| icq 459027664; possol@meta.ua | //+------------------------------------------------------------------+ #property copyright "MOLET" #property link "icq 459027664; possol@meta.ua" #property indicator_chart_window extern int posorder=0; //+------------------------------------------------------------------+ //| expert initialization function | //+------------------------------------------------------------------+ int init() { //---- ObjectCreate("TP",OBJ_LABEL,0,0,0); ObjectSet("TP",OBJPROP_XDISTANCE,750); ObjectSet("TP",OBJPROP_YDISTANCE,250); ObjectCreate("SL",OBJ_LABEL,0,0,0); ObjectSet("SL",OBJPROP_XDISTANCE,750); ObjectSet("SL",OBJPROP_YDISTANCE,350); ObjectSetText("TP","0",50,"Times New Roman",Green); ObjectSetText("SL","0",50,"Times New Roman",Red); //---- return(0); } //+------------------------------------------------------------------+ //| expert deinitialization function | //+------------------------------------------------------------------+ int deinit() { ObjectDelete("SL"); ObjectDelete("TP"); return(0); } //+------------------------------------------------------------------+ //| expert start function | //+------------------------------------------------------------------+ int start() { { if(OrderSelect(posorder,SELECT_BY_POS,MODE_TRADES)==false) { ObjectSetText("TP","0",50,"Times New Roman",Green); ObjectSetText("SL","0",50,"Times New Roman",Red); } } //-------------------- { if(OrderSelect(posorder,SELECT_BY_POS,MODE_TRADES)) if(OrderStopLoss()>0) if(OrderTakeProfit()>0) if(OrderType()==OP_SELL) { ObjectSetText("TP",DoubleToStr((Ask-OrderTakeProfit())/Point,0),50,"Times New Roman",Green); ObjectSetText("SL",DoubleToStr((OrderStopLoss()-Ask)/Point,0),50,"Times New Roman",Red); } } { if(OrderSelect(posorder,SELECT_BY_POS,MODE_TRADES)) if(OrderStopLoss()>0) if(OrderTakeProfit()>0) if(OrderType()==OP_BUY) { ObjectSetText("TP",DoubleToStr((OrderTakeProfit()-Bid)/Point,0),50,"Times New Roman",Green); ObjectSetText("SL",DoubleToStr((Bid-OrderStopLoss())/Point,0),50,"Times New Roman",Red); } } //-------------------- { if(OrderSelect(posorder,SELECT_BY_POS,MODE_TRADES)) if(OrderStopLoss()>0) if(OrderTakeProfit()==0) if(OrderType()==OP_SELL) { ObjectSetText("TP","0",50,"Times New Roman",Green); ObjectSetText("SL",DoubleToStr((OrderStopLoss()-Ask)/Point,0),50,"Times New Roman",Red); } } { if(OrderSelect(posorder,SELECT_BY_POS,MODE_TRADES)) if(OrderStopLoss()>0) if(OrderTakeProfit()==0) if(OrderType()==OP_BUY) { ObjectSetText("TP","0",50,"Times New Roman",Green); ObjectSetText("SL",DoubleToStr((Bid-OrderStopLoss())/Point,0),50,"Times New Roman",Red); } } //-------------------- { if(OrderSelect(posorder,SELECT_BY_POS,MODE_TRADES)) if(OrderStopLoss()==0) if(OrderTakeProfit()>0) if(OrderType()==OP_SELL) { ObjectSetText("TP",DoubleToStr((Ask-OrderTakeProfit())/Point,0),50,"Times New Roman",Green); ObjectSetText("SL","0",50,"Times New Roman",Red); } } { if(OrderSelect(posorder,SELECT_BY_POS,MODE_TRADES)) if(OrderStopLoss()==0) if(OrderTakeProfit()>0) if(OrderType()==OP_BUY) { ObjectSetText("TP",DoubleToStr((OrderTakeProfit()-Bid)/Point,0),50,"Times New Roman",Green); ObjectSetText("SL","0",50,"Times New Roman",Red); } } //-------------------- { if(OrderSelect(posorder,SELECT_BY_POS,MODE_TRADES)) if(OrderStopLoss()==0) if(OrderTakeProfit()==0) { ObjectSetText("TP","0",50,"Times New Roman",Green); ObjectSetText("SL","0",50,"Times New Roman",Red); } } return(0); } //+------------------------------------------------------------------+