SL ve TP'yi test cihazına sürükleyip bırakın. - sayfa 14

 
Yine de 3. seçeneğe sürükleyerek SL ve TP eklemeye karar verdim. Onlar. SL ve TP'yi algoritma 3'e göre kurduktan sonra, onları ihtiyacımız olan yere sürükleyebiliriz. Bu bence en uygun (evrensel) seçenektir. void OnTick() öğesinin gövdesi şu satırı içermelidir: if(PriceModify< Point() ) {OnSL=0;OnTP=0;}
 void ModifySlTp2( double priceModify= 0 )
 {
   double sl= 0 ,tp= 0 ;
  
   for ( int i= 0 ; i< OrdersTotal (); i++) 
     { 
       if ( OrderSelect (i, SELECT_BY_POS , MODE_TRADES )) 
        { 
         if ( OrderSymbol ()== Symbol () && OrderMagicNumber ()==MagicNumber) 
           {
             if ( MathAbs ( OrderOpenPrice ()-priceModify)< 10 * Point ())  {OnOrd= true ;}    
             if ( MathAbs ( OrderStopLoss ()-priceModify)< 10 * Point ())   {OnSL= true ;}
             if ( MathAbs ( OrderTakeProfit ()-priceModify)< 10 * Point ()) {OnTP= true ;}
             if (OnOrd || OnSL || OnTP) {TicketModifyOrder= OrderTicket ();}
             if (OnOrd) {OnOrd= false ; return ;}
           }
        }  
     }  
   if (TicketModifyOrder> 0 )
     {
       if ( OrderSelect (TicketModifyOrder, SELECT_BY_TICKET ))
        {
         bool typOrdBuy = OrderType ()== OP_BUY   || OrderType ()== OP_BUYSTOP   || OrderType ()== OP_BUYLIMIT ;
         bool typOrdSell= OrderType ()== OP_SELL || OrderType ()== OP_SELLSTOP || OrderType ()== OP_SELLLIMIT ;
         if (!OnOrd && !OnSL && !OnTP)
           {
             if (typOrdBuy)
              {
               sl = NormalizeDouble (priceModify, Digits );
               tp = NormalizeDouble ( OrderOpenPrice ()+Ktp*( OrderOpenPrice ()-sl), Digits );
              }
             if (typOrdSell)
              {
               sl = NormalizeDouble (priceModify, Digits );
               tp = NormalizeDouble ( OrderOpenPrice ()-Ktp*(sl- OrderOpenPrice ()), Digits );
              }
            }    
             if (OnSL) {sl= NormalizeDouble (priceModify, Digits );tp= OrderTakeProfit ();}
             if (OnTP) {tp= NormalizeDouble (priceModify, Digits );sl= OrderStopLoss ();}
                                                             
            ModifyOrder1(- 1 , sl, tp, 0 ); 
             if (OnSL || OnTP) {TicketModifyOrder= 0 ;} 
        }           
     }  
 }
 

Bugün test cihazında bir stratejiyi test ettim. Uygulama, 2 sabite ayarlama yaparsanız sl ve tp'yi taşımanın daha uygun olduğunu göstermiştir.

Burada:

...

if ( MathAbs ( OrderOpenPrice ()-priceModify)< 10 * Point ())  {OnOrd= true ;}    
if ( MathAbs ( OrderStopLoss ()-priceModify)< 30 * Point ())   {OnSL= true ;}
if ( MathAbs ( OrderTakeProfit ()-priceModify)< 30 * Point ()) {OnTP= true ;}
if (OnOrd || OnSL || OnTP) {TicketModifyOrder= OrderTicket ();}
if (OnOrd) {OnOrd= false ; return ;}

...



 
Yardımın için teşekkürler. Yardım etti. Test cihazında siparişlerin nasıl açılacağını arıyordum. Küresel değişkenler aracılığıyla. Göstergenin grafiğe asılması gerektiği sadece elverişsizdir.