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.
- Automatic Lots size increase/decrease
- Great EA in backtest!
- Trying to add a Moving Average to indicator but need help
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?
- I just typed in a solution to your question, not compiled, not tested. Fix the syntax errors, change the variable to match YOUR code.
- No Slaves here, learn to code or pay someone. We're not going to code it FOR you. We are willing to HELP you.

You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register