try commenting out this line first....
IndicatorBuffers(buffers);
if get the same err, then try
IndicatorBuffers(buffers+1);
Read the Documentation . . .
From here: https://docs.mql4.com/customind/IndicatorBuffers
void IndicatorBuffers (int count)
"Allocates memory for buffers used for custom indicator calculations. The amount of buffers cannot exceed 8 or be less than the value given in the indicator_buffers property."
#property indicator_buffers 8 int buffers = 0; IndicatorBuffers(buffers);
Well Raptor, you pretty much nailed that one to the wall, thanks buddy :)
ok this is crazy there must be a bug, I ran that same test a second time with no more changes or modifications and now:
int buffers = 0; int drawbegin = 0; //+------------------------------------------------------------------+ int init() { //---- indicators initbuffer(zero, "buffertest", DRAW_LINE); // increments buffersEach chart change of pair, timeframe, refresh, etc, all indicators and EA goes through a deinit/init cycle. But there is only ONE load (statics and global). On load buffers=0..8. Next init buffers=8..16.(invalid index.) Reset buffers=0 inside init.
Oh really ? wow I never would have figured that one out, how do you know all this stuff WHR ? lol
ok I'm going to try that thanks for your help
OK that worked I added the line to init()
int init() { //---- indicators buffers = 0; initbuffer(zero, "buffertest", DRAW_LINE); initbuffer(one, "buffertest", DRAW_LINE);
ran the test three times there was no buffer error, thanks WHR as always your help is greatly appreciated :)

- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
I have a problem in my EA, strategy tester reports invalid index buffer number error repeatedly throughout the test so I created a simple test EA/Indicator combination to try and find the cause but I still get the same results in tester, I cant see what is wrong with these test programs can anyone shed some light on this ?
test indicator:
test EA: