Page 1 of 1

Code Help

Posted: Tue Oct 03, 2017 10:24 pm
by mtbBend
Trying to get the profit of the order just closed and add that to my previous TpAmount variable ... Would this work?


double ticket=OrderSelect(i,SELECT_BY_POS,MODE_TRADES);
if(OrderType()>=2 || OrderMagicNumber()!=MyMagic) continue;

Print("* Closing ... ",OrderSymbol(),". Ticket #"+IntegerToString(OrderTicket()) );

while (true)
{
ResetLastError();
if(OrderType()==OP_BUY)
ticket=OrderClose(OrderTicket(),OrderLots(),NormalizeDouble(Bid,Digits),3,clrBlue);
TpAmount+=(OrderProfit)