How to programmatically get the value of an indicator which is applied to the value of another indicator - page 2
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
I don't see why you would need to change the series on a buffer.
Buffers are automatically re-sized to the number of bars and when a new bar is formed there is a new position [0]. The old pos[0] is shifted to pos[1] etc.
By using ArraySetAsSeries(BufferRSI, false), on the next new bar tick, the new position will be added at the other end, at pos[Bars-1] and the loop will be overwriting the same positions every time ( [limit] to [0] ) because you reset the buffer to TimeSeries
Because iRSIOnArray (& iMAOnArray) calculates from left to right.
From the docs on them:
Note
Unlike iRSI(...), the iRSIOnArray() 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.
Because iRSIOnArray (& iMAOnArray) calculates from left to right.
From the docs on them:
Note
Unlike iRSI(...), the iRSIOnArray() does not take data by symbolname, timeframe, the applied price. The price data must be previously prepared.The indicator is calculated from left to right. To access to the array elementsas to a series array (i.e., from right to left), one has to use the ArraySetAsSeries()function.
I believe this documentation to be misleading and confusing
Put this code into an indicator
Attach it to an M1 chart and check the data window, you will see that the iRSIOnArray exactly follows the real RSI
Then change
to
Then see what happens when a new bar opens
There is no need to mess about with SetAsSeries
I believe this documentation to be misleading and confusing
Put this code into an indicator
Attach it to an M1 chart and check the data window, you will see that the iRSIOnArray exactly follows the real RSI
Then change
to
Then see what happens when a new bar opens
There is no need to mess about with SetAsSeries
That looks like some MQ5 stuff I saw, but since they seem compatible... great! Thank you very much, I will try to play with this first. Much appreciated.
GumRai:
I tried the code below. It worked rather well, except for a couple things...
EDIT: Actually, looking a little further into it, I found they were all my bugs essentially. Works great now, so thank you for the MQ5-like code, and especially for clearing up my long-misunderstood array reversal issues.