MENU
  • FX・CFD必要証拠金計算ツール(ハイレバ対応)
  • FX複利計算シミュレーター
  • 余力に応じたロット計算ツール
  • MA乖離率ランキングツール
  • お問い合わせ
FX取引に関するあれこれ
  • FX・CFD必要証拠金計算ツール(ハイレバ対応)
  • FX複利計算シミュレーター
  • 余力に応じたロット計算ツール
  • MA乖離率ランキングツール
  • お問い合わせ
  1. ホーム
  2. MQL
  3. 【MT4インジケーター】マルチタイムADX

【MT4インジケーター】マルチタイムADX

2025 6/02
MQL
2025年6月2日
当ページのリンクには広告が含まれています。
//+------------------------------------------------------------------+
//|                                                      MTF_ADX.mq4 |
//|                                  Copyright 2025, MetaQuotes Ltd. |
//|                                             https://www.mql5.com |
//+------------------------------------------------------------------+
#property copyright "Copyright 2025, MetaQuotes Ltd."
#property link      "https://www.mql5.com"
#property version   "1.00"
#property strict
#property indicator_separate_window
#property indicator_level1 20
#property indicator_buffers 3
#property indicator_color1 LightSeaGreen
#property indicator_color2 YellowGreen
#property indicator_color3 Wheat

/*
double  iADX(
   string       symbol,        // 通貨ペア
   int          timeframe,     // 時間軸
   int          period,        // 平均期間
   int          applied_price, // 適用価格
   int          mode,          // ラインインデックス
   int          shift          // シフト
   );
*/

//--- indicator parameters
input ENUM_TIMEFRAMES TimeFrame = PERIOD_D1;  //時間足
input int InPeriod=20;

//--- buffers
double ExtMapBuffer1[];
double ExtMapBuffer2[];
double ExtMapBuffer3[];
//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int OnInit()
  {
   SetIndexBuffer(0,ExtMapBuffer1);
   SetIndexBuffer(1,ExtMapBuffer2);
   SetIndexBuffer(2,ExtMapBuffer3);
   SetIndexStyle(0,DRAW_LINE,STYLE_SOLID,2);
   SetIndexStyle(1,DRAW_LINE,STYLE_DOT,1);
   SetIndexStyle(2,DRAW_LINE,STYLE_DOT,1);
   return(INIT_SUCCEEDED);
}
//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+
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 &tick_volume[],
                const long &volume[],
                const int &spread[])
{
  if (_Period > TimeFrame && TimeFrame != PERIOD_CURRENT) return -1;
  
  int limit = Bars - IndicatorCounted() - 1;
  int min = PeriodSeconds(TimeFrame) / PeriodSeconds();
  if (limit < min) limit = min;
  for (int i = limit; i >= 0; i--)
  {
    int bar = iBarShift(NULL, TimeFrame, Time[i]);
    ExtMapBuffer1[i]=iADX(NULL,TimeFrame,InPeriod,PRICE_HIGH,MODE_MAIN,bar) ; 
    ExtMapBuffer2[i]=iADX(NULL,TimeFrame,InPeriod,PRICE_HIGH,MODE_PLUSDI,bar) ; 
    ExtMapBuffer3[i]=iADX(NULL,TimeFrame,InPeriod,PRICE_HIGH,MODE_MINUSDI,bar) ;    
  }
  return(rates_total);
}
MQL
よかったらシェアしてね!
  • URLをコピーしました!
  • URLをコピーしました!
  • ボリンジャーバンドの「長所」と「短所」、そして実践的なトレード手法2選!

関連記事

  • 【MT4インジケーター】マルチタイムボリンジャーバンド
    2025年6月2日
  • 【MT4インジケーター】マルチタイム平均足
    2025年5月14日

コメント

コメントする コメントをキャンセル

© FX取引に関するあれこれ.

目次