
目次
ソースコード
//+------------------------------------------------------------------+
//| MTF-Envelopes.mq4 |
//| Copyright 2022,Greeds Co., Ltd. |
//| https://greeds.net |
//+------------------------------------------------------------------+
#property copyright "2005-2014, MetaQuotes Software Corp."
#property link "http://www.mql4.com"
#property description "Bill Williams' Aligator"
#property strict
#property indicator_chart_window
#property indicator_buffers 2
#property indicator_color1 Blue
#property indicator_color2 Red
input ENUM_TIMEFRAMES in_timeFrame = PERIOD_CURRENT; // マルチタイムフレーム
input int in_period=14; // 期間
input ENUM_MA_METHOD in_method=MODE_SMA; // 移動平均の種別
input int in_shift=0; // シフト
input ENUM_APPLIED_PRICE in_applied_price=PRICE_CLOSE; // 適用価格
input double in_deviation=0.1; // 偏差(%)
double Buf1[];
double Buf2[];
void OnInit(void)
{
SetIndexBuffer(0,Buf1);
SetIndexBuffer(1,Buf2);
SetIndexStyle(0,DRAW_LINE);
SetIndexStyle(1,DRAW_LINE);
}
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=rates_total-prev_calculated;
for(int i=0; i<limit; i++)
{
int shift = iBarShift(NULL, in_timeFrame, time[i]);
Buf1[i]=iEnvelopes(NULL,in_timeFrame,in_period,in_method,in_shift,in_applied_price,in_deviation,MODE_UPPER,shift);
Buf2[i]=iEnvelopes(NULL,in_timeFrame,in_period,in_method,in_shift,in_applied_price,in_deviation,MODE_LOWER,shift);
}
return(rates_total);
}
パラメータ

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