Download MetaTrader 5

iATR

To add comments, please log in or register
Guilherme Mendonca
4386
Guilherme Mendonca  

Hello folks, 


I would like to get the value of the Average True Range Indicator (ATR).

I tried to use the following code, but the value is different when I checked with the indicator.


input ENUM_TIMEFRAMES ATR_PERIOD=PERIOD_M15;
input int MA_PERIOD=16;

   double atr_avg = iATR(_Symbol,ATR_PERIOD,MA_PERIOD);
   Print (atr_avg);
whroeder1
15934
whroeder1  
You didn't try to use that code because it does not compile.
Your code
iATR - Technical Indicators - MQL4 Reference
iATR(
   _Symbol,
   ATR_PERIOD,
   MA_PERIOD
             
);
double  iATR(
   string       symbol,     // symbol
   int          timeframe,  // timeframe
   int          period,     // averaging period
   int          shift       // shift
   );
To add comments, please log in or register