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
Which doesn't really help very much. I wish the help file would contain examples as it is so much easier to understand.
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:
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:
double AO_9 = AObuffer;
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!
CopyBuffer(AOhandle, 0, 0, rates_total, AOBuffer);