Average True Range ATR Indicator For MT5
Table Of Contents:
- Average True Range ATR Indicator For MT5
- Cài đặt Average True Range ATR Indicator For MT5
- Các tham số của Average True Range ATR Indicator For MT5
- Bộ đệm của Average True Range ATR Indicator For MT5
- Các bộ phận chính của bộ luật
Average True Range ATR Indicator For MT5 là một trong những chỉ số tiêu chuẩn rất nổi tiếng trong gần như mọi nền tảng giao dịch. Nó được sử dụng làm cơ sở cho nhiều chỉ số khác sử dụng các giá trị của mình làm đầu vào để tính toán thêm. Chỉ báo ATR tính toán kích thước trung bình của nến X gần đây. Các giá trị cho phép bạn thấy sự tăng hoặc giảm của biến động trên thị trường.
Cài đặt Average True Range ATR Indicator For MT5
Sau khi bạn tải xuống chỉ báo qua biểu mẫu ở trên, bạn cần giải nén tệp zip. Sau đó, bạn cần sao chép tệp atr.mq5 vào thư mục MQL5Indicators cài đặt MT5 của bạn. Sau đó, vui lòng khởi động lại MT5 và sau đó bạn sẽ có thể thấy chỉ báo trong danh sách các chỉ báo.
Các tham số của Average True Range ATR Indicator For MT5
Average True Range ATR Indicator For MT5 có các tham số 1 để cấu hình.
input int InpAtrPeriod=14; // ATR period
Bộ đệm của Average True Range ATR Indicator For MT5
Average True Range ATR Indicator For MT5 cung cấp bộ đệm 2 .
SetIndexBuffer(0,ExtATRBuffer,INDICATOR_DATA); SetIndexBuffer(1,ExtTRBuffer,INDICATOR_CALCULATIONS);
Các bộ phận chính của bộ luật
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); } //+------------------------------------------------------------------+