- Strange values from External Indicacor with CopyBuffer
- IMA indicator value of 10
- How can I read iMA values in real time?
Timeseries and Indicators Access / CopyBuffer - Reference on algorithmic/automated trading language for MetaTrader 5 Tries very hard to explain the ordering of the data.
Counting of elements of copied data (indicator buffer with the index buffer_num) from the starting position is performed from the present to the past, i.e., starting position of 0 means the current bar (indicator value for the current bar).
:
No matter what is the
property of the target array - as_series=true or as_series=false. Data
will be copied so that the oldest element will be located at the start
of the physical memory allocated for the array.
In case one, you are retrieving two values starting at zero (newest.) Therefor sma3[1] is the newest and sma3[0] is one back.
In case two, you are retrieving 50 values starting at zero (newest.) Therefor sma3[49] is the newest and sma3[48] is one back and sma3[0] is 50 bars ago.
So of course they don't match.
Set the array as series (Array Functions / ArraySetAsSeries - Reference on algorithmic/automated trading language for MetaTrader 5) after filling and you will get sma3[0] is newest, sma3[1] is one back, etc.
Timeseries and Indicators Access / CopyBuffer - Reference on algorithmic/automated trading language for MetaTrader 5 Tries very hard to explain the ordering of the data.
In case one, you are retrieving two values starting at zero (newest.) Therefor sma3[1] is the newest and sma3[0] is one back.
In case two, you are retrieving 50 values starting at zero (newest.) Therefor sma3[49] is the newest and sma3[48] is one back and sma3[0] is 50 bars ago.
So of course they don't match.
Set the array as series (Array Functions / ArraySetAsSeries - Reference on algorithmic/automated trading language for MetaTrader 5) after filling and you will get sma3[0] is newest, sma3[1] is one back, etc.
It worked! Thanks a lot whroeder1
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use