İzleyen Duraklar ve İzleyen Kar - sayfa 2

 
Arav007 :


Kusura bakmayın aslında biraz kafam karıştı.

if (iOpenOrders_Buy = 3 )

Burada Toplam Açılan Satın Alma emri '3'e eşitse, kod bir sonraki bölüme geçecektir.

if (iOpenOrders_Buy > 0 )

Ardından, Toplam Açılan Satın Alma siparişinin sayısı '0'dan büyükse, bir sonrakine geçecektir.

if (iOpenOrders_Buy == 3 )

Ardından, Açık Alış emri sayısı 3'e eşitse BuyOrder_1, '2'ye eşitse BuyOrder_2'yi açar ve ardından BuyOrder_3 Açılmış Alış emri sayısı 1'e eşittir.

haklı mıyım?

 double dTakeProfitPrice_1= 10 ;

double dTakeProfitPrice_2= 20 ;

double dTakeProfitPrice_3= 0 ;
double BuyOrder_1,.......,.......;
if (Buy Condition Met && iOpenOrders_Buy == 0 )
{

iOpenOrders_Buy = 3 ;

{

if (iOpenOrders_Buy  > 0 ) // we have to open new Buy orders

{

if (iOpenOrders_Buy == 3 )
         {
         BuyOrder_1= OrderSend ( Symbol (), iOrderType_Buy, LotSize,OpenPrice,Slippage,dStopLossPrice,dTakeProfitPrice_1, "Buy Order" ,MagicNumber, 0 ,Blue);
         if (BuyOrder_1 > 0 ).......
         

         }
if (iOpenOrders_Buy == 2 )
         {
         BuyOrder_2= OrderSend ( Symbol (), iOrderType_Buy, LotSize,OpenPrice,Slippage,dStopLossPrice,dTakeProfitPrice_2, "Buy Order" ,MagicNumber, 0 ,Blue);
....



if (iOpenOrders_Buy == 1 )
         {
         BuyOrder_3= OrderSend ( Symbol (), iOrderType_Buy, LotSize,OpenPrice,Slippage,dStopLossPrice,dTakeProfitPrice_3, "Buy Order" ,MagicNumber, 0 ,Blue);
....
}

haklısın değiştirilen koda tekrar bak tamam mı ??
 
deVries :

haklısın değiştirilen koda tekrar bak tamam mı ??


Öyle düşünmüyorum.

if (Satın Alma Koşulları Karşılandı && iOpenOrders_Buy == 0 )

Bu, 'Alma Koşulu Karşılandı' ve 'Açık Alış' emri olmadığı anlamına geliyor, değil mi?

daha sonra kod, iOpenOrders_Buy = 3 olan bir sonraki satıra ilerleyecektir ;

Yani EA'ya zaten orada 3 tane açılmış emir olduğu söyleniyor, değil mi?

Ama orada Açık Satın Alma emri olmadığını bilerek koda giriyorsam neden iOpenOrders_Buy = 3 ; ?

Ayrıca hedef, Üç işlemden birinin çalışmaya devam etmesi ve son işlem kapandığında yalnızca 'Yeni' alış emrinin açılmasıdır.

Yani bu olmalı

if (iOpenOrders_Buy== 0 ) // Açılmış Alış emri olmadığı için yeni Alış emirleri açmamız gerekiyor


EA Satın Alma koşulunu aldığında, farklı Kâr Al ile Üç işlem açacaktır.

Ardından, işlemlerden ikisi yine de (TP veya SL tarafından) kapatılırsa, üçüncüsü çalışmaya devam eder.

 double dTakeProfitPrice_1= 10 ;

double dTakeProfitPrice_2= 20 ;

double dTakeProfitPrice_3= 0 ;

double BuyOrder_1,BuyOrder_2,BuyOrder_3;  

iMaxOrders= 3 ; 

iOpenOrders_Buy = CntOrd(iOrderType_Buy,MagicNumber, Symbol ());   //counting open buy orders. 

if (Buy Condition Met && iOpenOrders_Buy == 0 ) //Buy condition has met and there is no Open Buy Order

{ 

if (iOpenOrders_Buy < iMaxOrders) //This will Limit the desired number of orders; Though this is not necessary.

{

BuyOrder_1= OrderSend ( Symbol (), iOrderType_Buy, LotSize,OpenPrice,Slippage,dStopLossPrice,dTakeProfitPrice_1, "Buy Order" ,MagicNumber, 0 ,Blue); 

//First order opened with TP1 

BuyOrder_2= OrderSend ( Symbol (), iOrderType_Buy, LotSize,OpenPrice,Slippage,dStopLossPrice,dTakeProfitPrice_2, "Buy Order" ,MagicNumber, 0 ,Blue);

//Second order opened with TP2  

BuyOrder_3= OrderSend ( Symbol (), iOrderType_Buy, LotSize,OpenPrice,Slippage,dStopLossPrice,dTakeProfitPrice_3, "Buy Order" ,MagicNumber, 0 ,Blue);

////Third order opened with TP3  

} 

} 

else {

print ( "There is already a Running Order" )

} 

Bunun hakkında ne düşünüyorsun? Yukarıda belirtilenle aynı şeyi yapar mı?

Saygılarımızla

 
Arav007 :


Öyle düşünmüyorum.


Bunun hakkında ne düşünüyorsun? Yukarıda belirtilenle aynı şeyi yapar mı?

Saygılarımızla

hayır emirler başarılı olmazsa ne olur, biri başarısız olursa hangi ticareti açmanız gerektiğini nasıl kontrol edersiniz

neden iOpenOrders_Buy = 3 atadık ; ?

siparişler başarılı olursa 3 yeni işlem açmalısın iOpenOrders_Buy yeni değer yap

Eğer iOpenOrders_Buy 0 olur 3 işlemimiz var

 
deVries :

hayır emirler başarılı olmazsa ne olur, biri başarısız olursa hangi ticareti açmanız gerektiğini nasıl kontrol edersiniz

neden iOpenOrders_Buy = 3 atadık ; ?

siparişler başarılı olursa 3 yeni işlem açmalısın iOpenOrders_Buy yeni değer yap

Eğer iOpenOrders_Buy 0 olur 3 işlemimiz var

 int iLastError;

 for (count=iMaxOrders; count> 0 ; count--)

{

if (count== 3 ) {

 BuyOrder_1= OrderSend ( Symbol (), iOrderType_Buy, LotSize,OpenPrice,Slippage,dStopLossPrice,dTakeProfitPrice_1, "Buy Order" ,MagicNumber, 0 ,Blue);

if (BuyOrder_1> 0 ) //Checking if the order was opened or not

{ 

Print ( "Buy Order 1 Opened successfully" );

}

else {

 Print ( "Order Sending Error" );

iLastError = GetLastError();

iMaxOrders= 3 ; //Setting iMaxOrders to 3 again thus it goes back and try to open that order again

} 

}

 if (count== 2 ) {

 BuyOrder_2= OrderSend ( Symbol (), iOrderType_Buy, LotSize,OpenPrice,Slippage,dStopLossPrice,dTakeProfitPrice_2, "Buy Order" ,MagicNumber, 0 ,Blue);

if (BuyOrder_2> 0 ) {

Print ( "Buy Order 2 Opened successfully" );

}

else {

 Print ( "Order Sending Error" );

iLastError = GetLastError();

iMaxOrders= 2 ;

}  

}

if (count== 1 ) {

 BuyOrder_3= OrderSend ( Symbol (), iOrderType_Buy, LotSize,OpenPrice,Slippage,dStopLossPrice,dTakeProfitPrice_3, "Buy Order" ,MagicNumber, 0 ,Blue);

if (BuyOrder_3> 0 ) {

Print ( "Buy Order 3 Opened successfully" );

}

else {

 Print ( "Order Sending Error" );

iLastError = GetLastError();

iMaxOrders= 1 ;

}  

}

} 

Evet, 'Ordersend()' emrini açamaması çok olasıdır.

Şimdi nedenini anladım

if (iOpenOrders_Buy > 0 ) // yeni Alış emirleri açmalıyız

kodunuzda kullanıldı. Zaten iopendOrders=3 olarak ayarladığımız için, bunu doğrulayacaktır.

Ancak daha sonra iopendOrders değerinin nasıl değişmeye devam edeceği konusunda kafam karıştı.

Muhtemelen sınırlı beynim için mekanizmayı çözemedim. Bu yüzden mantığınızı yukarıdaki şekilde uygulamaya çalıştım.

Verdiğiniz koda atıfta bulunduğunuz şey bu mu?

Saygılarımızla

 
Arav007 :

Evet, 'Ordersend()' emrini açamaması çok olasıdır.

Şimdi nedenini anladım

if (iOpenOrders_Buy > 0 ) // yeni Alış emirleri açmalıyız

kodunuzda kullanıldı. Zaten iopendOrders=3 olarak ayarladığımız için, bunu doğrulayacaktır.

Ancak daha sonra iopendOrders değerinin nasıl değişmeye devam edeceği konusunda kafam karıştı.

Muhtemelen sınırlı beynim için mekanizmayı çözemedim. Bu yüzden mantığınızı yukarıdaki şekilde uygulamaya çalıştım.

Verdiğiniz koda atıfta bulunduğunuz şey bu mu?

Saygılarımızla


 if (BuyOrder_1> 0 ) //Checking if the order was opened or not

{ 

Print ( "Buy Order 1 Opened successfully" );
count = count - 1;
}

 
deVries :



Lütfen kusura bakmayın ama yine kafam karıştı!

eğer kullanırsam

say=say-1; sonrasında

Print ( " Sipariş 1 Başarıyla Açıldı" );

yani ilk satın alma emri açılırsa, sayım değeri 1 azalır.

Yani bir sonraki fonksiyona girerken, işte bir sonraki 'if' koşulu:

if (sayım== 2 ) {}

bunun için count değeri '2' olmuştur. [sayım=3-1=2]

Bu doğru mu?

 
Arav007 :


Lütfen kusura bakmayın ama yine kafam karıştı!

eğer kullanırsam

say=say-1; sonrasında

Print ( "Sipariş 1 Başarıyla Açıldı" );

yani ilk satın alma emri açıldıysa, sayım değeri 1 azalacaktır.

Yani bir sonraki fonksiyona girerken, burada bir sonraki 'if' koşulu:

if (sayım== 2 ) {}

bunun için count değeri '2' olmuştur. [sayım=3-1=2]

Bu doğru mu?


deneyin.... biraz test yapın
 
deVries :

deneyin.... biraz test yapın


Yorgun ve Sonuç bu.

Muhtemelen 'Satın Almadan Önce Kapanış Satış Emri' kodunu doğru yere yerleştiremedim. Bu nedenle, Orijinal koda aykırı olmasına rağmen, Sat ve Al'ı tamamen elde etmek.

Ve toplamda '4' satın alma emri var!

Başarısız oldum :(

                 double OpenPrice= Ask ;

                 double   dTakeProfitPrice_1,dTakeProfitPrice_2,dTakeProfitPrice_3;
                dStopLossPrice = NormalizeDouble (OpenPrice - StopLoss * dPip, Digits );
                dTakeProfitPrice_1 = NormalizeDouble (OpenPrice + TakeProfit_1 * dPip, Digits );
                dTakeProfitPrice_2 = NormalizeDouble (OpenPrice + TakeProfit_2 * dPip, Digits );
                dTakeProfitPrice_3 = NormalizeDouble (OpenPrice + TakeProfit_3 * dPip, Digits );
                
 for ( int count=iMaxOrders; count> 0 ; count--)

{

if (count== 3 ) {

 BuyOrder_1= OrderSend ( Symbol (), iOrderType_Buy, LotSize,OpenPrice,Slippage,dStopLossPrice,dTakeProfitPrice_1, "Buy Order" ,MagicNumber, 0 ,Blue);

if (BuyOrder_1> 0 ) //Checking if the order was opened or not

{ 

sLog_CheckBuyConditions = sLog_CheckBuyConditions + sNL + "    Buy order 1 sent successfully. Ticket=" + BuyOrder_1;
                                iLastError = 0 ;
                                count = count - 1 ; 

}

else {

 iLastError = GetLastError();
                                
                                sLog_CheckBuyConditions = sLog_CheckBuyConditions + sNL + "    Error sending buy order 1. Error code=" + ErrorDescription(iLastError);

iMaxOrders= 3 ; //Setting iMaxOrders to 3 again thus it goes back and try to open that order again

} 

}

 if (count== 2 ) {

 BuyOrder_2= OrderSend ( Symbol (), iOrderType_Buy, LotSize,OpenPrice,Slippage,dStopLossPrice,dTakeProfitPrice_2, "Buy Order" ,MagicNumber, 0 ,Blue);

if (BuyOrder_2> 0 ) { 

sLog_CheckBuyConditions = sLog_CheckBuyConditions + sNL + "    Buy order 2 sent successfully. Ticket=" + BuyOrder_2;
                                iLastError = 0 ;
                                count = count - 1 ; 

}

else {

 iLastError = GetLastError();
                                
                                sLog_CheckBuyConditions = sLog_CheckBuyConditions + sNL + "    Error sending buy order 2. Error code=" + ErrorDescription(iLastError);

iMaxOrders= 2 ; //Setting iMaxOrders to 2 again thus it goes back and try to open that order again

} 

}

if (count== 1 ) {

 BuyOrder_3= OrderSend ( Symbol (), iOrderType_Buy, LotSize,OpenPrice,Slippage,dStopLossPrice,dTakeProfitPrice_3, "Buy Order" ,MagicNumber, 0 ,Blue);

if (BuyOrder_3> 0 ) {

sLog_CheckBuyConditions = sLog_CheckBuyConditions + sNL + "    Buy order 2 sent successfully. Ticket=" + BuyOrder_3;
                                iLastError = 0 ;
                                count = count - 1 ; 
}

else {

  iLastError = GetLastError();
                                
                                sLog_CheckBuyConditions = sLog_CheckBuyConditions + sNL + "    Error sending buy order 2. Error code=" + ErrorDescription(iLastError);

iMaxOrders= 1 ; //Setting iMaxOrders to 1 again thus it goes back and try to open that order again

}  

}
 

opps, iOpenOrders_Buy == 0 koymayı unuttum

Şimdi bununla tekrar test edin.

 
double OpenPrice=Ask;

double  dTakeProfitPrice_1,dTakeProfitPrice_2,dTakeProfitPrice_3;
dStopLossPrice = NormalizeDouble(OpenPrice - StopLoss * dPip,Digits);
dTakeProfitPrice_1 = NormalizeDouble(OpenPrice + TakeProfit_1 * dPip,Digits);
dTakeProfitPrice_2 = NormalizeDouble(OpenPrice + TakeProfit_2 * dPip,Digits);
dTakeProfitPrice_3 = NormalizeDouble(OpenPrice + TakeProfit_3 * dPip,Digits);
                
//some condition
if(Ask>High[1] && OrdersTotal()<1)int count=3; //(int count=iMaxOrders; count>0; count--)
{
iLastError = 0;
   if (count==3) 
    {
    BuyOrder_1=OrderSend(Symbol(), iOrderType_Buy, LotSize,OpenPrice,Slippage,dStopLossPrice,dTakeProfitPrice_1, "Buy Order",MagicNumber, 0,Blue);
    if (BuyOrder_1>0) //Checking if the order was opened or not
      { 
      sLog_CheckBuyConditions = sLog_CheckBuyConditions + sNL + "    Buy order 1 sent successfully. Ticket=" + BuyOrder_1;
      count = count - 1; 
      }
     else {
          iLastError = GetLastError();                               
          sLog_CheckBuyConditions = sLog_CheckBuyConditions + sNL + "    Error sending buy order 1. Error code=" + ErrorDescription(iLastError);
          iMaxOrders=3; //Setting iMaxOrders to 3 again thus it goes back and try to open that order again
          } 
    }

   if (count==2) 
    {
    BuyOrder_2=OrderSend(Symbol(), iOrderType_Buy, LotSize,OpenPrice,Slippage,dStopLossPrice,dTakeProfitPrice_2, "Buy Order",MagicNumber, 0,Blue);
    if (BuyOrder_2>0) 
      { 
      sLog_CheckBuyConditions = sLog_CheckBuyConditions + sNL + "    Buy order 2 sent successfully. Ticket=" + BuyOrder_2;
      count = count - 1; 
      }
     else {
          iLastError = GetLastError();
          sLog_CheckBuyConditions = sLog_CheckBuyConditions + sNL + "    Error sending buy order 2. Error code=" + ErrorDescription(iLastError);
          iMaxOrders=2; //Setting iMaxOrders to 3 again thus it goes back and try to open that order again
          } 
    }

   if (count==1) 
    {
    BuyOrder_3=OrderSend(Symbol(), iOrderType_Buy, LotSize,OpenPrice,Slippage,dStopLossPrice,dTakeProfitPrice_3, "Buy Order",MagicNumber, 0,Blue);
    if (BuyOrder_3>0) 
      {
      sLog_CheckBuyConditions = sLog_CheckBuyConditions + sNL + "    Buy order 2 sent successfully. Ticket=" + BuyOrder_3;
      iLastError = 0;
      count = count - 1; 
      }
     else {
          iLastError = GetLastError();                               
          sLog_CheckBuyConditions = sLog_CheckBuyConditions + sNL + "    Error sending buy order 2. Error code=" + ErrorDescription(iLastError);
          iMaxOrders=1; //Setting iMaxOrders to 3 again thus it goes back and try to open that order again
          }
    }  
}    //all code in red not needed