anybody even hints will be appreciated?

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,
My question is about sliding the buffer in custom indicator.
E.g:
While running indicator will calculate the latest RSI values of the latest 5 bars. If for example in a situation that limit==2 (and limit==2 happens alot in my tests when calling via iCustom in a EA) then it will calculate bar 0 and bar 1 values and write to RSI[0] and RSI[1] respectively and won't touch the rest of the buffer. Every custom indicator I've seen is written this way. Shouldn't we slide the buffer if limit < MAX_LOOK_BACK ? as it overwrites the RSI[0] and RSI[1] but the previous values of these elements should be in RSI[2] and RSI[3] am I right?
To visualise :
Tick=0 AND limit = 5 ==> RSI[0] = 33.33 RSI[1] =44,44 RSI[2]=55,55 RSI[3]=66,66 RSI[4] = 77.77
Now assume latest 2 RSI values are 88,88 and 99,99 and array will look like below:
Tick=1 AND limit = 2 ==> RSI[0] = 88,88 RSI[1] =99.99 RSI[2]=55,55 RSI[3]=66,66 RSI[4] = 77.77
BUT shouldn't it be this:
Tick=1 AND limit = 2 ==> RSI[0] = 88,88 RSI[1] =99.99 RSI[2]=33,33 RSI[3]=44,44 RSI[4] = 55.55
Why all indicators written this way and there's no sliding of values. And why they draw trend lines correctly.
You can check this example as well: https://docs.mql4.com/customind/IndicatorCounted