Average True Range ATR Indicator For MT5
Table Of Contents:
- Average True Range ATR Indicator For MT5
- Average True Range ATR Indicator For MT5インストール
- Average True Range ATR Indicator For MT5パラメーター
- Average True Range ATR Indicator For MT5
- コードの主要部分
Average True Range ATR Indicator For MT5のAverage True Range ATR Indicator For MT5は、ほぼすべての取引プラットフォームで非常に有名な標準インジケーターの1つです。それは、さらに計算するための入力として彼の値を使用する他の多くの指標の基礎として使用されます。 ATRインジケーターは、最近のX個のろうそくの平均サイズを計算します。この値により、市場のボラティリティの増減を確認できます。
Average True Range ATR Indicator For MT5インストール
上記のフォームからインジケーターをダウンロードした後、zipファイルを解凍する必要があります。次に、ファイルatr.mq5をMT5インストールのMQL5Indicatorsフォルダーにコピーする必要があります。その後、MT5を再起動してください。そうすると、インジケーターのリストにインジケーターが表示されます。
Average True Range ATR Indicator For MT5パラメーター
Average True Range ATR Indicator For MT5は、構成する1 パラメーターがあります。
input int InpAtrPeriod=14; // ATR period
Average True Range ATR Indicator For MT5
Average True Range ATR Indicator For MT5は、 2 バッファーを提供します。
SetIndexBuffer(0,ExtATRBuffer,INDICATOR_DATA); SetIndexBuffer(1,ExtTRBuffer,INDICATOR_CALCULATIONS);
コードの主要部分
int OnCalculate(const int rates_total, const int prev_calculated, const datetime &Time[], const double &Open[], const double &High[], const double &Low[], const double &Close[], const long &TickVolume[], const long &Volume[], const int &Spread[]) { int i,limit; //--- check for bars count if(rates_total lt =ExtPeriodATR) return(0); // not enough bars for calculation //--- preliminary calculations if(prev_calculated==0) { ExtTRBuffer[0]=0.0; ExtATRBuffer[0]=0.0; //--- filling out the array of True Range values for each period for(i=1;i lt rates_total && !IsStopped();i++) ExtTRBuffer[i]=MathMax(High[i],Close[i-1])-MathMin(Low[i],Close[i-1]); //--- first AtrPeriod values of the indicator are not calculated double firstValue=0.0; for(i=1;i lt =ExtPeriodATR;i++) { ExtATRBuffer[i]=0.0; firstValue+=ExtTRBuffer[i]; } //--- calculating the first value of the indicator firstValue/=ExtPeriodATR; ExtATRBuffer[ExtPeriodATR]=firstValue; limit=ExtPeriodATR+1; } else limit=prev_calculated-1; //--- the main loop of calculations for(i=limit;i lt rates_total && !IsStopped();i++) { ExtTRBuffer[i]=MathMax(High[i],Close[i-1])-MathMin(Low[i],Close[i-1]); ExtATRBuffer[i]=ExtATRBuffer[i-1]+(ExtTRBuffer[i]-ExtTRBuffer[i-ExtPeriodATR])/ExtPeriodATR; } //--- return value of prev_calculated for next call return(rates_total); } //+------------------------------------------------------------------+