MetaTrader 5へのアップグレードを損なわずに行うためのヘルプ - ページ 13

 
mario065:

こんにちは。

やりたいことができなかった

頭の中にあったムーヴィングバッファとは別のペアを、持っているのです。

[code]
#property indicator_separate_window
#property 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

input int period_1 = 20;
input 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[];//Временни буфери

int OnInit()
  {
//--- indicator buffers mapping
   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");
//--- set accuracy
   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,// с какого индекса в массиве  price[] начинаются достоверные данные;
                 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 limit;
   //if(prev_calculated<1)
      //limit=period_1;
      limit=prev_calculated-1;
   for( i=0; i<limit; i++)
   ExtMapBuffer1[0]=вычисление;
   ExtMapBuffer2[0]=вычисление;

      Comment(
      "\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組に配置したのです。

ありがとうございます。

まず、0------>prev_calculated-1 からカウントし、最後にカウントされたバーからrates_totalまで必要です。

これ

      limit=prev_calculated-1;
   for( i=0; i<limit; i++)
   ExtMapBuffer1[0]=вычисление;

に変更すると、このようになります。

   
   for(int i=prev_calculated-1>=0?prev_calculated-1:0; i<rates_total; i++)
       ExtMapBuffer1[i]=вычисление;

もう一つは、よくわからないのですが、異なる楽器や異なるタイムフレームからミューウイングを 取得したいのでしょうか?

 

ごきげんよう、皆さん。

誰がMT5(プリファイル)のために以下の指標を適応させるために私を助けることができます。

仕事のお礼にビール10ドル投げます。

ファイル:
 
master_kiln:

ごきげんよう、皆さん。

誰がMT5(プリファイル)のために以下の指標を適応させるために私を助けることができます。

仕事のお礼にビール10ドル投げます。

https://www.mql5.com/ru/job
MQL5 работа
MQL5 работа
  • www.mql5.com
Заказы на разработку программ для трейдинга
 

ウラン です。

ご清聴ありがとうございました。

描かせることができない。 できるなら、ここに書いてくれ。

xpertで違うペア、違うフレームを作るのはカッコイイと思います。

//+------------------------------------------------------------------+
//|2_2_v2.mq5|(エムキューブ
//|ユーリ・トクマン|電子書籍で漫画(マンガ)を読むならコミック.jp
//|yuriytokman@gmail.com|
//+------------------------------------------------------------------+
#property copyright "Yuriy Tokman"
#プロパティリンク"yuriytokman@gmail.com"
#property version "1.00"
#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
//#property indicator_label1 "EURUSD"
//#property indicator_label2 "GBPUSD"

入力 int period_1 = 13 ;
入力 int period_2 = 55 ;;
input ENUM_MA_METHOD ma_method = MODE_SMA;
input ENUM_APPLIED_PRICE applied_price = PRICE_CLOSE;

double ExtMapBuffer1[]。
double ExtMapBuffer2[]。
int EMHandle1;
int EMHandle2;;
int EMHandle11;
int EMHandle22;
double ma1[],ma2[],ma3[],ma4[];//times buffer(タイムズバッファ
double p1 = SymbolInfoDouble("EURUSD",SYMBOL_POINT)。
double p2 = SymbolInfoDouble("GBPUSD",SYMBOL_POINT)。
//+------------------------------------------------------------------+
//| カスタムインジケータ初期化関数
//+------------------------------------------------------------------+
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_BEGIN,1);
PlotIndexSetInteger(1,PLOT_DRAW_BEGIN,1);

PlotIndexSetInteger(0,PLOT_DRAW_TYPE,DRAW_LINE);
PlotIndexSetInteger(1,PLOT_DRAW_TYPE,DRAW_LINE);

//--- DataWindowの名前
IndicatorSetString(INDICATOR_SHORTNAME, "2_2_MA");
//---
//--- 精度を設定する
IndicatorSetInteger(INDICATOR_DIGITS,4)です。

EMHandle1 = iMA("EURUSD", 0, period_1, 0, ma_method, applied_price)。
EMHandle2 = iMA("EURUSD", 0, period_2, 0, ma_method, applied_price)。
EMHandle11 = iMA("GBPUSD", 0, period_1, 0, ma_method, applied_price)。
EMHandle22 = iMA("GBPUSD", 0, period_2, 0, ma_method, applied_price)。

ArraySetAsSeries(ExtMapBuffer1,true)。
ArraySetAsSeries(ExtMapBuffer2,true)。
ArraySetAsSeries(ma1,true)。
ArraySetAsSeries(ma2,true)。
ArraySetAsSeries(ma3,true)。
ArraySetAsSeries(ma4, true)。

//---
return(0)です。
}
//+------------------------------------------------------------------+
//| カスタムインジケータ反復関数
//+------------------------------------------------------------------+
int OnCalculate (const int rates_total,// 配列 price[] のサイズ);
const int prev_calculated,// 前の呼び出しで利用可能なバーの数 ;である。
const int begin,// 価格[]配列のどのインデックスから有効なデータを開始するか。
const double &price[]) // インジケータを計算するための配列。
{
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());}; }.

ExtMapBuffer1[0]=(ma1[0]-ma2[0])/p1;
ExtMapBuffer2[0]=(ma3[0]-ma4[0])/p2;

コメント(
"\n=====================",
"\n ma1[] : ",DoubleToString(ma1[0],5),
"\n ma2[] : ",DoubleToString(ma2[0],5),
"\n ma3[] : ",DoubleToString(ma3[0],5),
"\n ma4[] : ",DoubleToString(ma4[0],5),
"\n ExtMapBuffer1[] : ",DoubleToString(ExtMapBuffer1[0],4),
"\n ExtMapBuffer2[] : ",DoubleToString(ExtMapBuffer2[0],4)".
);
//---

//--- 次の呼び出しのために prev_calculated の値を返す
return(rates_total);
}
void OnDeinit(const int reason)
{
Comment(")です。
}
//+------------------------------------------------------------------+

 

皆さん、ごきげんよう。

このインジケータはトレードでしか使わないので、MT5用に作り直してほしいという要望があります。

ファイル:
 

MT4ではEAをexpertsフォルダにコピーし、strategy testerを実行すると、すべてが正常に動作しますが、MT5では、EAをテストする方法を 理解することはできません、私は拡張子を持つフォルダexpertsにスローされます.どこかにコピーして貼り付けているのですが、EAのコピー方法と貼り付け先を正しく教えてください。

 
ZahvatkiN:

MT4ではEAをexpertsフォルダにコピーし、Strategy Testerで実行すると、すべて正常に動作するのですが、MT5ではEAをテストする 方法がわからず、expertsフォルダに拡張子.を付けて入れています。どこかにコピーして貼り付けているのですが、EAを正しくコピーする方法と、貼り付ける場所を教えてください。

テスターとリアルタイムの両方で実行することができます、あなたは拡張子ex5またはコンパイルされたバージョンを持つEAのみを実行することができます。

MetaEditorでmq5ファイルを開き、F7キーを押せば幸せになれます。拡張子mq5のソースコードですが、これはあくまでテスト用の情報であり、ここからバイトコード(実行コード)を得るには、コンパイルする必要があります。

 

Urainさん 返信ありがとうございます、ただ私は基本的なことはすべて知っています、わかっていてもコンパイルして説明書通りにすべてやりましたが、もう一度読んでみると、何が間違っているのかわかりません、ここに2つのスキンが添付されています。このサイトからMT5をダウンロード しました。

ファイル:
1__17.jpg  420 kb
2__10.jpg  117 kb
 
ZahvatkiN:

Urainさん 返信ありがとうございます、ただ私は基本的なことは全て知っています、分かっていてもコンパイルして説明書通りに全てやりましたが、改めて読むと何が間違っているのかも分かりません、ここに2枚のスキンを添付します。このサイトからMT5をダウンロードしました。

grr-al.ex5のコピーを正しいフォルダに置き、それを確認した後にMT5をリロードしたいのですが、どうすればいいですか?

ところで、パソコンにあるのはMT5だけなのでしょうか?

 

Urain finally figured it out, thing is that EAs are copied to the folder C:\Program Files, TuYo, C:\UsersDyma, AppData Roaming, Filter, MetaQuotes, Terminal, I do not know why this hassle, what a damn programmers))).