Look, if you're starting out on MQL4, don't complicate yourself with dynamic batch logic as soon as possible. You better keep the lot steady until you understand how EA works in general.
Printable View
Look, if you're starting out on MQL4, don't complicate yourself with dynamic batch logic as soon as possible. You better keep the lot steady until you understand how EA works in general.
I understand, but what I want to achieve is not so complex. I just want to increase lots in profit and restart with loss. I don't care about the rest of the EA, I just care about that logic. Believe in your analysis and keep the plan, don't panic with the moves.
I'd stop insisting on that crap code and start one from scratch, save you hours of frustration.
I recommend this approach: create a lastTradeProfit global variable, use it to decide the size of the next batch. You can save it to a GlobalVariable if you need persistence.
It's just what you describe, but be careful, it can be just as dangerous.
Brother, if it's already giving you stoploss mistakes, don't trust the backtest result.
What I find odd is that it only works in pairs with JPY. Have you checked the Point and Digits decimals? I could be miscalculating the values for that.
You're right, I'm using 0.01 for the minimum batch, could that be affecting the pairs without JPY? Believe in your analysis and keep the plan, don't panic with the moves.
Exactly. The minimum lot and the minimum SL vary between pairs. MQL4 does not give you a clear error, only fails silently if something does not fit.
An easy solution: use MarketInfo(Symbol(