EA change lot size according to previous operation

 

Hello

Someone can help me. I'm doing an EA  and I want to change the price according to the result of the previous operation


   OrderSelect(1,SELECT_BY_POS,MODE_HISTORY);
   if(OrderProfit()=<0)
   lotaje1=lotaje1+step1;
   
   else if(OrderProfit()>0)
   lotaje1=_LOT_trade_1;


Try doing it with OrderSelect () as shown above using MODE_HISTORY to evaluate closed trades and if OrderProfit is equal to or smaller than 0 then add the rake in step1 + step1 and if OrderProfit is greater than 0 regatta the lotion to its original selection.

I already try it this way and it changes the size of the lot disproportionately and never returns to its point of origin.

Does anyone know how to correct this? or how else can it be used? Maybe with MagicNumber.

I appreciate your comments


Thank you.

Reason: