In MT5 you don't get the shifted value of the indicators directly from the function call. First, you get the handle:
AOhandle = iAO(NULL, PERIOD_H1);
Then you copy the buffer from the handle:
double AObuffer[]; CopyBuffer(AOhandle, 0, 0, rates_total, AOhandle);
Now you can use the separate elements of the buffer. If you want classic timeseries order where the 9th element is 9 periods ago you should also set the buffer as series:
ArraySetAsSeries(AObuffer, true); double AO_9 = AObuffer[9];
In MT5 you don't get the shifted value of the indicators directly from the function call. First, you get the handle:
Then you copy the buffer from the handle:
Now you can use the separate elements of the buffer. If you want classic timeseries order where the 9th element is 9 periods ago you should also set the buffer as series:
Very many thanks. I was trying to get my head around the new way of extracting data. I think your example should go in the MT5 help file!
-Jerry
In MT5 you don't get the shifted value of the indicators directly from the function call. First, you get the handle:
Then you copy the buffer from the handle:
Now you can use the separate elements of the buffer. If you want classic timeseries order where the 9th element is 9 periods ago you should also set the buffer as series:
Very many thanks. I was trying to get my head around the new way of extracting data. I think your example should go in the MT5 help file!
-Jerry
Very many thanks. I was trying to get my head around the new way of extracting data. I think your example should go in the MT5 help file!
-Jerry
CopyBuffer(AOhandle, 0, 0, rates_total, AOBuffer);
Actually for correctness I think it should be this (but you knew that!
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
In MT4 I have:
A1 = iAO(NULL, PERIOD_H1, 1);
Reading the MT5 documentation I don't understand how to get it to work. It complains that the parameter count is wrong. It hasn't got the last item, so how do I extract the nth bar information?
The documentation says:
The function creates Accelerator Oscillator in a global cache of the client terminal and returns its handle. It has only one buffer.
Which doesn't really help very much. I wish the help file would contain examples as it is so much easier to understand.
-Jerry