switch enter-conditions if last trade was a loss

Back to topics list To post a new topic, please log in or register
avatar
12
insub 2015.09.16 09:35
 

So basically i want switch the enter-conditions if the last trade was a loss.

to check if last trade was a loss i have this code. but i dont know how to proceed.

string last="profit";
for(int i=(OrdersHistoryTotal()-1); i>=0; i--)
 {
   OrderSelect(i, SELECT_BY_POS,MODE_HISTORY);
   if(OrderSymbol()==Symbol())
    {
       //for buy order
       if(OrderType()==OP_BUY && OrderProfit()>0) last="profit";
       if(OrderType()==OP_BUY && OrderProfit()<0) last="loss";
       
       if(OrderType()==OP_BUY && OrderProfit()<0) last="profit";
       if(OrderType()==OP_BUY && OrderProfit()>0) last="loss";
       break; 
    }
 }

Back to topics list  

To add comments, please log in or register