
目次
ソースコード
//+------------------------------------------------------------------+
//| MTF-Gator.mq4 |
//| Copyright 2022,Greeds Co., Ltd. |
//| https://greeds.net |
//+------------------------------------------------------------------+
#property copyright "Copyright 2022,Greeds Co., Ltd."
#property link "https://greeds.net"
#property version "1.00"
#property strict
#property indicator_separate_window
#property indicator_buffers 4
#property indicator_color1 Green
#property indicator_color2 Red
#property indicator_color3 Red
#property indicator_color4 Green
double Buf1[];
double Buf2[];
double Buf3[];
double Buf4[];
input ENUM_TIMEFRAMES in_timeFrame = PERIOD_CURRENT; // マルチタイムフレーム
input int InpJawsPeriod=13; // ジョーライン平均期間
input int InpJawsShift=8; // ジョーラインシフト
input int InpTeethPeriod=8; // トゥースライン平均期間
input int InpTeethShift=5; // トゥースラインシフト
input int InpLipsPeriod=5; // リップライン平均期間
input int InpLipsShift=3; // リップラインシフト
input ENUM_MA_METHOD in_method=MODE_SMMA; // 移動平均の種別
input ENUM_APPLIED_PRICE in_applied_price=PRICE_MEDIAN; // 適用価格
int OnInit()
{
SetIndexBuffer(0, Buf1 );
SetIndexBuffer(1, Buf2 );
SetIndexBuffer(2, Buf3 );
SetIndexBuffer(3, Buf4 );
SetIndexStyle(0, DRAW_HISTOGRAM , STYLE_SOLID , 1 );
SetIndexStyle(1, DRAW_HISTOGRAM , STYLE_SOLID , 1 );
SetIndexStyle(2, DRAW_HISTOGRAM , STYLE_SOLID , 1 );
SetIndexStyle(3, DRAW_HISTOGRAM , STYLE_SOLID , 1 );
SetIndexShift(0,InpTeethShift);
SetIndexShift(1,InpTeethShift);
SetIndexShift(2,InpTeethShift);
SetIndexShift(3,InpTeethShift);
return( INIT_SUCCEEDED );
}
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[])
{
int JawsShift=InpJawsShift;
int TeethShift=InpTeethShift;
int LipsShift=InpLipsShift;
if(JawsShift*Period()>in_timeFrame && in_timeFrame != NULL)
JawsShift = JawsShift*Period()/in_timeFrame;
if(TeethShift*Period()>in_timeFrame && in_timeFrame != NULL)
TeethShift = TeethShift*Period()/in_timeFrame;
if(LipsShift*Period()>in_timeFrame && in_timeFrame != NULL)
LipsShift = LipsShift*Period()/in_timeFrame;
int limit = Bars - prev_calculated;
for(int i=0; i<limit; i++)
{
int shift = iBarShift(NULL, in_timeFrame, time[i]);
double jaw = iGator(NULL,in_timeFrame,InpJawsPeriod,InpJawsShift,InpTeethPeriod,InpTeethShift,InpLipsPeriod,InpLipsShift,in_method,in_applied_price,MODE_GATORJAW,shift-TeethShift);
double jaw1 = iGator(NULL,in_timeFrame,InpJawsPeriod,InpJawsShift,InpTeethPeriod,InpTeethShift,InpLipsPeriod,InpLipsShift,in_method,in_applied_price,MODE_GATORJAW,shift+1-TeethShift);
double teeth = iGator(NULL,in_timeFrame,InpJawsPeriod,InpJawsShift,InpTeethPeriod,InpTeethShift,InpLipsPeriod,InpLipsShift,in_method,in_applied_price,MODE_GATORTEETH,shift-TeethShift);
double teeth1 = iGator(NULL,in_timeFrame,InpJawsPeriod,InpJawsShift,InpTeethPeriod,InpTeethShift,InpLipsPeriod,InpLipsShift,in_method,in_applied_price,MODE_GATORTEETH,shift+1-TeethShift);
if(jaw>jaw1)
{Buf1[i] = jaw;}
else if(jaw<=jaw1)
{Buf2[i] = jaw;}
if(teeth>teeth1)
{Buf3[i] = teeth;}
else if(teeth<=teeth1)
{Buf4[i] = teeth;}
}
return(rates_total);
}
パラメータ

基本的にMT4標準の入力パラメータと同じにしています。
数値以外の設定項目に関しては、リストボックスで選択可能です。
- マルチタイムフレーム
- ジョーライン平均期間
- トゥースライン平均期間
- トゥースラインシフト
- リップライン平均期間
- リップラインシフト
- 移動平均の種別
- 適用価格
ダウンロード
“MTF-Gator” をダウンロード
MTF-Gator.ex4 – 12 回のダウンロード – 15.67 KB