アスク! - ページ 77

 

CodersGuruへ : 10ポイント3EAについてヘルプが必要です...。

こんにちは、CodersGuruです。

私は外国為替取引に 新しく、このフォーラムにも新しいです。初めて学ぶEuroX2_slは、10ポイント3EAスクリプトから拡張されたものです。何度かフォワードテストをしたところ、このEAはオープンポジションはうまくできましたが、マーケットが反転したときに必要なクローズポジションはうまくできませんでした。多分、コードに何か問題があるのだと思います(私はプログラマーではないので)。どの部分が間違っているのかチェックしていただけますか?

条件は以下の通りです。

1.インジケータが存在する場合、買いを開始する。

2.売りのインジケータが存在する場合、買いをクローズします。

3.ストキャスティクスのような売り指数が存在する場合、売りを開始します。

4.ストキャスティクスの指標(上記1)が存在する状態で、クローズ売りをする。

OPENポジションは問題ないと思いますが、問題はCLOSEポジションで、インジケータが存在してもCLOSE(BUYまたはSELL)しないのです。

私が行ったコードは以下の通りです。

-------- ユーロX2_slのスクリプトを10ポイントから3ポイントに拡張してクローズポジションにしました。

// 正しく市場に参入することは重要です。

// しかし、正しく終了することはもっと重要です。

for(cnt=0;cnt<total;cnt++)

{

OrderSelect(cnt, SELECT_BY_POS, MODE_TRADES);

if(OrderType()<=OP_SELL && // 開いたポジションをチェックする)

OrderType()<=OP_BUY && (オーダータイプ)>=OP_BUY && (オーダータイプ)

OrderType()>=OP_SELL && (オーダータイプ)>=OP_BUY && (オーダータイプ)

OrderType()>=OP_BUY && オーダータイプ()>=OP_BUY && オーダーシンボル()==SYNC.

OrderSymbol()==Symbol())// シンボルをチェック

{

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

if(OrderType()==OP_BUY)の場合// ロングポジションがオープン

{

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

//+ クローズポジションの条件

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

買いポジションを閉じる //+--------------- --------------------------------

if ( Stoch_Main_M15_Cu < Stoch_Sig_M15_Cu )

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

{

OrderClose(OrderTicket(),OrderLots(),Bid,3,Violet) ; // ポジションクローズ

return(0); // 終了

}

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

// トレーリングストップのチェック

if(TrailingStop>0)

{

if(Bid-OrderOpenPrice()>Point*TrailingStop)

{

if(OrderStopLoss()<買値-売値*トレイリングストップ)

{

オーダーモディファイ(OrderTicket(),OrderOpenPrice(),Bid-Point*TrailingStop,OrderTakeProfit(),0,Green)。

return(0);

}

}

}

}

//+--------------- 売りポジションを閉じる --------------------------------

else // 空売りポジションに移行する

{ //+削除しないでください

if(OrderType()==OP_SELL) // ショートポジションがオープンされました。

{

}

//閉じるべきか?

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

if ( Stoch_Main_M15_Cu > Stoch_Sig_M15_Cu )

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

{

OrderClose(OrderTicket(),OrderLots(),Ask,3,Violet) ; // クローズポジション

return(0); // 終了

}

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

// トレーリングストップのチェック

if(TrailingStop>0)

{

if((OrderOpenPrice()-Ask)>(Point*TrailingStop))

{

if((OrderStopLoss()>(Ask+Point*TrailingStop)))をチェックします。| (OrderStopLoss()==0))の場合

{

OrderModify(OrderTicket(),OrderOpenPrice(),Ask+Point*TrailingStop,OrderTakeProfit(),0,Red).OrderTicket(),OrderOpenPrice(),Ask+Point*TrailingStop,OrderTakeProtect(),0,Red);

return(0);

}

}

}

}

}

}

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

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

fxgroup

 

別の通貨ペアの ウィンドウからデータを読み込む

私のEAは "GBPJPY "ウィンドウ上にありますが、私は別のウィンドウ、例えば "USDJPY "からObjectDescription()を見つける必要があります。(残念ながら、それはiCustom()から値を返さないPivotインディケータです)

どなたか、別の(現在の)ペアウィンドウを参照して、そのウィンドウ上でObjectDescription()のような関数を使用できる方法をご存知ですか?

それともMQ4がそれを許さないのでしょうか?

ありがとうございます。

ユーロ

 

ある通貨の利益を他の通貨から切り離すにはどうしたらいいですか?

color color_of_pipsprofit;

color_of_pipsprofit = White;

int m,totalbuy;

totalbuy=OrdersTotal();

for(m=0;m<totalbuy;m++)

OrderSelect(m, SELECT_BY_POS, MODE_TRADES);

if(OrderType()==OP_BUY && OrderSymbol()==Symbol() && OrderMagicNumber() == Reference)

{

pips_profit=OrderProfit();

}

if(pips_profit >= 0)

{

color_of_pipsprofit = Lime;

}

else {color_of_pipsprofit = Red;

}

int n,totalsell;

totalsell=OrdersTotal();

for(n=0;n<totalsell;n++)

OrderSelect(n, SELECT_BY_POS, MODE_TRADES);

if(OrderType()==OP_SELL && OrderSymbol()==Symbol() && OrderMagicNumber() == Reference)

{

pips=OrderProfit();

}

if(pips_profit >= 0)

{

color_of_pipsprofit = Lime;

}

else {color_of_pipsprofit = Red;

}

ObjectCreate("pips_profit", OBJ_LABEL, 0, 0, 0);

ObjectSetText("pips_profit",DoubleToStr(pips_profit,2),14, "Verdana", color_of_pipsprofit);

ObjectSet("pips_profit", OBJPROP_CORNER, 3);

ObjectSet("pips_profit", OBJPROP_XDISTANCE, 35);

ObjectSet("pips_profit", OBJPROP_YDISTANCE, 20);

}

このコーディングを作成しましたが、1つの通貨の利益を他の取引通貨から分離することができません。 私のコードに何が欠けているのでしょうか?

レビューお願いします。 ご協力ありがとうございました。

デイブ

 

プロフィット

このコードを試してみてください。

int start()

{

int total = OrdersTotal();

for (int cnt = total ; cnt >=0 ; cnt--)

{

OrderSelect(cnt, SELECT_BY_POS, MODE_TRADES);

if(OrderSymbol()==Symbol() && OrderMagicNumber() == MagicNumber)

{

Print(Profit(OrderType(),OrderSymbol(),OrderOpenPrice());

}

}

return(0);

}

double Profit(int type, string currency, double open)

{

if(type==OP_BUY) return((MarketInfo(currency,MODE_BID) - open) / MarketInfo(currency,MODE_POINT) ); //case buy

if(type ==OP_SELL) return((open - MarketInfo(currency,MODE_ASK)) / MarketInfo(currency,MODE_POINT)); //case buy

return(-1);

}[/php]

1Dave7:
[php]

color color_of_pipsprofit;

color_of_pipsprofit = White;

int m,totalbuy;

totalbuy=OrdersTotal();

for(m=0;m<totalbuy;m++)

OrderSelect(m, SELECT_BY_POS, MODE_TRADES);

if(OrderType()==OP_BUY && OrderSymbol()==Symbol() && OrderMagicNumber() == Reference)

{

pips_profit=OrderProfit();

}

if(pips_profit >= 0)

{

color_of_pipsprofit = Lime;

}

else {color_of_pipsprofit = Red;

}

int n,totalsell;

totalsell=OrdersTotal();

for(n=0;n<totalsell;n++)

OrderSelect(n, SELECT_BY_POS, MODE_TRADES);

if(OrderType()==OP_SELL && OrderSymbol()==Symbol() && OrderMagicNumber() == Reference)

{

pips=OrderProfit();

}

if(pips_profit >= 0)

{

color_of_pipsprofit = Lime;

}

else {color_of_pipsprofit = Red;

}

ObjectCreate("pips_profit", OBJ_LABEL, 0, 0, 0);

ObjectSetText("pips_profit",DoubleToStr(pips_profit,2),14, "Verdana", color_of_pipsprofit);

ObjectSet("pips_profit", OBJPROP_CORNER, 3);

ObjectSet("pips_profit", OBJPROP_XDISTANCE, 35);

ObjectSet("pips_profit", OBJPROP_YDISTANCE, 20);

}

I created this coding, but I cannot isolate the profits of one currency from other currencies being traded. What am I lacking in my code??

Please review. Thanks for your help!

Dave
 
codersguru:
以下のコードを試してみてください。
int start()

{

int total = OrdersTotal();

for (int cnt = total ; cnt >=0 ; cnt--)

{

OrderSelect(cnt, SELECT_BY_POS, MODE_TRADES);

if(OrderSymbol()==Symbol() && OrderMagicNumber() == MagicNumber)

{

Print(Profit(OrderType(),OrderSymbol(),OrderOpenPrice());

}

}

return(0);

}

double Profit(int type, string currency, double open)

{

if(type==OP_BUY) return((MarketInfo(currency,MODE_BID) - open) / MarketInfo(currency,MODE_POINT) ); //case buy

if(type ==OP_SELL) return((open - MarketInfo(currency,MODE_ASK)) / MarketInfo(currency,MODE_POINT)); //case buy

return(-1);

}

こんにちは、コーダー。

これは私が必要とするものではありませんでした。 私が探しているものを説明するために、グラフの画像を添付します。 Profitを表示するようにコーディングすることは可能でしょうか? もしそうなら、私は利益額に応じて色を変えることができます。 私はただ、特定の通貨ごとの利益を探しているのです。

ファイル:
 

インジケータを付ける

こんにちは、Codersguruです。

添付のインジケーターは、ブローカーサーバーの時間ではなく、GMTの深夜にオープンを表示するようにしたいのですが、可能でしょうか?

モンティさん、ありがとうございます。

 

コードに関するヘルプ

コードを見てください。 不正な値(以下の「アカウント」を参照)を取得し、その後正しく入力されていますが、理由がわかりません。

int Account = 123456;

if (Account != AccountNumber())

{

Comment("このアカウントではこのプログラムを使用できません");

return (0);

さもなくば

{

Comment("プログラムへようこそ");

}

 

簡単な質問

init()とdeinit()関数が なくてもエキスパートアドバイザーは正常に動作するのでしょうか?

 
n7drazen:
init()とdeinit()関数がなくても、エキスパートアドバイザーは正常に動作しますか?

はい。

start関数のみが 必要です。

 

Kalenzoです。

質問があるんですが

HEDGING

探しています。

if (OrderOpenPrice() = = Bid (or Ask))

オープン価格は、新しい価格と同じでなければなりません。

私は同じペアEURUSDでヘッジしています。

もし、OpenPriceが売りで、価格が1.3580の場合。

買値は同じでなければなりません。

ありがとうございます。以下はそのコードです。

B.

//------------------------------------------

if(Buy==0)

{

RefreshRates();

OrderSend(Symbol_1,OP_BUY,lotsi,MarketInfo(Symbol_ 1,MODE_ASK),...)

RefreshRates();

if (OrderOpenPrice() == Bid)

{

OrderSend(Symbol_1,OP_SELL,lotsi,MarketInfo(Symbol _1,MODE_BID),...)

}