switch enter-conditions if last trade was a loss

 

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; 
    }
 }