Оглавление файлового архива Разработки на MQL4 Индикаторы Очень хорошую доработку индикатора i-Spread предложил пользователь pavik. Суть доработки в добавлении отображения минимальных значений спрэда за последние час, четыре часа и сутки. А также...
入力 int period_1 = 20; 入力 int period_2 = 100; input ENUM_MA_METHOD ma_method = MODE_SMA; input ENUM_APPLIED_PRICE applied_price = PRICE_CLOSE;
double ExtMapBuffer1[]。 double ExtMapBuffer2[]。 int EMHandle1=0; int EMHandle2=0; int EMHandle11=0; int EMHandle22=0; MqlParam params[]; // インジケータ・パラメータを保存するための構造体 double ma1[],ma2[],ma3[],ma4[];//temporal buffers
マーレイのレベルを少し塗り替える
こんにちは。賢い人はMT5で相関インジケータを本当に翻訳する必要があります。
#property indicator_chart_window
#property indicator_buffers 2
#property indicator_plots 2
#property indicator_color1 clrDeepSkyBlue
#property indicator_color2 clrDeepSkyBlue
#property indicator_chart_window
double UpBuffer[];
double DnBuffer[];
int OnInit()
{
SetIndexBuffer(0,UpBuffer)を設定します。
SetIndexBuffer(1,DnBuffer)を設定します。
PlotIndexSetInteger(0,PLOT_DRAW_TYPE,DRAW_LINE); PlotIndexSetInteger(0,PLOT_DRAW_TYPE,PLOT_LINE_WIDTH,3); PlotIndexSetInteger(0,PLOT_DRAW_TYPE,DRAW_LINE) です。
PlotIndexSetInteger(1,PLOT_DRAW_TYPE,DRAW_LINE); PlotIndexSetInteger(1,PLOT_DRAW_TYPE,PLOT_LINE_WIDTH,3); PlotIndexSetInteger(1,PLOT_DRAW_TYPE,DRAW_LINE) です。
return(0)です。
}
//+------------------------------------------------------------------+
//| カスタムインジケータ反復関数
//+------------------------------------------------------------------+
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 i;
for(i=1000;i>0;i--)
{ UpBuffer[i]=1.428; DnBuffer[i]=1.41;
}
return(0)です。
}
なぜ、線が引かれていないのですか?
こんな感じのはずです、信じられないかもしれませんが、うまくいっています。
このインジケーターをダウンロードしました。コンパイル時に228行目でエラーになり、画像を作ることができなかったので、私の言葉を信じてください。MT5で使っているインジケータを使いたい、そのためにここに来た、自分ではできなかった。書き換えてくれるかもしれませんね。ありがとうございます。
よろしくお願いします。
WATLを書き直そうとしたところ、ほぼ成功。線が正しく引けないのは、LWMAの計算が曲がっているせいです。そして何より、グラフにはそんな驚きがあったりするのです。
ドットのラインは、WATLを計算する際のドットと同一になることがあります。
あるいは、グラフを回転させると、ポイントがすべて隣のバーに重なってしまうことがあります。
よろしくお願いします =)。
もしかしたら、MQL5の変換でこのインジケータを見たことがある人がいるかもしれません。 http://www.kimiv.ru/index.php?option=com_remository&Itemid=13&func=fileinfo&id=67
こんにちは。
やりたいことができなかった
頭の中にあったムーヴィングバッファとは別のペアを、持っているのです。
[コード]
#property indicator_separate_window
#プロパティ indicator_buffers 6
#property indicator_plots 2
#property indicator_type1 DRAW_COLOR_LINE
#property indicator_type2 DRAW_COLOR_LINE
#property indicator_color1 clrBlue
#property indicator_color2 clrRed
#property indicator_style1 STYLE_SOLID
#property indicator_style2 STYLE_SOLID
入力 int period_1 = 20;
入力 int period_2 = 100;
input ENUM_MA_METHOD ma_method = MODE_SMA;
input ENUM_APPLIED_PRICE applied_price = PRICE_CLOSE;
double ExtMapBuffer1[]。
double ExtMapBuffer2[]。
int EMHandle1=0;
int EMHandle2=0;
int EMHandle11=0;
int EMHandle22=0;
MqlParam params[]; // インジケータ・パラメータを保存するための構造体
double ma1[],ma2[],ma3[],ma4[];//temporal buffers
int OnInit()
{
//--- インジケータ・バッファのマッピング
SetIndexBuffer(0, ExtMapBuffer1, INDICATOR_DATA)を設定します。
SetIndexBuffer(1, ExtMapBuffer2, INDICATOR_DATA)を設定します。
SetIndexBuffer(2, ma1, INDICATOR_DATA)を設定します。
SetIndexBuffer(3、ma2、INDICATOR_DATA)。
SetIndexBuffer(4、ma3、INDICATOR_DATA)。
SetIndexBuffer(5, ma4, INDICATOR_DATA)を設定します。
PlotIndexSetInteger(0, PLOT_SHIFT, 0);
PlotIndexSetInteger(1, PLOT_SHIFT, 0);
PlotIndexSetInteger(0,PLOT_LINE_STYLE,STYLE_SOLID);
PlotIndexSetInteger(1,PLOT_LINE_STYLE,STYLE_SOLID);
//---
PlotIndexSetInteger(0,PLOT_LINE_COLOR,clrBlue);
PlotIndexSetInteger(1,PLOT_LINE_COLOR,clrRed);
PlotIndexSetInteger(0,PLOT_DRAW_TYPE,DRAW_LINE);
PlotIndexSetInteger(1,PLOT_DRAW_TYPE,DRAW_LINE);
IndicatorSetString(INDICATOR_SHORTNAME, "2_2_MA");
//--- 精度を設定する
IndicatorSetInteger(INDICATOR_DIGITS,4)です。
//---
ArrayResize(params,4)。
params[0].type =TYPE_INT;
params[0].integer_value=period_1;
// オフセット
params[1].type =TYPE_INT;
params[1].integer_value=0。
// 計算方法:単純平均
params[2].type =TYPE_INT;
params[2].integer_value=MODE_SMA。
// 計算の対象となる価格の種類:終値
params[3].type =TYPE_INT;
params[3].integer_value=PRICE_CLOSE;
EMHandle1 = IndicatorCreate(_Symbol, 0, IND_MA, 4, params;)
ArrayResize(params,4)。
params[0].type =TYPE_INT;
params[0].integer_value=period_2。
params[1].type =TYPE_INT;
params[1].integer_value=0。
params[2].type =TYPE_INT;
params[2].integer_value=MODE_SMA。
params[3].type =TYPE_INT;
params[3].integer_value=PRICE_CLOSE;
EMHandle2 = IndicatorCreate(_Symbol, 0, IND_MA, 4, params;)
ArrayResize(params,4)。
params[0].type =TYPE_INT;
params[0].integer_value=period_1;
params[1].type =TYPE_INT;
params[1].integer_value=0。
params[2].type =TYPE_INT;
params[2].integer_value=MODE_SMA。
params[3].type =TYPE_INT;
params[3].integer_value=PRICE_CLOSE;
EMHandle11 = IndicatorCreate(_Symbol, 0, IND_MA, 4, params;)
ArrayResize(params,4)。
params[0].type =TYPE_INT;
params[0].integer_value=period_2。
params[1].type =TYPE_INT;
params[1].integer_value=0。
params[2].type =TYPE_INT;
params[2].integer_value=MODE_SMA。
params[3].type =TYPE_INT;
params[3].integer_value=PRICE_CLOSE;
EMHandle22 = IndicatorCreate(_Symbol, 0, IND_MA, 4, params;)
return(0)です。
}
int OnCalculate (const int rates_total,// 配列 price[] のサイズ);
const int prev_calculated,// 前の呼び出しで利用可能なバーの数 ;である。
const int begin,// 価格[]配列のどのインデックスから有効なデータを開始するか。
const double &price[]) // インジケータを計算するための配列。
{
int i;
ArraySetAsSeries(ma1, true)。
ArraySetAsSeries(ma2, true)。
ArraySetAsSeries(ma3, true)。
ArraySetAsSeries(ma4, true)。
if(CopyBuffer(EMHandle1, 0, 0, 1, ma1) < 0){Print("CopyBuffer ma1 error =", GetLastError());}; }.
if(CopyBuffer(EMHandle2, 0, 0, 1, ma2) < 0){Print("CopyBuffer ma2 error =", GetLastError());}; }.
if(CopyBuffer(EMHandle11, 0, 0, 1, ma3) < 0){Print("CopyBuffer ma3 error =", GetLastError());}; }.
if(CopyBuffer(EMHandle22, 0, 0, 1, ma4) < 0){Print("CopyBuffer ma4 error =", GetLastError());}; }.
int制限。
//if(prev_calculated<1)
//limit=period_1。
limit=prev_calculated-1です。
for( i=0; i<limit; i++)
ExtMapBuffer1[0]=calculated。
ExtMapBuffer2[0]=calculate。
コメント(
"\n=====================",
"\n ma1[0] : ",DoubleToString(ma1[0],5),
"\n ma2[0] : ",DoubleToString(ma2[0],5),
"\n ma3[0] : ",DoubleToString(ma3[0],5),
"\n ma4[0] : ",DoubleToString(ma4[0],5),
"\n ExtMapBuffer1[0] : ",DoubleToString(ExtMapBuffer1[0],4),
"\n ExtMapBuffer2[0] : ",DoubleToString(ExtMapBuffer2[0],4)".
);
return(rates_total);
}
void OnDeinit(const int reason)
{
Comment(")です。
}
[/code]
iの代わりに0(バーの場合)私は結果を参照してください、バー(電流= i)は、私は2番目のペアのデータを見つけることができないことを示すとき。
ペアのチャートは開いていて、Market Windowでは、私は物事を混乱させる場所を知りません。
1つのインジケーターに2つの異なるペアを搭載 - では、私のエラーはどこにあるのでしょうか?
0を入れて、その結果をコメントとして見ようとするのですが、一行も出てきません。
つまり、ma1とma2を1組に、ma3とma4をもう1組に配置したのです。
ありがとうございます。