Decrease lot........

 
Hi all. I need decrease lots after (every) loss to 0.1 lots. And after (every) win increase lots to 1.0 lots. How do it? Ty.
 
Find the last order in history.
    double lots;
    datetime lastClose;
    for(int pos=0; pos < OrdersHistoryTotal(); pos++) if (
        OrderSelect(pos, SELECT_BY_POS, MODE_HISTORY)   // Only orders w/
    &&  OrderCloseTime()    > lastClose                 // not yet processed,
    &&  OrderMagicNumber()  == magic.number             // my magic number
    &&  OrderSymbol()       == Symbol()                 // and my pair.
    &&  OrderType()         <= OP_SELL // Avoid cr/bal https://www.mql5.com/en/forum/126192
    ){
        lastClose = OrderCloseTime();
        if (OrderProfit() < 0) lots=0.1 else lots=1.0;
   }
 
rozirozi:

but when i use your money management to my EA, i got many errors and EA isn´t ready to use.

Can you please add your code to my EA?

  1. I just typed in a solution to your question, not compiled, not tested. Fix the syntax errors, change the variable to match YOUR code.
  2. No Slaves here, learn to code or pay someone. We're not going to code it FOR you. We are willing to HELP you.
Reason: