"the correct way should be for(int i=Bars-1; i>=0; i--) - that way you shall avoid errors in a lot of cases"-mladen on tsd forum
limit=Bars-1-counted_bars;you know you could email him by emailing admin right?
Your maximum look back is Depth. | double high = buffer4[ArrayMaximum(buffer4,Depth,i)]; : for(int k=1; k<=Depth; k++) |
Handle lookback. | int counted_bars=IndicatorCounted(); int i,r,limit; if(counted_bars<0) return(-1); // if(counted_bars>0) counted_bars--; // limit=Bars-counted_bars; limit=Bars-1-MathMax(Depth, counted_bars);No need for the decrement. |
Once again thank you WHRoeder. And thanks Subgenius. I will do something nice for a stranger tomorrow to even out the cosmic balance ;)
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
There is some explanation on this error here and here. But still I can not figure it out.. So please check out this code on an indicator called RMO, "Rahul Mohindar Oscillator". Coded not by me, but a great coder on another forum.. But after all the updates and changes to MT4 this does not work any more: I get the error "array out of range in 'rmo.mq4' (85,14)" which is the third line in this code fragment; the full code is attached.