//+------------------------------------------------------------------+ //| luktom pipsometer.mq4 | //| luktom :: Łukasz Tomaszkiewicz | //| http://luktom.biz/ | //+------------------------------------------------------------------+ //Modified, 13/Apr/2021, by jeanlouie, www.forexfactory.com/jeanlouie // - added font size option // - input x and y // - enum input corner #property copyright "luktom :: Łukasz Tomaszkiewicz" #property link "http://luktom.biz/" #property indicator_chart_window extern color color1=LimeGreen; extern color color2=Black; extern bool allSymbols=false; extern ENUM_BASE_CORNER corner=3; input int fontsize = 12; input int x = 5; input int y = 15; int init() { ObjectCreate("lpm_pips",OBJ_LABEL,0,0,0); ObjectSet("lpm_pips",OBJPROP_CORNER,corner); ObjectSetText("lpm_pips","pips",fontsize); ObjectSet("lpm_pips",OBJPROP_COLOR,color1); ObjectSet("lpm_pips",OBJPROP_XDISTANCE,/*40+*/5+x); ObjectSet("lpm_pips",OBJPROP_YDISTANCE,/*25+*/25+y); // ObjectCreate("lpm_short",OBJ_LABEL,0,0,0); ObjectSet("lpm_short",OBJPROP_CORNER,corner); ObjectSetText("lpm_short","pcs",fontsize); ObjectSet("lpm_short",OBJPROP_COLOR,color1); ObjectSet("lpm_short",OBJPROP_XDISTANCE,/*20+*/5+x); ObjectSet("lpm_short",OBJPROP_YDISTANCE,/*5+*/5+y); // ObjectCreate("lpm_long",OBJ_LABEL,0,0,0); ObjectSet("lpm_long",OBJPROP_CORNER,corner); ObjectSetText("lpm_long","pcs",fontsize); ObjectSet("lpm_long",OBJPROP_COLOR,color1); ObjectSet("lpm_long",OBJPROP_XDISTANCE,/*80+*/80+x); ObjectSet("lpm_long",OBJPROP_YDISTANCE,/*5+*/5+y); start(); return(0); } int deinit() { ObjectDelete("lpm_pips"); ObjectDelete("lpm_pips_tosl"); ObjectDelete("lpm_pips_realized"); ObjectDelete("lpm_long"); ObjectDelete("lpm_short"); ObjectDelete("lpm_longlabel"); ObjectDelete("lpm_shortlabel"); return(0); } int start() { ObjectSetText("lpm_short","short: "+IntegerToString(countOrders(OP_SELL,allSymbols),1)); ObjectSetText("lpm_long","long: "+IntegerToString(countOrders(OP_BUY,allSymbols),1)); double profit; double sl; color szin; calcProfit(profit,sl,allSymbols); if (profit<0) szin=clrRed; else szin=color1; ObjectSetText("lpm_pips",sign(profit)+DoubleToStr(MathAbs(profit)/10,1),15,0,szin); ObjectSetText("lpm_pips_tosl",sign(sl)+DoubleToStr(MathAbs(sl)/10,1)); double realized; calcRealized(realized,allSymbols); ObjectSetText("lpm_pips_realized",sign(realized)+DoubleToStr(MathAbs(realized)/10,1)); return(0); } void calcRealized(double& out, bool allSymbols=false) { double profit=0; double p=0; for(int i=0;i0) { s=(OrderStopLoss()-OrderOpenPrice())/Point; } } if(OrderType()==OP_SELL) { p=(OrderOpenPrice()-Ask)/Point; if(OrderStopLoss()>0) { s=(OrderOpenPrice()-OrderStopLoss())/Point; } } sl+=s; profit+=p; } } } out=profit; outsl=sl; } int countOrders(int oType,bool allSymbols=false) { int count=0; for(int i=0;i0) { return("+"); } if(value<0) { return("-"); } }