
目次
ソースコード
//+------------------------------------------------------------------+
//| MTF-AC.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_color1 Green
#property indicator_color2 Red
#property indicator_buffers 2
double Buf1[];
double Buf2[];
input ENUM_TIMEFRAMES in_timeFrame = PERIOD_CURRENT; // マルチタイムフレーム
int OnInit()
{
SetIndexBuffer(0, Buf1 );
SetIndexBuffer(1, Buf2 );
SetIndexStyle(0, DRAW_HISTOGRAM , STYLE_SOLID , 1 );
SetIndexStyle(1, DRAW_HISTOGRAM , STYLE_SOLID , 1 );
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 limit = Bars - prev_calculated;
for(int i=0; i<limit; i++)
{
int shift = iBarShift(NULL, in_timeFrame, time[i]);
double ac0 = iAC(NULL,in_timeFrame,shift);
double ac1 = iAC(NULL,in_timeFrame,shift+1);
if(ac0>ac1)
{
Buf1[i] = ac0;
}
else
{
Buf2[i] = ac0;
}
}
return(rates_total);
}
パラメータ

マルチタイムフレーム以外の設定項目なし。
ダウンロード
“MTF-AC” をダウンロード
MTF-AC.ex4 – 26 回のダウンロード – 10.80 KB