こんにちは、トレーダーのみなさん!今日は、MetaTrader 5の標準ボリンジャーバンドインジケーターの代替として開発したカスタムボリンジャーバンドインジケーターをご紹介します。このインジケーターは、シンプルな移動平均法だけでなく、指数移動平均、スムーズ移動平均、線形加重移動平均など、さまざまな計算方法を選択できるのが特徴です。
このインジケーターを使用するには、Windowsの以下のパスに配置してください:
- C:\Users\あなたのユーザー名\AppData\Roaming\MetaQuotes\Terminal\Indicators\Examples
追加機能:

デフォルトでは、値はゼロに設定されています:

線形加重移動平均を選択した場合の実行例:

コード:
//+------------------------------------------------------------------+
//|カスタムボリンジャーバンドインジケーター|\n//|作成者: Lucas Vidal|\n//|https://www.mql5.com|\n//+------------------------------------------------------------------+
#property copyright "Lucas Vidal"
#property link "https://www.mql5.com/en/users/lucasmoura00"
#property description "カスタムボリンジャーバンド"
#include <MovingAverages.mqh>
//--- インジケータ設定
#property indicator_chart_window
#property indicator_buffers 4
#property indicator_plots 3
#property indicator_type1 DRAW_LINE
#property indicator_color1 LightSeaGreen
#property indicator_type2 DRAW_LINE
#property indicator_color2 LightSeaGreen
#property indicator_type3 DRAW_LINE
#property indicator_color3 LightSeaGreen
#property indicator_label1 "バンド中央"
#property indicator_label2 "バンド上"
#property indicator_label3 "バンド下"
//--- 入力パラメータ
enum MovingAverageMethod {
Simple, // 0
Exponential, // 1
Smoothed, // 2
LinearWeighted // 3
};
input MovingAverageMethod InpMaMethod = Simple; // 移動平均法
input int InpBandsPeriod = 20; // パラメータ
input int InpBandsShift = 0; // シフト
input double InpBandsDeviations = 2.0; // 偏差
//--- グローバル変数
int ExtBandsPeriod, ExtBandsShift;
double ExtBandsDeviations;
int ExtPlotBegin = 0;
//--- インジケータバッファ
double ExtMLBuffer[];
double ExtTLBuffer[];
double ExtBLBuffer[];
double ExtStdDevBuffer[];
//+------------------------------------------------------------------+
ぜひこのカスタムボリンジャーバンドを試してみて、自分のトレードスタイルに合わせて活用してください!