for (s=0; s<=limit; s++) RSIBuffer[s]=iRSI(0,0,7,PRICE_CLOSE,s); for (t=0; t<=limit; t++) MAofRSIBuffer[t]=iMAOnArray(RSIBuffer,0,3,0,MODE_EMA,t);
- Buffers auto-size and their contents auto-shift. Arrays don't.
- After the first run limit will usually be zero, so you are replacing just RSI[0] and creating a MA with old unrelated bars
- Replace your arrays with two buffers
- Contradictory information on IndicatorCounted() - MQL4 forum
Hi all,
I've only been coding for a week but have found my way around most things i want to do so far. However this one particular seemingly simple task is causing me no end of grief. i have searched this site and web and found various different solutions all of which i have attempted to make work. i seem to be close.... the RSI values i know are good but the MA values seem way out hence my indicator arrows in wrong location. I notice if i change the buffer size my arrows move...? Where am i going wrong...Thanks
Read the documentation for iMAOnArray() very carefully, it's pretty poor I admit, but you need to take notice of this . . .
Calculation of the Moving Average on data stored in a numeric array. Unlike iMA(...), the iMAOnArray function does not take data by symbol name, timeframe, the applied price. The price data must be previously prepared. The indicator is calculated from left to right. To access to the array elements as to a series array (i.e., from right to left), one has to use the ArraySetAsSeries function.
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Hi all,
I've only been coding for a week but have found my way around most things i want to do so far. However this one particular seemingly simple task is causing me no end of grief. i have searched this site and web and found various different solutions all of which i have attempted to make work. i seem to be close.... the RSI values i know are good but the MA values seem way out hence my indicator arrows in wrong location. I notice if i change the buffer size my arrows move...? Where am i going wrong...Thanks