Trader3000 : Mükemmel!!!!!! Bunun için çok teşekkür ederim. Haftalar sonra her şey şimdi çalışıyor. Çok şey öğrendim. Herkese teşekkürler!!!
Üzgünüm ama çok erken konuştum. Trailingstop sadece bazen devreye giriyor, bu yüzden kodun hala bir yerde bozuk olduğunu düşünüyorum. İşte tüm EA. Birisi lütfen kontrol edip bir hata görürseniz bana haber verebilir mi? Teşekkür ederim
#define magicNumber 12345// Kicks in when position reaches at least TrailingStop pips of profit.externstring Label_Trailingstart = "Pip threshold to activate Trailing stop" ;
externdouble TrailingStart = 10 ;
externstring Label_Trailingstop = "Pips trailing behind" ;
externdouble TrailingStop = 5 ;
//Set it to some value above 0 to activate Hedgeexterndouble Hedge = 10 ;
externdouble Multiplier = 3 ;
externstring Label_StopLoss = "Set StopLoss of original trade" ;
externdouble StopLoss = 11 ;
externstring Label_Stoploss1 = "Set Stoploss of Hedge trade" ;
externstring Label_Stoploss2 = "Value should be less than 'Hedge'" ;
externstring Label_Stoploss3 = "otherwise a second Hedge trade will open" ;
externdouble Stoploss = 9 ;
externstring Label_Percentage = "Lotsize percentage of Equity" ;
externdouble Percentage = 1 ;
externdouble Lotsize = 0.01 ;
int i, result, total;
double stoplevel;
int init()
{
stoplevel=(MarketInfo( Symbol (),MODE_STOPLEVEL))/ 10 ; // get broker's stoplevelif (StopLoss<=stoplevel) StopLoss=stoplevel; // we compare our StopLoss withif (Stoploss<=stoplevel) Stoploss=stoplevel; // stoplevel and adjust it when error occuredif (TrailingStop<=stoplevel) TrailingStart=stoplevel+TrailingStop; // we compared our TakeProfit// as we compared our StopLossif ((StopLoss || Stoploss || TrailingStop) < stoplevel)
{
MessageBox ( "Please note: If your inputs for StopLoss, Stoploss" +
"\nand/or TrailingStop are below the minimum levels" +
"\nrequired by your broker, they will automatically" +
"\nbe increased to " + StringConcatenate (stoplevel));
}
return ( 0 );
}
int deinit()
{
return ( 0 );
}
int start()
{
//double Lots = NormalizeDouble(AccountEquity()*Percentage*Lotsize/100, 2);int buy_ticket= 0 ;
int sell_ticket= 0 ;
total= 0 ;
for (i = OrdersTotal ()- 1 ; i >= 0 ; i--)
if ( OrderSelect (i, SELECT_BY_POS)
&& OrderMagicNumber() == magicNumber
&& OrderSymbol() == Symbol ())
{
total++;
if (OrderType()==OP_BUY)
buy_ticket=OrderTicket();
if (OrderType()==OP_SELL)
sell_ticket=OrderTicket();
}
if (total== 0 && Close[ 1 ]>Close[ 2 ])
{
result= OrderSend ( Symbol (), OP_BUY, 0.01 , Ask, 3 , Ask - StopLoss* Point * 10 , 0 , "Original" , magicNumber, 0 , Blue);
Print ( "Error setting Original order: " , GetLastError ());
}
if (buy_ticket> 0 && OrderSelect (buy_ticket,SELECT_BY_TICKET) && OrderType() == OP_BUY)
{
if (Bid - OrderOpenPrice() > NormalizeDouble (TrailingStart * Point * 10 , Digits ))
{
if (OrderStopLoss() < Bid - NormalizeDouble (TrailingStop * Point * 10 , Digits ))
{
if (OrderModify(OrderTicket(), OrderOpenPrice(), Bid - NormalizeDouble (TrailingStop * Point * 10 , Digits ),
OrderTakeProfit(), Blue))
Print ( "Error setting Buy trailing stop: " , GetLastError ());
}
}
elseif (OrderOpenPrice() > Bid + NormalizeDouble (Hedge* Point * 10 , Digits ))
if (total == 1 )
{
result= OrderSend ( Symbol (), OP_SELL, NormalizeDouble (OrderLots() * Multiplier, 2 ), Bid, 3 ,
Bid + Stoploss* Point * 10 , 0 , "Hedge" , magicNumber, 0 , Blue);
Print ( "Error setting Sell Hedge: " , GetLastError ());
}
}
elseif (sell_ticket> 0 && OrderSelect (buy_ticket,SELECT_BY_TICKET) && OrderType() == OP_SELL)
{
if (OrderOpenPrice() - Ask > NormalizeDouble (TrailingStart * Point * 10 , Digits ))
{
if (OrderStopLoss() > Ask + NormalizeDouble (TrailingStop * Point * 10 , Digits ))
{
if (OrderModify(OrderTicket(), OrderOpenPrice(), Ask + NormalizeDouble (TrailingStop * Point * 10 , Digits ),
OrderTakeProfit(), Red))
Print ( "Error setting Sell trailing stop: " , GetLastError ());
}
}
elseif (OrderOpenPrice() < Ask - NormalizeDouble (Hedge* Point * 10 , Digits ))
if (total == 1 )
{
result= OrderSend ( Symbol (), OP_BUY, NormalizeDouble (OrderLots() * Multiplier, 2 ), Ask, 3 ,
Ask - Stoploss* Point * 10 , 0 , "Hedge" , magicNumber, 0 , Red);
Print ( "Error setting Buy Hedge: " , GetLastError ());
}
}
return ( 0 );
}
if (buy_ticket> 0 && OrderSelect (buy_ticket,SELECT_BY_TICKET) && OrderType() == OP_BUY)
{
//Code
}
elseif (sell_ticket> 0 && OrderSelect (buy_ticket,SELECT_BY_TICKET) && OrderType() == OP_SELL)
{
//If there is an open buy order code here will not be executed//The else is not necessary
}
Bunu belirttiğin için çok teşekkür ederim. Hatayı düzelttim ve şimdi çalışıyor. Başka bir sorum daha var. Stoploss'um aracının STOP_LEVEL değerinden daha az olduğunda mesaj kutusunun açılmasını sağlamaya çalışıyorum, ancak daha fazla olduğunda bile ortaya çıkıyor. 'init' bölümü yerine 'start' bölümüne koymaya çalıştım ama orada da çalışmıyor. Birisi lütfen bir göz atıp neyin yanlış olduğunu bana bildirebilir mi? Teşekkür ederim
int init()
{
stoplevel=(MarketInfo( Symbol (),MODE_STOPLEVEL))/ 10 ; // get broker's stoplevelif (StopLoss<=stoplevel) StopLoss=stoplevel; // we compare our StopLoss withif (Stoploss<=stoplevel) Stoploss=stoplevel; // stoplevel and adjust it when error occuredif (TrailingStop<=stoplevel) TrailingStart=stoplevel+TrailingStop; // we compared our TakeProfit// as we compared our StopLossif ((StopLoss || Stoploss || TrailingStop) < stoplevel)
{
MessageBox ( "Please note: If your inputs for StopLoss, Stoploss" +
"\nand/or TrailingStop are below the minimum levels" +
"\nrequired by your broker, they will automatically" +
"\nbe increased to " + StringConcatenate (stoplevel));
}
return ( 0 );
}
Herkese merhaba, yine bir tıkanıklıkla karşılaştım. Bu çok garip ve bunun neden olduğunu anlayamıyorum. Yukarıda bahsettiğim gibi, EA iyi çalıştı, ama şimdi sadece bundan değiştirmek istiyorum
Cevabınız için teşekkür ederim ama anlamadım. Son durak için kod burada
{
if (Bid - OrderOpenPrice() > NormalizeDouble (TrailingStart * Point * 10 , Digits ))
{
if (OrderStopLoss() < Bid - NormalizeDouble (TrailingStop * Point * 10 , Digits ))
{
if (OrderModify(OrderTicket(), OrderOpenPrice(), Bid - NormalizeDouble (TrailingStop * Point * 10 , Digits ),
OrderTakeProfit(), Blue))
Bir Stoploss'um varsa, EA çalışır ve Trailingstop ve çit devreye girer, ancak Stoploss'u 0 olarak değiştirirsem hiçbir şey işe yaramaz. Stoploss'un Trailingstop ve çit üzerinde nasıl ve neden bir etkisi olacağını anlamıyorum?
Evet, siparişi yeniden seçmelisiniz
Yukarıdaki kodla, bilet numarasını saklamak için yeni bir değişken oluşturursunuz, ardından işlemi bilet numarasına göre seçebilirsiniz.
Evet, siparişi yeniden seçmelisiniz
Yukarıdaki kodla, bilet numarasını saklamak için yeni bir değişken oluşturursunuz, ardından işlemi bilet numarasına göre seçebilirsiniz.
Mükemmel!!!!!! Bunun için çok teşekkür ederim. Haftalar sonra her şey şimdi çalışıyor. Çok şey öğrendim. Herkese teşekkürler!!!
Üzgünüm ama çok erken konuştum. Trailingstop sadece bazen devreye giriyor, bu yüzden kodun hala bir yerde bozuk olduğunu düşünüyorum. İşte tüm EA. Birisi lütfen kontrol edip bir hata görürseniz bana haber verebilir mi? Teşekkür ederim
,
,
Bunu belirttiğin için çok teşekkür ederim. Hatayı düzelttim ve şimdi çalışıyor. Başka bir sorum daha var. Stoploss'um aracının STOP_LEVEL değerinden daha az olduğunda mesaj kutusunun açılmasını sağlamaya çalışıyorum, ancak daha fazla olduğunda bile ortaya çıkıyor. 'init' bölümü yerine 'start' bölümüne koymaya çalıştım ama orada da çalışmıyor. Birisi lütfen bir göz atıp neyin yanlış olduğunu bana bildirebilir mi? Teşekkür ederim
if ((StopLoss || Stoploss || TrailingStop) < stoplevel)mantıklı değil
demek istiyorsun
if ((StopLoss < stoplevel || TrailingStop) < stoplevel)mantıklı değil
demek istiyorsun
Herkese merhaba, yine bir tıkanıklıkla karşılaştım. Bu çok garip ve bunun neden olduğunu anlayamıyorum. Yukarıda bahsettiğim gibi, EA iyi çalıştı, ama şimdi sadece bundan değiştirmek istiyorum
ile
Başka hiçbir şeye dokunmuyorum, ancak bu basit değişiklikten sonra ne İzleyen durdurma ne de çit tetiklenmiyor. Bu garip. Kodun tamamı yukarıda
Cevabınız için teşekkür ederim ama anlamadım. Son durak için kod burada
{ if (Bid - OrderOpenPrice() > NormalizeDouble (TrailingStart * Point * 10 , Digits )) { if (OrderStopLoss() < Bid - NormalizeDouble (TrailingStop * Point * 10 , Digits )) { if (OrderModify(OrderTicket(), OrderOpenPrice(), Bid - NormalizeDouble (TrailingStop * Point * 10 , Digits ), OrderTakeProfit(), Blue))Bir Stoploss'um varsa, EA çalışır ve Trailingstop ve çit devreye girer, ancak Stoploss'u 0 olarak değiştirirsem hiçbir şey işe yaramaz. Stoploss'un Trailingstop ve çit üzerinde nasıl ve neden bir etkisi olacağını anlamıyorum?