
目次
ソースコード
//+------------------------------------------------------------------+
//| MTF-Stochastic.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 LightSeaGreen
#property indicator_color2 Red
#property indicator_minimum 0
#property indicator_maximum 100
#property indicator_level1 20.0
#property indicator_level2 80.0
#property indicator_buffers 2
double Buf1[];
double Buf2[];
input ENUM_TIMEFRAMES in_timeFrame = PERIOD_CURRENT; // マルチタイムフレーム
input int in_KPeriod=5; // %K期間
input int in_DPeriod=3; // %D期間
input int in_Slowing=3; // スローイング
int OnInit()
{
SetIndexBuffer(0, Buf1 );
SetIndexBuffer(1, Buf2 );
SetIndexStyle(0, DRAW_LINE , STYLE_SOLID , 1 );
SetIndexStyle(1, DRAW_LINE , 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 st = iStochastic(NULL,in_timeFrame,in_KPeriod,in_DPeriod,in_Slowing,MODE_SMA,STO_LOWHIGH,MODE_MAIN,shift);
double signal = iStochastic(NULL,in_timeFrame,in_KPeriod,in_DPeriod,in_Slowing,MODE_SMA,STO_LOWHIGH,MODE_SIGNAL,shift);
Buf1[i] = st;
Buf2[i] = signal;
}
return(rates_total);
}
パラメータ

基本的にMT4標準の入力パラメータと同じにしています。
数値以外の設定項目に関しては、リストボックスで選択可能です。
- マルチタイムフレーム
- %K期間
- %D期間
- スローイング
ダウンロード
“MTF-Stochastic” をダウンロード
MTF-Stochastic.ex4 – 21 回のダウンロード – 11.29 KB