
目次
ソースコード
//+------------------------------------------------------------------+
//| MTF-Ichimoku.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_chart_window
// インジケータプロパティ設定
#property indicator_buffers 7
#property indicator_color1 Red // Tenkan-sen
#property indicator_color2 Blue // Kijun-sen
#property indicator_color3 SandyBrown // Up Kumo
#property indicator_color4 Thistle // Down Kumo
#property indicator_color5 Lime // Chikou Span
#property indicator_color6 SandyBrown // Up Kumo bounding line
#property indicator_color7 Thistle // Down Kumo bounding line
//--- input parameters
input ENUM_TIMEFRAMES in_timeFrame = PERIOD_CURRENT; // マルチタイムフレーム
input int InpTenkan=9; // 転換戦
input int InpKijun=26; // 基準線
input int InpSenkou=52; // 先行スパンB
//--- buffers
double ExtTenkanBuffer[];
double ExtKijunBuffer[];
double ExtSpanA_Buffer[];
double ExtSpanB_Buffer[];
double ExtChikouBuffer[];
double ExtSpanA2_Buffer[];
double ExtSpanB2_Buffer[];
//+------------------------------------------------------------------+
//| Custom indicator initialization function |
//+------------------------------------------------------------------+
void OnInit(void)
{
IndicatorDigits(Digits);
SetIndexBuffer(0,ExtTenkanBuffer);
SetIndexBuffer(1,ExtKijunBuffer);
SetIndexBuffer(2,ExtSpanA_Buffer);
SetIndexBuffer(3,ExtSpanB_Buffer);
SetIndexBuffer(4,ExtChikouBuffer);
SetIndexBuffer(5,ExtSpanA2_Buffer);
SetIndexBuffer(6,ExtSpanB2_Buffer);
SetIndexStyle(0,DRAW_LINE);
SetIndexStyle(1,DRAW_LINE);
SetIndexStyle(2,DRAW_HISTOGRAM,STYLE_DOT);
SetIndexStyle(5,DRAW_LINE,STYLE_DOT);
SetIndexStyle(3,DRAW_HISTOGRAM,STYLE_DOT);
SetIndexStyle(6,DRAW_LINE,STYLE_DOT);
SetIndexStyle(4,DRAW_LINE);
SetIndexLabel(0,"Tenkan Sen");
SetIndexLabel(1,"Kijun Sen");
SetIndexLabel(2,NULL);
SetIndexLabel(3,NULL);
SetIndexLabel(4,"Chikou Span");
SetIndexLabel(5,"Senkou Span A");
SetIndexLabel(6,"Senkou Span B");
SetIndexShift(2,InpKijun);
SetIndexShift(3,InpKijun);
SetIndexShift(4,-InpKijun);
SetIndexShift(5,InpKijun);
SetIndexShift(6,InpKijun);
}
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 limit = Bars - prev_calculated;
for( int icount = 0 ; icount < limit-InpKijun ; icount++ ) {
int shift = iBarShift(NULL, in_timeFrame, time[icount]);
// テクニカルインジケータ算出
double result1 = iIchimoku(NULL,in_timeFrame,9,26,52,MODE_TENKANSEN,shift);
double result2 = iIchimoku(NULL,in_timeFrame,9,26,52,MODE_KIJUNSEN,shift);
int hoge=InpKijun;
if(InpKijun*Period()>in_timeFrame && in_timeFrame != NULL)
hoge = InpKijun*Period()/in_timeFrame;
double result3 = iIchimoku(NULL,in_timeFrame,InpTenkan,InpKijun,InpSenkou,MODE_CHIKOUSPAN,shift+hoge);
double result4 = iIchimoku(NULL,in_timeFrame,InpTenkan,InpKijun,InpSenkou,MODE_SENKOUSPANA,shift-hoge);
double result5 = iIchimoku(NULL,in_timeFrame,InpTenkan,InpKijun,InpSenkou,MODE_SENKOUSPANB,shift-hoge);
ExtTenkanBuffer[icount] = result1;
ExtKijunBuffer[icount] = result2;
if ( result3 > 0 )
{
ExtChikouBuffer[icount] = result3;
}
ExtSpanA2_Buffer[icount] = result4;
ExtSpanB2_Buffer[icount] = result5;
ExtSpanA_Buffer[icount] = result4;
ExtSpanB_Buffer[icount] = result5;
}
return( rates_total );
}
パラメーター

基本的にMT4標準の入力パラメータと同じにしています。
数値以外の設定項目に関しては、リストボックスで選択可能です。
- マルチタイムフレーム
- 転換線
- 基準線
- 先行スパンB
ダウンロード
“MTF-Ichimoku” をダウンロード
MTF-Ichimoku.ex4 – 26 回のダウンロード – 14.12 KB