iMAOnArray problem.. New comment Forex Trader 2009.07.25 19:54 so if you want to use the average range of the last 1000 bars of the current chart: sum(high-low)/n, how would you code this to use as a variable in your code? This would need to be adapted somehow.. I guess I would have to use iMAOnArray, but how set it the right way? This doesn't give any errors in the MetaEditor, but in MT4 it gives: "2009.07.25 17:41:44 range USDJPY,H1: first parameter for iMAOnArray indicator must be an array" CurrentHigh = iHigh(NULL,0,i); CurrentLow = iLow(NULL,0,i+RPeriod); range=CurrentHigh-CurrentLow; range = ArraySetAsSeries(range,true); double avgrange=iMAOnArray(range,0,1000,0,MODE_SMA,0); Range[i] = avgrange; //Range[i] = range; little help pls range over the last 1000 bars? Need help on codes iMAonArray New comment
so if you want to use the average range of the last 1000 bars of the current chart:
sum(high-low)/n, how would you code this to use as a variable in your code?
This would need to be adapted somehow.. I guess I would have to use iMAOnArray, but how set it the right way?
This doesn't give any errors in the MetaEditor, but in MT4 it gives:
"2009.07.25 17:41:44 range USDJPY,H1: first parameter for iMAOnArray indicator must be an array"
CurrentHigh = iHigh(NULL,0,i);
CurrentLow = iLow(NULL,0,i+RPeriod);
range=CurrentHigh-CurrentLow;
range = ArraySetAsSeries(range,true);
double avgrange=iMAOnArray(range,0,1000,0,MODE_SMA,0);
Range[i] = avgrange;
//Range[i] = range;
little help pls