-
to_copy=rates_total-prev_calculated; // At 00:00 its 6258 then on each new bar change it goes 1 then after its back to 0 if(prev_calculated>0) { to_copy++; // At 00:00 its 2 then 1 then on each new bar its 2 then 1 etc } } // Copy price info from indicator iMA() into arrays CopyBuffer(fastMA,0,0,to_copy,MAOsc); while(limit >= 0) { for(int a = 0; a < 2; a++) { int i = limit + a; Print(MAOsc[i]);
You return rates_total. So after the initial run, limit is zero, to_copy is one, the array has one element and limit+a is beyond the array for non-zero a. -
Your look back here is one (a < 2).
How to do your lookbacks correctly #9 — #14 & #19

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
Hi, in the following code i fail to see why im getting an array out of range error?
On the parts outlined why when i make a < 1 it works okay
but when i make a < 2 it gives me the array out of range error?