コーディングのヘルプ - ページ 384

 

コンパイル時にエラー・警告が出るのですが。どなたか最新のMT4ビルドに対応させていただけないでしょうか...このエラーが大したことがないのであればですが。

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

jbozman

ファイル:
 
jbozman:
コンパイル時にエラー/ワーニングが出ます。どなたか、最新のMT4ビルドに対応させていただけないでしょうか...このエラーが大したことなければですが。

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

jbozman

jbozman

試してみました :price_lines_jlmv_1.mq4

ファイル:
 
mladen:
jbozman 今すぐ試す :price_lines_jlmv_1.mq4

エラーはありません。コンパイルして問題ないようです。ロックしてますね。

j

 

助けてください...コンパイルすると...エラーは出ません。

エキスパートタブのメタトレーダーでエラーになります。

2014.11.02 15:20:17.495 array out of range in '#MTF__B.mq4' (84,25)[/PHP]

[PHP]

//+------------------------------------------------------------------+

//| #MTF__B.mq4 |

//| Copyright 2014, MetaQuotes Software Corp. |

//| https://www.mql5.com |

//+------------------------------------------------------------------+

#property copyright "Copyright 2014, MetaQuotes Software Corp."

#property link "https://www.mql5.com"

#property version "1.00"

#property strict

#property indicator_chart_window

#property indicator_chart_window

#property indicator_buffers 2

#property indicator_color1 clrDodgerBlue

#property indicator_color2 clrDeepPink

#property indicator_width1 0

#property indicator_width2 0

//---- input parameters

/*************************************************************************

PERIOD_M1 1

PERIOD_M5 5

PERIOD_M15 15

PERIOD_M30 30

PERIOD_H1 60

PERIOD_H4 240

PERIOD_D1 1440

PERIOD_W1 10080

PERIOD_MN1 43200

You must use the numeric value of the timeframe that you want to use

when you set the TimeFrame' value with the indicator inputs.

---------------------------------------

PRICE_CLOSE 0 Close price.

PRICE_OPEN 1 Open price.

PRICE_HIGH 2 High price.

PRICE_LOW 3 Low price.

PRICE_MEDIAN 4 Median price, (high+low)/2.

PRICE_TYPICAL 5 Typical price, (high+low+close)/3.

PRICE_WEIGHTED 6 Weighted close price, (high+low+close+close)/4.

You must use the numeric value of the Applied Price that you want to use

when you set the 'applied_price' value with the indicator inputs.

**************************************************************************/

extern int TimeFrame=30;

extern int barn=1000;

double ExtMapBuffer1[];

double ExtMapBuffer2[];

//+------------------------------------------------------------------+

//| Custom indicator initialization function |

//+------------------------------------------------------------------+

int init()

{

//---- indicator line

SetIndexBuffer(0,ExtMapBuffer1);

SetIndexBuffer(1,ExtMapBuffer2);

SetIndexStyle(0,DRAW_ARROW,0,5);

SetIndexStyle(1,DRAW_ARROW,0,5);

SetIndexArrow(0,158);

SetIndexArrow(1,158);

return(0);

}

//+------------------------------------------------------------------+

//| |

//+------------------------------------------------------------------+

int start()

{

datetime TimeArray[];

int i,limit,y=0,counted_bars=IndicatorCounted();

// Plot defined time frame on to current time frame

ArrayCopySeries(TimeArray,MODE_TIME,NULL,TimeFrame);

limit=Bars-counted_bars;

for(i=0,y=0;i<limit;i++)

{

if (Time<TimeArray[y]) y++; ///// line of error here ...

/***********************************************************

Add your main indicator loop below. You can reference an existing

indicator with its iName or iCustom.

Rule 1: Add extern inputs above for all neccesary values

Rule 2: Use 'TimeFrame' for the indicator time frame

Rule 3: Use 'y' for your indicator's shift value

**********************************************************/

ExtMapBuffer1=iCustom(NULL,TimeFrame,"indicator",1,4,0,y) ;

ExtMapBuffer2=iCustom(NULL,TimeFrame,"indicator",1,4,1,y) ;

}

//

return(0);

}

//+------------------------------------------------------------------+

ありがとうございます

 
rizkyd:
私はコンパイルする場合...エラーを持っていない助けてください。

しかし、Expertタブでメタトレーダーはエラーになります。

2014.11.02 15:20:17.495 array out of range in '#MTF__B.mq4' (84,25)[/PHP]

[PHP]

//+------------------------------------------------------------------+

//| #MTF__B.mq4 |

//| Copyright 2014, MetaQuotes Software Corp. |

//| https://www.mql5.com |

//+------------------------------------------------------------------+

#property copyright "Copyright 2014, MetaQuotes Software Corp."

#property link "https://www.mql5.com"

#property version "1.00"

#property strict

#property indicator_chart_window

#property indicator_chart_window

#property indicator_buffers 2

#property indicator_color1 clrDodgerBlue

#property indicator_color2 clrDeepPink

#property indicator_width1 0

#property indicator_width2 0

//---- input parameters

/*************************************************************************

PERIOD_M1 1

PERIOD_M5 5

PERIOD_M15 15

PERIOD_M30 30

PERIOD_H1 60

PERIOD_H4 240

PERIOD_D1 1440

PERIOD_W1 10080

PERIOD_MN1 43200

You must use the numeric value of the timeframe that you want to use

when you set the TimeFrame' value with the indicator inputs.

---------------------------------------

PRICE_CLOSE 0 Close price.

PRICE_OPEN 1 Open price.

PRICE_HIGH 2 High price.

PRICE_LOW 3 Low price.

PRICE_MEDIAN 4 Median price, (high+low)/2.

PRICE_TYPICAL 5 Typical price, (high+low+close)/3.

PRICE_WEIGHTED 6 Weighted close price, (high+low+close+close)/4.

You must use the numeric value of the Applied Price that you want to use

when you set the 'applied_price' value with the indicator inputs.

**************************************************************************/

extern int TimeFrame=30;

extern int barn=1000;

double ExtMapBuffer1[];

double ExtMapBuffer2[];

//+------------------------------------------------------------------+

//| Custom indicator initialization function |

//+------------------------------------------------------------------+

int init()

{

//---- indicator line

SetIndexBuffer(0,ExtMapBuffer1);

SetIndexBuffer(1,ExtMapBuffer2);

SetIndexStyle(0,DRAW_ARROW,0,5);

SetIndexStyle(1,DRAW_ARROW,0,5);

SetIndexArrow(0,158);

SetIndexArrow(1,158);

return(0);

}

//+------------------------------------------------------------------+

//| |

//+------------------------------------------------------------------+

int start()

{

datetime TimeArray[];

int i,limit,y=0,counted_bars=IndicatorCounted();

// Plot defined time frame on to current time frame

ArrayCopySeries(TimeArray,MODE_TIME,NULL,TimeFrame);

limit=MathMin(Bars-counted_bars,Bars-1);

for(i=0,y=0;i<limit;i++)

{

if (Time<TimeArray[y]) y++; ///// line of error here ...

/***********************************************************

Add your main indicator loop below. You can reference an existing

indicator with its iName or iCustom.

Rule 1: Add extern inputs above for all neccesary values

Rule 2: Use 'TimeFrame' for the indicator time frame

Rule 3: Use 'y' for your indicator's shift value

**********************************************************/

ExtMapBuffer1=iCustom(NULL,TimeFrame,"indicator",1,4,0,y) ;

ExtMapBuffer2=iCustom(NULL,TimeFrame,"indicator",1,4,1,y) ;

}

//

return(0);

}

//+------------------------------------------------------------------+

感謝

以下の行を置き換えてみてください。

limit=Bars-counted_bars;

を次のように書き換えてみてください。

limit=MathMin(MathMax(Bars-counted_bars,2*TimeFrame/Period()),Bars-1) と書き換えてみてください。

 
mladen:
次の行を置き換えてみてください。

limit=Bars-counted_bars;

を指定することができます。

limit=MathMin(MathMax(Bars-counted_bars,2*TimeFrame/Period()),Bars-1);

mladenさん、ありがとうございます。

 

Mladenさん、こんにちは。

このEAは、エントリールールが 今までやったことがないものなので、コーディングに苦労しています。

例えば、このトレードの場合、緑と赤の矢印が同時に出ているので、エントリールールの書き方は簡単なんです。だから、次のローソク足のオープンでショートポジションを取る。

しかし、次の例では、まず緑の矢印が表示され、赤い矢印は表示されない。だから、赤い矢印が出るまでトレードをしない。その上、その緑の矢印の後、その赤い矢印の前にあるすべてのローソクは、そうでなければこれは有効な取引ではないので、UPのものである必要があります。

この具体的なルールは一体どのようにコーディングすればいいのでしょうか?現在のローソク足に対してコードを書く方法は知っていますが、これらの条件を指定する方法がわかりません。何か助言を頂ければ幸いです。

ファイル:
capture1.jpg  19 kb
capture.jpg  22 kb
 
Jason2005:
Mladenさん、こんにちは。

このEAは、エントリールールが今までやったことがないものなので、コーディングに苦労しています。

例えば、このトレードの場合、緑と赤の矢印が同時に出ているので、エントリールールは簡単に書けるんです。だから、次のローソク足のオープンでショートポジションを取る。

しかし、次の例では、まず緑の矢印が表示され、赤い矢印は表示されない。だから、赤い矢印が出るまでトレードをしない。さらに、緑の矢印の後、赤い矢印の前のローソク足はすべて上昇でなければならないので、そうでなければこれは有効な取引ではない。

このルールは一体どのようにコーディングすればいいのでしょうか?現在のロウソクに対してコードを書く方法は知っていますが、これらの条件を指定する方法がわかりません。何か助言を頂ければ幸いです。

ジェイソン

矢印を作成しているコードから論理条件をコピーしてみてはどうでしょうか?

 
mladen:
Jason その矢印を作り出しているコードから、論理的な条件をコピーしてみてはどうでしょう?

何を言っているのかよくわからないのですが...。

私が知りたいのは、売買条件において、赤い矢印が現れたら(これがトリガー)、その前に緑の矢印があったはずで、その矢印に続くローソクはすべて、必要なものに応じて上昇または下降しなければならないとEAに理解させるにはどうすればいいかということです。でも、その緑の矢印がいつ出たのかがわからない......。

 
Jason2005:
何を言っているのかよく分からないのですが...。 私が知りたいのは、売買条件において、赤い矢印が現れたら(これがトリガーです)、その前に緑の矢印があったこと、その矢印に続くすべてのローソク足が、必要に応じて上昇または下降しなければならないことをEAに理解させる方法なのです。しかし、その緑の矢印がいつ出たのかが分からない...。

Jason2005さん、こんにちは。

赤と緑の矢印は、あなたのEAではなく、あなたのインジケータのバッファにある値です...。

EAでiCustomを使用して、バッファ内のインジケータの値を呼び出し、そしてそれらをあなたの取引戦略に使用します。

このフォーラムには、EAでiCustomを使用する方法について、多くの良い投稿があります...

とりあえず、ここにインジケーターを添付していただければ、iCustomステートメントでどのインジケーターバッファを 使用できるか、誰かが教えてくれるかもしれません。

お役に立てれば幸いです。

ロバート