コーディングの方法は? - ページ 93

 

thx but can you explain me why

BuyCondition = BuyValueCurrent1 !=EMPTY_VALUE

なぜempty_valueなのでしょうか?

 

とにかくうまくいかず、その理由がわかりません。

以下は私の変数です。

BuyValueCurrent = iCustom(NULL,TimeFrame,IndicatorName1,NumBars,0,1); // braintrend1 [/PHP]
BuyValueCurrent2 = iCustom(NULL,TimeFrame,IndicatorName2,NumBars,0,1); // braintrend2

and here is the statement

[PHP] BuyCondition = (BuyValueCurrent != EMPTY_VALUE && BuyValueCurrent2 != EMPTY_VALUE);

BrainTrend2stopとBrainTrend1stopがSELLのときでも、全く曖昧な結果になる。

 
clarc:
私はポジションを開いて管理するEAを持っていますが、時々インディケータに同じ信号を複数与えると、EAはこの信号が新しい位置が出てくるたびに開きます - しかし、私は第二または第三などの位置にしたくない、私は最初のものだけになります - それは可能ですか、EAは、マジックナンバーとペアに基づいてオープン位置をチェックして、そのような複数のエントリを回避するために?

こんな感じです。

int CountLongs()

{

int count=0;

int trade;

int trades=OrdersTotal();

for(trade=0;trade<trades;trade++){。

オーダーセレクト(trade,SELECT_BY_POS,MODE_TRADES);

if(OrderSymbol()!=Symbol()||OrderMagicNumber() != MagicNumber) continue;

if(OrderType()==OP_BUY)count++。

} //---- for

return(count);

}

int CountShorts()

{

int count=0;

int trade;

int trades=OrdersTotal();

for(trade=0;trade<trades;trade++){。

オーダーセレクト(trade,SELECT_BY_POS,MODE_TRADES);

if(OrderSymbol()!=Symbol()||OrderMagicNumber() != MagicNumber) continue;

if(OrderType()==OP_SELL)count++。

} //---- for

return(count)とします。

}

そして、start()関数の 中で

if(CountLongs() == 0 && CountShorts() == 0) { とします。

ここにあなたのエントリー条件

}

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

FerruFx

 
payback:
とにかく、うまくいかないので、その理由がわかりません。

以下は私の変数です。

BuyValueCurrent = iCustom(NULL,TimeFrame,IndicatorName1,NumBars,0,1); // braintrend1 [/PHP]
BuyValueCurrent2 = iCustom(NULL,TimeFrame,IndicatorName2,NumBars,0,1); // braintrend2

and here is the statement

[PHP] BuyCondition = (BuyValueCurrent != EMPTY_VALUE && BuyValueCurrent2 != EMPTY_VALUE);
BrainTrend2stopとBrainTrend1StopがSELLのときでも、全く曖昧な結果になる。

Braintrend1と2の指標を知らないので、買い条件が成立するとチャートに矢印が描かれるとばかり思っていました。MT4では、デフォルトのバッファの値は「EMPTY-VALUE」という定数なので、矢印がない場合はiCustom()が返す値はこの定数になり、矢印がある場合は矢印が置かれた価格が返す値になります。

つまり、両方の指標が矢印のときに買いたいということですよね?

 

はい、まさにその通りです。

 
payback:
はい、まさに私がやりたいことです

iCustom()のシンタックスを確認して ください。

 

何をチェックすればいいのでしょうか? 何か見落としているかもしれません。

double iCustom( string symbol, int timeframe, string name, ..., int mode, int shift)

もし買いシグナルがあれば、それはバッファ0に格納され、そうでなければ空で、バッファ1には売りシグナル が格納されていると思います。

 
payback:
double iCustom( string symbol, int timeframe, string name, ..., int mode, int shift)
もし買いシグナルがあれば、それはバッファ0に格納され、それ以外は空で、バッファ1には売りシグナルが格納されると思います。

ここにあなたの指標を投稿してください、私は見てみましょう。

 

OK THX!

と説明してください。

ファイル:
 
payback:
OK thx!そして説明してください

BrainTrend1Stop.mq4を開いてください。

ファイルの冒頭に:

extern int NumBars=500;

extern int EnableAlerts=0;

extern int SignalID=0;[/PHP]This means that you have to fill those three parameters as arguments in the iCustom() call, like this:

BuyValueCurrent = iCustom(NULL,0,"BrainTrend1Stop",NumBars,EnableAlerts,SignalID,0,1); // braintrend1

[/PHP]About the buffer's number, you can see this:

#property indicator_color1 Magenta

#property indicator_color2 Aqua[/PHP]So the buffer 0 is Magenta and the buffer 1 is Aqua.

Thus if the Buy arrow's color is Aqua, the buffer's number is 1 and the iCustom call is:[PHP]BuyValueCurrent = iCustom(NULL,0,"BrainTrend1Stop",NumBars,EnableAlerts,SignalID,1,1); // braintrend1
A little lower you have:[PHP] SetIndexEmptyValue(1,0.0);

This means that the default empty value for the buffer 1 is set to 0.0; so when there is no arrow, the value returned by the iCustom() call will be 0.0.

So you should know the presence of the arrow checking its value against 0, like this (if the second indic follows the same behavior):[PHP]BuyCondition = (BuyValueCurrent > 0 && BuyValueCurrent2 > 0);

2つ目の指標についてですが、同じように自分で分析することができるはずです。