Hello everybody,
I've been coding for some time with mql4 and now shifting to mql5, and I'm having a really hard time with a very simple code.
For the purpose of training and understanding, i'm building a test indicator that connects the outputs of the IFractals handle with DRAW_SECTION plot.
I've read the docs on CopyBuffer again and again, and still I can't make this work. Indicator draws the two lines when I put it on the chart the first time, but when I go forward in the tester it draws nothing more. Really I'm not understanding the reason.
Here's my code, can anybody make light on why this doesn't plot forward??
Probably because you don't know how the Fractals indicator is working, you are copying the candle 0 only (current candle) :
else { start=prev_calculated-1; toCopy=rates_total-prev_calculated; if(prev_calculated>0) toCopy++; } CopyBuffer(HDLFractals,0,0,toCopy,testBuffer); CopyBuffer(HDLFractals,1,0,toCopy,testBuffer2);
toCopy is zero most of the time, except when there is a new candle. So you are copying a value which is never set by the Fractals indicator.
You need to copy at least 3 more candles, as the Fractals check a new high low with at least 2 closed candles after it.
toCopy=rates_total-prev_calculated+3;
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Hello everybody,
I've been coding for some time with mql4 and now shifting to mql5, and I'm having a really hard time with a very simple code.
For the purpose of training and understanding, i'm building a test indicator that connects the outputs of the IFractals handle with DRAW_SECTION plot.
I've read the docs on CopyBuffer again and again, and still I can't make this work. Indicator draws the two lines when I put it on the chart the first time, but when I go forward in the tester it draws nothing more. Really I'm not understanding the reason.
Here's my code, can anybody make light on why this doesn't plot forward??