I'm delving into some MT4 EA development, and have a problem that's got me stumped. There's a simple call to a couple of builtin technical indicators as follows:-
double tMA = iMA(symbol, timeframe, MAlen, 0, MAtype, PRICE_CLOSE, shift);
double atr = iATR(symbol, timeframe, ATRlen, shift);
Shift is usually 1, and this is called about 14 times each time a new candle is created, each time for a different currency pair.
The problem is that by the time they're called 14 times, the terminal.exe's RAM usage balloons out from 200,000kb to well over 1gb, and slows the whole computer down. The next candle it adds another gb.
I've narrowed it down to these two lines - when commented out there's no problem (but the EA obviously doesn't work!)
and here I was thinking it was a coding problem! Yes, I was testing it on an account where most pairs had over 10 years of history loaded for backtesting purposes. Tried it on a brand new MT4 install and there's no problem at all.
Thanks Raptor :)
Max bars in history controls the size of the files on disk