and proceeded to change all the profit outputs to include the letters "mod", ie. "modprofitLabel".
Code: Select all
if(showPipProfit==true)
{
total=OrdersTotal();
ordersTotal=total;
j=0;
double lots;;
for(i=0; i<total; i++)
{
bool orderSelect=OrderSelect(i,SELECT_BY_POS,MODE_TRADES);
if(Symbol()==OrderSymbol())
{
if(OrderType()==OP_BUYSTOP || OrderType()==OP_BUYLIMIT || OrderType()==OP_SELLSTOP || OrderType()==OP_SELLLIMIT) continue;
j++;
if(OrderType()==OP_BUY)
{
lots=OrderLots();
profit+=OrderProfit()+OrderSwap()+OrderCommission();
tradeValue=(Bid-OrderOpenPrice())/Point/multiplier;
if(tradeValue>0) tradeValueColor=Lime;
else tradeValueColor=Red;
if(profit>0) profitColor=Lime;
else profitColor=Red;
ObjectCreate("modprofitLabel",OBJ_LABEL,0,0,0);
ObjectSetText("modprofitLabel","Profit",10,"Arial Bold",ProfitLossColor);
ObjectSet("modprofitLabel",OBJPROP_CORNER,showOnRightTop);
ObjectSet("modprofitLabel",OBJPROP_XDISTANCE,sideAdjustment+120);
ObjectSet("modprofitLabel",OBJPROP_YDISTANCE,up_downShift+100);
ObjectCreate("modprofitValue",OBJ_LABEL,0,0,0);
ObjectSetText("modprofitValue",DoubleToStr(profit,2),10,"Arial Bold",profitColor);
ObjectSet("modprofitValue",OBJPROP_CORNER,showOnRightTop);
ObjectSet("modprofitValue",OBJPROP_XDISTANCE,sideAdjustment+10);
ObjectSet("modprofitValue",OBJPROP_YDISTANCE,up_downShift+100);
ObjectCreate("modopenTradeLabel"+IntegerToString(i),OBJ_LABEL,0,0,0);
ObjectSetText("modopenTradeLabel"+IntegerToString(i),"T"+IntegerToString(j)+", Buy "+DoubleToStr(lots,2)+"",8,"Arial Bold",commentColor);
ObjectSet("modopenTradeLabel"+IntegerToString(i),OBJPROP_CORNER,showOnRightTop);
ObjectSet("modopenTradeLabel"+IntegerToString(i),OBJPROP_XDISTANCE,sideAdjustment+80);
ObjectSet("modopenTradeLabel"+IntegerToString(i),OBJPROP_YDISTANCE,20*j+85+up_downShift+20);
ObjectCreate("modpipProfitValue"+IntegerToString(i),OBJ_LABEL,0,0,0);
ObjectSetText("modpipProfitValue"+IntegerToString(i),DoubleToStr(tradeValue,1),8,"Arial Bold",tradeValueColor);
ObjectSet("modpipProfitValue"+IntegerToString(i),OBJPROP_CORNER,showOnRightTop);
ObjectSet("modpipProfitValue"+IntegerToString(i),OBJPROP_XDISTANCE,sideAdjustment+10);
ObjectSet("modpipProfitValue"+IntegerToString(i),OBJPROP_YDISTANCE,20*j+85+up_downShift+20);
continue;
}
if(OrderType()==OP_SELL)
{
lots=OrderLots();
profit+=OrderProfit()+OrderSwap()+OrderCommission();
tradeValue=(OrderOpenPrice()-Ask)/Point/multiplier;
if(tradeValue>0) tradeValueColor=Lime;
else tradeValueColor=Red;
if(profit>0) profitColor=Lime;
else profitColor=Red;
ObjectCreate("modprofitLabel",OBJ_LABEL,0,0,0);
ObjectSetText("modprofitLabel","Profit",10,"Arial Bold",ProfitLossColor);
ObjectSet("modprofitLabel",OBJPROP_CORNER,showOnRightTop);
ObjectSet("modprofitLabel",OBJPROP_XDISTANCE,sideAdjustment+120);
ObjectSet("modprofitLabel",OBJPROP_YDISTANCE,up_downShift+100);
ObjectCreate("modprofitValue",OBJ_LABEL,0,0,0);
ObjectSetText("modprofitValue",DoubleToStr(profit,2),10,"Arial Bold",profitColor);
ObjectSet("modprofitValue",OBJPROP_CORNER,showOnRightTop);
ObjectSet("modprofitValue",OBJPROP_XDISTANCE,sideAdjustment+10);
ObjectSet("modprofitValue",OBJPROP_YDISTANCE,up_downShift+100);
ObjectCreate("modopenTradeLabel"+IntegerToString(i),OBJ_LABEL,0,0,0);
ObjectSetText("modopenTradeLabel"+IntegerToString(i),"T"+IntegerToString(j)+", Sell "+DoubleToStr(lots,2)+"",8,"Arial Bold",commentColor);
ObjectSet("modopenTradeLabel"+IntegerToString(i),OBJPROP_CORNER,showOnRightTop);
ObjectSet("modopenTradeLabel"+IntegerToString(i),OBJPROP_XDISTANCE,sideAdjustment+83);
ObjectSet("modopenTradeLabel"+IntegerToString(i),OBJPROP_YDISTANCE,20*j+85+up_downShift+20);
ObjectCreate("modpipProfitValue"+IntegerToString(i),OBJ_LABEL,0,0,0);
ObjectSetText("modpipProfitValue"+IntegerToString(i),DoubleToStr(tradeValue,1),8,"Arial Bold",tradeValueColor);
ObjectSet("modpipProfitValue"+IntegerToString(i),OBJPROP_CORNER,showOnRightTop);
ObjectSet("modpipProfitValue"+IntegerToString(i),OBJPROP_XDISTANCE,sideAdjustment+10);
ObjectSet("modpipProfitValue"+IntegerToString(i),OBJPROP_YDISTANCE,20*j+85+up_downShift+20);
}
}
}
}
}
I include this code here but please don't just copy as I have heavily adjusted it to fit my retina display (it just looks horrid on a 13" Mac running Win7 on a retina) It should give you an idea of what I did.
THe two indi's work fine together now. Once you close your positions the pip values might still display but if you change the timeframe they disappear. It's not perfect but I'm happy with what I've accomplished thus far lol.