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

 

非ラグジグザグ信号の問題

kevin07さん、こんにちは。

Nonlagzigzagのアラートは動作していますが、ジグザグ線に対応していません。何度かアラートを受け取りましたが、ジグザグ線は描画されません。また、最初にインジケータをロードしたときにアラートが表示されます。コードを見て、問題を見つけられるかどうか見てもらえますか?電子メールアラートもうまく機能しています。何かできることがあれば、とても感謝します。

よろしくお願いします、Tom

 

ノンラグジグザグ

こんにちは、tk748さん、インディを読み込んだ時にポップアップした最初のアラートは、最後の最高値または最安値(数本前に発生したかもしれません)以降の現在のトレードの方向を教えてくれます。次のラインが引かれる前に中間アラートが出るとは、残念です。アラートのIF文に、CurrentDirection != PreviousDirectionをチェックするフィルターを追加して、次のラインが引かれるまで追加のアラートがポップアップされないようにすることができるかもしれません。(私は自分のEAの仕上げに携わっているので、現時点ではそれに取り組むことはできません)。日中、私は働かなければなりません。夜、寝なければならない。EAがないと、あまり(全く)トレードができない。ジグザグやボラティリティ・インディをフィルターとして使い、採算の合わないトレードが始まらないようにすることが最優先です。

その過程で、その追加コードを 追加する方法を見つけたら、お知らせします。

ベストウィッシュ、kevin07

 

ストラドル・スクリプト

このスクリプトを手に入れましたが、ロンドンオープンを取引するタイマーを設定するオプションが欲しいです。これを追加するのはどのくらい難しいでしょうか?

いつものように...私はあなたの助けに感謝します!

#include

#include

#define LOOK_TO_BUY 1

#define LOOK_TO_SELL 2

extern int Magic_Number = 412625; // set this to a unique number if you intend to use the script simulataneously across many charts on the same account.

extern int UserDefinedSpread = 0; // set this to 0 if you want to use market spread. valid value is >= 0

extern double LotSize = 0.1;

extern int Slippage = 3;

extern int StopLoss = 25; // If you set StopLoss to 0, no stop loss level will be placed.

extern int TakeProfit = 0; // If you set TakeProfit to 0, no stop loss level will be placed.

extern bool OneCancelsOther = true; // This determines if you want the script to stay running and track, then delete the opposite pending order when an order has executed.

extern int NumOfCandles = 3; // This determines how many previous candles you want the EA to look for the High Lows. (buy and sell prices). valid value is > 0

extern int PositionalMarginPips = 40; // The distance excluding spread from the high lows for the opening prices. valid value is >= 0

extern int intervalseconds = 1.0; //The time interval for the script to check your trades. allows fractional seconds.

double BuyPrice = 0;

double SellPrice = 0;

int CustomSpread = 0;

bool KeepRunning = true;

int ticketToDelete = 0;

void GetPrices()

{

double HighestHigh = High[1];

if (NumOfCandles > 1)

{

for (int i=2; i<=NumOfCandles; i++)

{

if (High > HighestHigh)

{

HighestHigh = High;

}

}

}

BuyPrice = HighestHigh + (PositionalMarginPips * Point);

BuyPrice = NormalizeDouble(BuyPrice,Digits);

double LowestLow = Low[1];

if (NumOfCandles > 1)

{

for (i=2; i<=NumOfCandles; i++)

{

if (Low < LowestLow)

{

LowestLow = Low;

}

}

}

SellPrice = LowestLow - (PositionalMarginPips * Point);

BuyPrice = NormalizeDouble(BuyPrice,Digits);

}

void PlaceTrades()

{

double TakeProfitPrice, StopLossPrice;

if (TakeProfit==0)

{

TakeProfitPrice = 0;

}

else

{

TakeProfitPrice = BuyPrice + (TakeProfit * Point);

TakeProfitPrice = NormalizeDouble(TakeProfitPrice,Digits);

}

if (StopLoss == 0)

{

StopLossPrice = 0;

}

else

{

StopLossPrice = BuyPrice - (StopLoss * Point);

StopLossPrice = NormalizeDouble(StopLossPrice,Digits);

}

SendOrders (LOOK_TO_BUY, LotSize, BuyPrice, Slippage, StopLossPrice, TakeProfitPrice, "Straddle Buy", 0);

if (TakeProfit==0)

{

TakeProfitPrice = 0;

}

else

{

TakeProfitPrice = SellPrice - (TakeProfit * Point);

TakeProfitPrice = NormalizeDouble(TakeProfitPrice,Digits);

}

if (StopLoss == 0)

{

StopLossPrice = 0;

}

else

{

StopLossPrice = SellPrice + (StopLoss * Point);

StopLossPrice = NormalizeDouble(StopLossPrice,Digits);

}

SendOrders (LOOK_TO_SELL, LotSize, SellPrice, Slippage, StopLossPrice, TakeProfitPrice, "Straddle Sell", 0);

}

void SendOrders (int BuyOrSell, double LotSize, double PriceToOpen, double Slippage, double SL_Price, double TP_Price, string comments, datetime ExpirationTime)

{

int PositionType, ticket, errorType;

if (BuyOrSell == LOOK_TO_BUY)

{

if (PriceToOpen > Ask)

{

PositionType = OP_BUYSTOP;

}

if (PriceToOpen < Ask)

{

PositionType = OP_BUYLIMIT;

}

Print("Bid: "+Bid+" Ask: "+Ask+" | Opening Buy Order: "+Symbol()+", "+PositionType+", "+LotSize+", "+PriceToOpen+", "+Slippage+", "+SL_Price+", "+TP_Price+", "+comments+", "+Magic_Number+", "+ExpirationTime+", Green");

ticket=OrderSend(Symbol(),PositionType,LotSize,PriceToOpen,Slippage,SL_Price,TP_Price,comments,Magic_Number,ExpirationTime,CLR_NONE);

if(ticket>0)

{

if(OrderSelect(ticket,SELECT_BY_TICKET,MODE_TRADES))

{

Print("BUY order opened : ",OrderOpenPrice());

}

}

else

{

errorType = GetLastError();

Print("Error opening BUY order : ", ErrorDescription(errorType));

}

}

if (BuyOrSell == LOOK_TO_SELL)

{

if (PriceToOpen < Bid)

{

PositionType = OP_SELLSTOP;

}

if (PriceToOpen > Bid)

{

PositionType = OP_SELLLIMIT;

}

Print("Bid: "+Bid+" Ask: "+Ask+" | Opening Sell Order: "+Symbol()+", "+PositionType+", "+LotSize+", "+PriceToOpen+", "+Slippage+", "+SL_Price+", "+TP_Price+", "+comments+", "+Magic_Number+", "+ExpirationTime+", Red");

ticket=OrderSend(Symbol(),PositionType,LotSize,PriceToOpen,Slippage,SL_Price,TP_Price,comments,Magic_Number,ExpirationTime,CLR_NONE);

if(ticket>0)

{

if(OrderSelect(ticket,SELECT_BY_TICKET,MODE_TRADES))

{

Print("Sell order opened : ",OrderOpenPrice());

}

}

else

{

errorType = GetLastError();

Print("Error opening SELL order : ", ErrorDescription(errorType));

}

}

}

void GetSpread()

{

if (UserDefinedSpread <= 0)

{

CustomSpread = MarketInfo(Symbol(),MODE_SPREAD);

}

else

{

CustomSpread = UserDefinedSpread;

}

}

int GetNumberOfPending()

{

int count = 0;

int total = OrdersTotal();

if (total > 0)

{

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

{

if(OrderSelect(cnt,SELECT_BY_POS))

{

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

{

if(OrderType() != OP_BUY && OrderType() != OP_SELL)

{

ticketToDelete = OrderTicket();

count++;

}

}

}

}

}

return (count);

}

void ManageTrades()

{

// If there's only one pending trade left, assume the other one is opened.

// So Delete this one.

if (GetNumberOfPending() == 1)

{

if (OrderDelete(ticketToDelete))

{

KeepRunning = false;

Alert ("Straddle script has ended");

}

}

}

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

//| script program start function |

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

int start()

{

//----

GetSpread();

GetPrices();

PlaceTrades();

Alert ("Pending Trades Placed. Please Wait...");

int intervalMilliseconds = intervalseconds * 1000;

while (KeepRunning && OneCancelsOther)

{

Sleep(intervalMilliseconds);

ManageTrades();

}

//----

return(0);

}

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

 

ノン・ラッグジグザグ警報

kevin07さん、こんにちは。

このインジケータの作成に感謝します。おそらく、EAのコーディング中に、シグナルを 適切なタイミングで表示させる方法について、アイデアをお持ちだと思います。その間に、他の誰かがこの問題を解決する時間があるかもしれません。あなたのEAが成功することを祈っています。

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

トム

 

マチガレコードを追加するのを手伝ってください

このサイトを使ってEAを作りました。Expert Advisor Builder for MetaTrader 4 は、シンプルなルールでトレードできるEAです。

このEAを試してみて、結果を見ることができます。SL = 100, TP = 300, トレーリングストップ = 70に設定し、EUR/USD H4で動作させてください。

このシステムを取引するためにマルティゲイルを置くのを手伝っていただけませんか。

100 pips = 口座残高の2%となるような金額を使用します。

取引n-1が 失われた場合、利益でポジションを閉じるまで、取引nの 金額を2倍にする。

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

ファイル:
 
vinafx:
このサイトを使って、このEAをmadeしたばかりです。Expert Advisor Builder for MetaTrader 4 は、シンプルなルールで取引できるEAです。

このEAを試してみて、結果を確認することができます。SL = 100, TP = 300, トレーリングストップ = 70に設定し、EUR/USD H4で動作させてください。

このシステムを取引するためにマーティガレを置くのを助けていただけませんか。

100 pips = 口座残高の2%となるような金額を使用します。

取引n-1が 失われた場合、利益でポジションを閉じるまで、取引nの 金額を2倍にする。

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

それは、少し時間を費やす価値がある、友人これは、マーティゲールコードなしで取引した結果です。初期預金: 10000; 1トレードあたり1ロット。SL = 100; TP = 300; トレーリングST: 70; EUR/USD H4.

ファイル:
 

このコードをどのように単純化するのですか?

a と b の差 <= c ならば取引 = true、そうでなければ false。

今のところ、これは私が作ったものです。もし誰かがこれをコード化する短い方法を教えてくれるなら...

if ( a >= b)

{

if (a - b <= c ) trade = true;

if (a - b > c) trade = false;

}

if ( a < b )

{

if (b - a <= c ) trade = true;

if (b - a > c) trade = false;

}

 

を試してみてください(cは≧0と仮定しています)。

trade = (MathAbs(a-b) <= c);

よろしくお願いします。

mladen

fercan:
このコードをどのように単純化するのでしょうか?

aとbの差 <= c ならば取引 = true、そうでなければ false。

今のところ、これは私が作ったものです。もし誰かがこれをコード化する短い方法を教えてくれるなら...

if ( a >= b)

{

if (a - b <= c ) trade = true;

if (a - b > c) trade = false;

}

if ( a < b )

{

if (b - a <= c ) trade = true;

if (b - a > c) trade = false;

}
 
mladen:
これを試してみてください(cは≧0と仮定しています)
trade = (MathAbs(a-b) <= c);

よろしくお願いします

mladen

このようなものを探していました。

 

テスト NonLagZigZag_Signal_v2アラート

tk748:
kevin07さん、こんにちは。

ありがとうございます...おそらく...適切なタイミングでシグナルを表示させる方法について、あなたはアイデアを持っているでしょう...

ありがとうございます。

トム

やあ、Tom。

私はこのZigZagインディに戻り、中間アラートをフィルタリングすることができました。早速送信していますが、テストはしていません。もし、アラート関連の問題が見つかったら教えてください。

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

kevin07

ファイル: