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

 
Tomcat98:
こんにちは、Mladenです。

Multi_Indic_00がオシレーターでUp_Prime_00が定義レベルである保留中の注文のループは以下の通りです。

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

//---- 注文タイプが指値で、トレンドが変化していれば、クローズします。

if(OrderType()==OP_BUYLIMIT)

if(( Multi_Indic_00 ) <= (Up_Prime_00 ))

{

_OrderDelete=OrderDelete(OrderTicket())。

}

if(OrderType()==OP_SELLLIMIT)

if(( Multi_Indic_00 ) >= ( Down_Prime_00 ))

{

_OrderDelete=OrderDelete(OrderTicket());

}

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

まあ特に何もないですね...。

ハッピートレード。

敬具。

トムキャット98

トムキャット98

私が見てみたいのは、for()ループ文です。もし、このようなfor文があるのであれば:

for (int i = 0; i < OrdersTotal(); i++)

のようなfor文の場合、その間にいくつかの注文が閉じられたり削除されたりしていると、いくつかの注文が見逃されてしまいます。一方、for()ループが次のようになる場合。

for (int i = OrdersTotal()-1; i >= 0; i--)

のようにすると、すべての注文が処理されます。

 

ムラデン,

なるほど、そうなんですね。

クローズ処理についてはこちらです。

"

for(int i=0;i<OrdersTotal();i++)

{

if(OrderSelect(i,SELECT_BY_POS,MODE_TRADES)==false) break;

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

"

トムキャット98

 
Tomcat98:
ムラデン,

なるほど、そうなんですね。

これがクローズ処理のためのものです。

"

for(int i=0;i<OrdersTotal();i++)

{

if(OrderSelect(i,SELECT_BY_POS,MODE_TRADES)==false) break;

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

"

トムキャット98

トムキャット98

ループを次のように変更します。

for(int i=OrdersTotal()-1;i>=0;i--) "に変更します。

でOKのはずです。

 

ムラデン

ビンゴ!

これでまさに私が必要としていたことができるようになりました。

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

「人は、あなたがどれだけ気にかけているか知るまでは、あなたがどれだけ知っているか気にかけない。

- セオドア・ルーズベルト

敬具

トムキャット98

 
Tomcat98:
ムラデン

ビンゴ!

これで、私が必要としていたことが正確にできるようになりました。

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

「人は、あなたがどれほど気にかけているかを知るまで、あなたがどれほど知っているかを気にかけない。

- セオドア・ルーズベルト

敬具

トムキャット98

ハッピーコーディング

 

こんにちは、Mladen、すべてのものに感謝し、今そこに良い仕事...

今、私は再読み込みされていない作成された指標で立ち往生しているので、毎回キャンドルクローズ私は指標をリロードする必要があり、あなたは私がこれを修正するのに役立つことができますか? ここにコードの一部です(ギャップ単純なアイデアに基づいてトレンド指標である、ありがとうございました。

#プロパティ著作権 "著作権©2014ダニエル-ルチンガー"

#プロパティのリンク

#プロパティ厳密

#プロパティの厳密な

#property indicator_chart_window(インジケーターチャートウィンドウ

#property indicator_buffers 4

#property indicator_color1 clrLime (インジケーターカラー1)

#property indicator_color2 clrRed(インジケーターカラー2・レッド

#プロパティ indicator_color3 clrMagenta

#property indicator_color4 clrCyan (インジケーターカラー4)

#define BUY 1

#define SELL 2

double Buy[],

Sell[],

FirstBuy[],

FirstSell[];

int OnInit() {

SetIndexBuffer(0,FirstBuy)を設定します。

SetIndexBuffer(1,FirstSell)を設定します。

SetIndexBuffer(2,Buy)を設定します。

SetIndexBuffer(3,Sell)を設定します。

for(int i=0; i<4; i++) { {インデックススタイル(1)を設定します。

SetIndexStyle (i,DRAW_ARROW,STYLE_SOLID,2);}を設定します。

SetIndexArrow (0,233)を設定します。

SetIndexArrow (1,234)。

SetIndexArrow (2,233).SetIndexArrow(2,233)。

SetIndexArrow (3,234)。

return(INIT_SUCCEEDED);}.

void OnDeinit(const int reason) {}

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 lastSignal=0;

for(int i=MathMin(rates_total-prev_calculated, rates_total-1); i>=0; i--){

FirstBuy=FirstSell=Buy=Sell=EMPTY_VALUE。

datetime when=Time;

if((High-Close)<0)){

if(lastSignal==SELL)の場合{。

FirstBuy=Close。

SoundAlert(when, "Buy");}.

lastSignal=BUY;}。

if((安値-終値)>0){。

if(lastSignal==BUY){。

FirstSell=Close。

サウンドアラート(when, "売り");}

lastSignal=SELL;}。

}

return(rates_total);}

void SoundAlert(datetime i, string dir) { { {staticdatetimeのlastAlert=0; {staticdatetimeのlastAlert=0

static datetime lastAlert=0;

if(lastAlert!=i){。

Alert(StringFormat("%s signal on %s at %s",dir,Symbol(),TimeToStr(i))).

 
daniel1983:
こんにちは、Mladen、いろいろありがとう。

今私は再読み込みされていない作成された指標で立ち往生しているので、毎回キャンドルクローズ私は指標をリロードする必要があり、あなたは私がこれを修正するのに役立つことができますか? ここにコードの一部です(ギャップ単純なアイデアに基づいて、トレンド指標である、ありがとうございました。

#プロパティ著作権 "著作権©2014ダニエル-ルチンガー"

#プロパティのリンク

#プロパティ厳密

#プロパティの厳密な

#property indicator_chart_window(インジケーターチャートウィンドウ

#property indicator_buffers 4

#property indicator_color1 clrLime (インジケーターカラー1)

#property indicator_color2 clrRed(インジケーターカラー2・レッド

#プロパティ indicator_color3 clrMagenta

#property indicator_color4 clrCyan (インジケーターカラー4)

#define BUY 1

#define SELL 2

double Buy[],

Sell[],

FirstBuy[],

FirstSell[];

int OnInit() {

SetIndexBuffer(0,FirstBuy)を設定します。

SetIndexBuffer(1,FirstSell)を設定します。

SetIndexBuffer(2,Buy)を設定します。

SetIndexBuffer(3,Sell)を設定します。

for(int i=0; i<4; i++) { {インデックススタイル(1)を設定します。

SetIndexStyle (i,DRAW_ARROW,STYLE_SOLID,2);}を設定します。

SetIndexArrow (0,233)を設定します。

SetIndexArrow (1,234)。

SetIndexArrow (2,233).SetIndexArrow(2,233)。

SetIndexArrow (3,234)。

return(INIT_SUCCEEDED);}.

void OnDeinit(const int reason) {}

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 lastSignal=0;

for(int i=MathMin(rates_total-prev_calculated, rates_total-1); i>=0; i--){

FirstBuy=FirstSell=Buy=Sell=EMPTY_VALUE。

datetime when=Time;

if((High-Close)<0)){

if(lastSignal==SELL)の場合{。

FirstBuy=Close。

SoundAlert(when, "Buy");}.

lastSignal=BUY;}。

if((安値-終値)>0){。

if(lastSignal==BUY){。

FirstSell=Close。

サウンドアラート(when, "売り");}

lastSignal=SELL;}。

}

return(rates_total);}

void SoundAlert(datetime i, string dir) { { {staticdatetimeのlastAlert=0; {staticdatetimeのlastAlert=0

static datetime lastAlert=0;

if(lastAlert!=i){。

Alert(StringFormat("%s signal on %s at %s",dir,Symbol(),TimeToStr(i)));

ダニエル1983

このように試してみてください。

#property copyright "Copyright © 2014 Daniel Luchinger"

#property link ""

#property strict

#property strict

#property indicator_chart_window

#property indicator_buffers 4

#property indicator_color1 clrLime

#property indicator_color2 clrRed

#property indicator_color3 clrMagenta

#property indicator_color4 clrCyan

#define BUY 1

#define SELL 2

double Buy[],

Sell[],

FirstBuy[],

FirstSell[];

int OnInit() {

SetIndexBuffer(0,FirstBuy);

SetIndexBuffer(1,FirstSell);

SetIndexBuffer(2,Buy);

SetIndexBuffer(3,Sell);

for(int i=0; i<4; i++) {

SetIndexStyle (i,DRAW_ARROW,STYLE_SOLID,2);}

SetIndexArrow (0,233);

SetIndexArrow (1,234);

SetIndexArrow (2,233);

SetIndexArrow (3,234);

return(INIT_SUCCEEDED);}

void OnDeinit(const int reason) {}

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[]) {

static int lastSignal=0;

for(int i=MathMin(rates_total-prev_calculated, rates_total-2); i>=0; i--)

{

FirstBuy=FirstSell=Buy=Sell=EMPTY_VALUE;

datetime when=Time;

if((High-Close)<0) {

if(lastSignal==SELL) {

FirstBuy=Close;

SoundAlert(when,"Buy");}

lastSignal=BUY;}

if((Low-Close)>0){

if(lastSignal==BUY) {

FirstSell=Close;

SoundAlert(when,"Sell");}

lastSignal=SELL;}

}

return(rates_total);

}

void SoundAlert(datetime i, string dir) {

static datetime lastAlert=0;

if(lastAlert!=i) {

Alert(StringFormat("%s signal on %s at %s",dir,Symbol(),TimeToStr(i)));

}

}

 

Mladenさん、ありがとうございます。しかし、このようにコードを書くと、シグナルが欠落してしまいます。

これは何であることができますか?

ファイル:
 
daniel1983:
こんにちはMladen、ありがとうございます、しかし、このようにコードを書くと、不足している信号があります、私は日足チャートUSDJPYでそれらを比較する画像を作った見てください。

これは何であることができますか?

daniel1983

あなたのコードでは、将来の値(これらの:

高値-終値

ロークローズ

私はCloseを使用しました - これは通常の前の値です。に変更しますが、それは再描画されます

 

mrtools様、mladen様

どなたかお手伝いいただけないでしょうか?TomDemark Moving Averageは私の戦略の中で重要な指標ですが、新しい棚が示されたときにアラームがあれば非常に便利です。よろしくお願いします。

よろしくお願いします。

ファイル: