2つの
ColorZerolagMomentum指標シグナルに基づいたExp_ColorZerolagMomentum_X2トレンド取引システムです。1番目の指標は、メインラインとシグナルラインの位置に基づいて低速トレンドの方向を決定します。2番目の指標は、線が交差したり接触したりしたときに取引を開始する瞬間を決定します。シグナルは、次の2つの条件が満たされた場合にバーが閉じるときに形成されます。
高速及び低速動向のシグナルが一致する
高速動向の方向性が変わった
エキスパートアドバイザーの入力パラメータ:
input string Trade="Trade management";
input double MM=0.1;
input MarginMode MMMode=LOT;
input uint StopLoss_=1000;
input uint TakeProfit_=2000;
input string MustTrade="Trade permissions";
input int Deviation_=10;
input bool BuyPosOpen=true;
input bool SellPosOpen=true;
input string Filter="PARAMETERS FOR SLOW TREND";
input ENUM_TIMEFRAMES TimeFrame=PERIOD_H6;
input uint smoothing=15;
input ENUM_APPLIED_PRICE IPC=PRICE_CLOSE;
input double Factor1=0.05;
input uint Momentum_period1=8;
input double Factor2=0.10;
input uint Momentum_period2=21;
input double Factor3=0.16;
input uint Momentum_period3=34;
input double Factor4=0.26;
input int Momentum_period4=55;
input double Factor5=0.43;
input uint Momentum_period5=89;
input uint SignalBar=1;
input bool BuyPosClose=true;
input bool SellPosClose=true;
input string Input="ENTRY PARAMETERS";
input ENUM_TIMEFRAMES TimeFrame_=PERIOD_M30;
input uint smoothing_=15;
input ENUM_APPLIED_PRICE IPC_=PRICE_CLOSE;
input double Factor1_=0.05;
input uint Momentum_period1_=8;
input double Factor2_=0.10;
input uint Momentum_period2_=21;
input double Factor3_=0.16;
input uint Momentum_period3_=34;
input double Factor4_=0.26;
input int Momentum_period4_=55;
input double Factor5_=0.43;
input uint Momentum_period5_=89;
input uint SignalBar_=1;
input bool BuyPosClose_=false;
input bool SellPosClose_=false;
入力パラメータのコード内のテキストを含む文字列パラメータは、エキスパートアドバイザーの入力パラメータウィンドウをよりよく視覚化するためのものです。
EAのColorZerolagMomentum_HTF指標は、ストラテジーテスターでのより便利なトレンドの視覚化のためにのみ含まれており、他の操作モードでは無効です。
コンパイルされたColorZerolagMomentum.ex5とColorZerolagMomentum_HTF.ex5ファイルを<terminal_data_folder>\MQL5\Indicatorsに配置します。
ColorZerolagMomentum.ex5およびColorZerolagMomentum_HTF.ex5指標は、コンパイル後Exp_ColorZerolagMomentum.ex5エキスパートファイルにリソースとして含まれているため、コンパイルされたEAは同ファイルがターミナルフォルダに存在しなくても動作します。この目的のために、エキスパートの実行可能ファイルにこれらの指標を含めるための対応するコードがEAコードに追加されています。
指標の実行可能ファイルは、グローバルスコープでリソースとして追加されました。
#resource "\\Indicators\\ColorZerolagMomentum.ex5"
#resource "\\Indicators\\ColorZerolagMomentum_HTF.ex5"
OnInit()関数のブロックでリソースとして使用される指標の文字列パスを変更しました。
InpInd_Handle=iCustom(Symbol(),TimeFrame,"::Indicators\\ColorZerolagMomentum",
smoothing,IPC,Factor1,Momentum_period1,Factor2,Momentum_period2,Factor3,Momentum_period3,Factor4,Momentum_period4,Factor5,Momentum_period5);
if(InpInd_Handle==INVALID_HANDLE)
{
Print(" Failed to get handle of the ColorZerolagMomentum indicator");
return(INIT_FAILED);
}
InpInd_Handle_=iCustom(Symbol(),TimeFrame_,"::Indicators\\ColorZerolagMomentum",
smoothing_,IPC_,Factor1_,Momentum_period1_,Factor2_,Momentum_period2_,Factor3_,Momentum_period3_,Factor4_,Momentum_period4_,Factor5_,Momentum_period5_);
if(InpInd_Handle_==INVALID_HANDLE)
{
Print(" Failed to get handle of the ColorZerolagMomentum indicator");
return(INIT_FAILED);
}
if(MQLInfoInteger(MQL_VISUAL_MODE))
{
int Ind_Handle=iCustom(Symbol(),Period(),"::Indicators\\ColorZerolagMomentum_HTF",TimeFrame,
smoothing,IPC,Factor1,Momentum_period1,Factor2,Momentum_period2,Factor3,Momentum_period3,Factor4,Momentum_period4,Factor5,Momentum_period5);
if(Ind_Handle==INVALID_HANDLE)
{
Print(" Failed to get handle of the ColorZerolagMomentum_HTF indicator");
return(INIT_FAILED);
}
Ind_Handle=iCustom(Symbol(),Period(),"::Indicators\\ColorZerolagMomentum_HTF",TimeFrame_,
smoothing_,IPC_,Factor1_,Momentum_period1_,Factor2_,Momentum_period2_,Factor3_,Momentum_period3_,Factor4_,Momentum_period4_,Factor5_,Momentum_period5_);
if(Ind_Handle==INVALID_HANDLE)
{
Print(" Failed to get handle of the ColorZerolagMomentum_HTF indicator");
return(INIT_FAILED);
}
}
したがって、エキスパートのコンパイルされた実行可能ファイルは、他の取引端末上で指標なしでそれ自体で使用することができます。
TradeAlgorithms.mqh ライブラリファイルはノンゼロスプレッドを提供するエキスパートアドバイザーの使用、また、注文を出す際の決済逆指値と決済指値のオプション設定を可能にすることにご注意ください。 ライブラリのより多くのバリアントは取引アルゴリズムでダウンロードできます。
以下の検証では、デフォルトのエキスパートアドバイザー入力パラメータが使用されました。決済逆指値と決済指値は使われていません。

図1 チャートでの約定の例
2015年のGBPJPYテスト結果、H6低速トレンド、M30高速トレンドによる参入:

図2 検証結果のチャート