iATR

 

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);
 
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
   );
Reason: