in MT4 I have this technical indicator: double iATR( string symbol, int timeframe, int period, int shift)
symbol - Symbol the data of which should be used to calculate indicator. NULL means the current symbol.
timeframe - Timeframe. It can be any of Timeframe enumeration values. 0 means the current chart timeframe.
period - Averaging period for calculation.
shift - Index of the value taken from the indicator buffer (shift relative to the current bar the given amount of periods ago).
in MT5 there is no shift i.e. handle=iATR(name,period,atr_period);
string symbol, // symbol name
ENUM_TIMEFRAMES period, // period
int ma_period // averaging period
How do I implement this shift in MT5 if this is the code that I want to convert from MT4 is if(iATR(NULL,0,12,4)>iATR(NULL,0,20,3)) return(0);
You're right, ask for it at Service Desk then.
If we want to shift ATR to the left, then assign value to the previous bar. I.e, shift one bar to the left, instead assign ATR value to bar 0 we assign value to bar 1. However I have no idea if we have shift to the right, i.e. how to assign latest ATR value to the right side :( ?.
Just checking again. You may have to create ATR CI and use PlotSetIndexInteger() (click that) using ENUM_PLOT_PROPERTY_INTEGER's PLOT_SHIFT (click that).
I skip read those - lol.
Have you read Timeseries and Indicators Access section?
Actually working with indicators data in MQL5 is differents to MQL4. iATR function creates a handle. To get indicator values you should use CopyBuffer function.
Please read documentation carefully. There are an examples which might be helpful.
Thank you very much for the info. Any chance that Metaquotes will create English Video tutorials on MQL5?
Please enable the necessary setting in your browser, otherwise you will not be able to log in.