no position  
 //Setorder(OP_SELL,mlot,Bid,3,Bid+StopLoss*Point,Bid -TakeProfit*Point,Gold);  
 //+------------------------------------------------------------------+  
 Digits    //----    "   sell   <-    
 SetArrow    ZZ0=    "   NormalizeDouble   StopLoss    
 "  
 "    Symbol    !=   (   =   ,   "    Symbol    blokb   =   ()   ZZ2   <-    10000    &&   =   cci0   1   "    Sculp_BUY    &&   ())   30   )   ObjectSet    (    [   ,   0   ,   0   ;   ]   ;   )   0   ,   }   {   ;   =   cci0   Symbol   1   >   nimp   "   +   1   ||   OrderSend   0   0   ;   ()   +   ()   1   Impuls=   ((   ,   <   nimp   ,   bsb   ,   0   ((   k1   -   ZZ3   ,   =   ,   ssum   0   k2   >   ,   {   NULL   s   "  
 "    Sculp_Sell   0.1   Digits    0   k2   ZZ0=   cci1   ;   ,   ,   ;   0   (   242   ]   0   (   ,   nimp   150   (   0   )   )   Ask   *   cci0   (   )   5   imp   ,   ssum   *   *   ssum   imps   if   nimp   deviation   ,   )   mlot   ;   ==   {   =   ;   0   (   150   //{   *   )   (   mlot   (   Lots   NULL   ==   \n   ,   imp   NULL   -   cci0   Ask   >    1   ;   ,   0   nimp   cci0   j   }   ;   s   {   cci0   if   0   Lots   0   ;   Bid   ;   >   =   1   d   300   ,   ,   =   >   OP_BUY   0   *   ,   <-   >   ,   ssum   c   =   (   )   0   ,   d   ,   ;   (   >   nimp   return  
 If iZigZag line is down - buy now  
 buy signal  
 For normal work you must have 2000$ for your account to journal  
 //  && nimp>0  
 // d     - number of position and set hedge order of full periods when calculating  
 //   && cci0 && cci1>0  
 //add to buy position when profit > 30  
 // porog - cut-off takeprofit when closing positions out  
 //+------------------------------------------------------------------+  
 //alow 2nd lev hedge  
 // k1 & k2 - multiplier for sizes of //    if ((ZZ2==0 && ZZ3==0)     //signal of hedge orders of 1st and 2nd level  
 //Setorder(OP_BUY,mlot,Ask,3,Ask-StopLoss*Point,Ask+TakeProfit*Point,Gold);  
 //Setorder(OP_BUY,mlot,Ask,3,Ask-StopLoss*Point,Ask+TakeProfit*Point,Gold);  
   per    Symbol   ,   <-    ,   0   Point    wpr0   }   (    *   2   OP_SELL    ==   b    
   =  
    Point   2   Digits   "   IsTesting   ,   &&   ,   ,   mlot   0   "   0   "   StopLoss   OrderType   0.01   TakeProfit   if   ==   ,   0   "   b   porog   summa   "   0   //if (!IsTesting())   +   bsum   ,   12   "   ,   <-   IsTesting   Point   ()   &&   0   ;   nimp   ,   imp  
 //+------------------------------------------------------------------+  
 //|                                            GoldWarrior02bMT4.mq4 |  
 //|                                                                  |  
   ())    Point   -   
   ,  
 extern  
    &&   per   //have open trades   s   <-   &&   "   0   =   ,    Ask   "   blok   0   TakeProfit   =   down   =    Digits   <   {   if   +   <    0   0.01   3   Ask   ,    )   *   ==   200   ;   =   ,    *   bsb   ()   "   Lots    Lots   >   =   ZZ2   ,    cnt   ()   1   ==   ,   1   (   
      ;  
       ,    ,   ,   "   ZZ2    OrderType   0   "   //wpr1=iWPR(NULL,0,per,1);   extern   ,   CCI0=   <   Symbol   3   "   //  && cci0>cci1   OrderType   imp   ZN   summa   <   *   ssum   {   nimp  
      ,    1   ,   ()   =   LastTradeTime   &&   ,   (   =   ,   
      -  
       (    )   0   return   150    OP_SELL   60   OrderSend   //   if ((ZZ3!=0 || ZZ2!=0) //sell signal   double   0   ,   OP_SELL   1   <   )   if   ,  
    ssum   ()   bloks   ZZ1=   30   mlot   ,   ,   backstep   deviation   "   s   0   ,   nimp   ;   =   (   mlot   =   ;   if    ;   ssum   =   CCI0=   ;    k1   =   ;   )   0   j   "   ()))   mlot   ()   ,   >   "   ticket   Yellow   >   +   (   (   -   cci0   (   ;   imps   ))   k1    ,   0   ++   <-   ;    1   )   cci0   )   ==   0   Point   impb   b   21   *   ,   extern   Arrow   Arrow   Ask   Symbol   =   OrderSend   nimp   iCustom   ,   {   =   ,   ;   ,   ,   30   OP_BUY   imp   0   imp   =   )   OrderSend   //----   "   =   StopLoss   nimp   "   ,   OrderSend   ,   =   =   j   *   \n   // set 2nd lev. hedge for sell position  
    //  && cci0<0  
    +   *   ,   0   ZZ3   ,   cci1   int   ||   cci0   //current loss   (   =   0   ,   ,   ,   1   ,   if   cci0   (   bsb   =   ;   //porog=100;   )   <   Bid   if   //   && imp>0)  
    //alow 2nd lev hedge  
    ;    >   ()   int   1   (   0   ,   ,   1   &&   =   )   ,   ==   OrderSymbol   (   0   =   &&   =   =   ||   OrderProfit   ,   blok   ||   AccountBalance   150   ,   ==   {   ,   ,   ;   ;   )   &&   t   for   ;   &&   cci0   sbo   =   &&   >   0   {   ;   
           ((  
       //    || (imp<=imps && imp>=impb))  
       //add to // depth,deviation,backstep - ZigZag indicator parameters  
       //   && cci0>0  
       // k2/k1=2 - must be!  
       //allow open hedge 2nd level  
       Symbol  
       Sculp_BUY   !   +   (   ||   3   ;   cnt   0   0   [   0   (   ;   summa   0   =   +   &&   3   ;   if   (   s   1   NormalizeDouble  
       ObjectSet   50   StopLoss   ,   <-   ;   NormalizeDouble   =   50   k1   StopLoss   ;   imp   <-   (   Yellow   ,   NormalizeDouble   3   j   ,   double   ,   ,   <-   OrderSend   "   1   NormalizeDouble   Bid   Ask   =   return   )   (   Symbol   ZigZag   "   Lots   NormalizeDouble   2   ]   //}   "   ,   ,   "   }   "   [   "   //  if ((ZZ3!=0 || ZZ2!=0) //buy signal   Point   150   )   *  
    imp    (   sbo   {   =   =   0.01   j   ,   cci1   SELECT_BY_POS   =-   *   ((   =   &&   ||   "   ))   OrdersTotal   ;   IsTesting   =   Sculp_Sell   ,   ==   >   &&   ()   )   ,   ()   0   >   ;   "   ZZ1=   &&   {   ;   =   &&   =   "   )   PRICE_CLOSE   {   0   ,   bsum   
           =  
       //set hedge 1st level for sell position  
       //allow open hedge 2nd level  
       //   && nimp<0  
       Increase K2 is normal work!  
       K2 must be not less than 2*K1  
       //wpr0=iWPR(NULL,0,per,0);  
       50  
       OrderSend   if   ZZ3   Lots   ,   s   ,   ==   ()   if   )   ,   =   ZM   backstep   nimp   b   >   =   =   nimp   *   >   s   )   www.forex-tsd.com  
       Sculp_BUY   mlot   OP_BUY   0   "   1   NormalizeDouble   =   Lots   =   deviation   (   >   "   mlot   "   (   //if (!IsTesting())   mlot   ))   0   "   ()   =   Symbol   ticket   return   void   //buy trade profit   =   <   =   "   0   p   double   Point   //----   )   NormalizeDouble   \n   c   0   depth   =   3   Point   (   summa   0   "   //set hedge 1st level for buy pos.   start   0   150   >  
      0    =   ;   ())   int   TakeProfit   )   ,   100   )   ,   ,   (   ;   (   ==   ,   0   Bid   &&   ,   int   b   ,   
      ==  
       //+------------------------------------------------------------------+  
       //    || sbo!=0            //signal of having open orders  
       // test  - current info output flag, 1 - output on 1st level  
       "  
       ()   ||   ,   =   NormalizeDouble  
       ;   ,   ==   imp   &&  
       bsum    =   cci1   Comment   ,    copyright   ,   "   ,   "   (   NormalizeDouble   )   ;   bsum   Digits   Time   )))   <-   ZZ2   Comment   ,   Signals are absent   ;   ;   k2   OP_SELL   )   (   ticket   "   //----   1   OBJPROP_ARROWCODE   )   ,   t   "   ;   ;   Digits   Symbol   Digits   Lots   //have open buy   }   =   (   Impuls=   50   bsig   ZigZag   per   Point   ,   "   GlobalVariableGet   Comment   (   )   -  
    =   1   *   ;   ;   ,   >   0   1   +   ,   ;   OP_SELL   s   (   s   ,   0   )   ,   )   ,   =   ,   ,   ssig   nimp   0   ,   ;   (   ,   &&   }   ==   cci1   ,   ]   
      0  
         3    sbo   OrderSymbol   ,   mgod   0   &&   1   &&   {   
         0  
          *    ,   MODE_TRADES   ;   ,   "   ;    ))   impb   ,   =   ,   korb   NormalizeDouble  
            =    ,   Point   (   ,   Point   &&   OBJPROP_PRICE1   (   ,   "   >   =   )   Yellow   1   ,   OP_BUY   TakeProfit   PRICE_CLOSE   )   ,   "   ,    k1  
             "   bsig   DayImpuls   ,   &&   )   ==   // profit for open trade  
            0  
            }    ;   "   )   ,   Arrow   &&   //disallow buy   0   50   "   ;   
            if  
             ())   ()   ,   mlot   blok   30   //  && cci1<0  
             Bid   +   =   >   &&   ,   ))   //sell trade profit  
            ,  
            ;    if   Symbol   ;   k2   "   LastTradeTime   &&   bsb   ;   "   ,    
            kors  
             (   nimp   mlot   2   mlot   Lots   NormalizeDouble  
             ZZ3   )   ;   ;   OrderSymbol   (   (   //disallow sell  
            per  
         )  
      ,  
      *    >   ,   0   0.01   ()   
      =    // impb  - negative impulse value for buy signal  
       0    ,   per   imp   1   OrderSymbol   Point   ()   cci0    //cci1=iCCI(NULL,0,per,PRICE_CLOSE,0);   &&   ,   )   Ask   OrderSelect   <   (   ;   GreenYellow   ,   {   )   {     
                 Ask  
          ;   (   Ask   ,   }   s   ==    ticket   1   ticket   50   iCustom   50   cci1   return   cnt   0   Bid   30   =   nimp   bsb   1   mlot   double   ,   Impuls=   ,   ==   bsb   OBJPROP_TIME1   !   SetArrow   0.01   "   Sculp_Sell   Digits   if   NULL   )   ()   0   ticket   ,   +   1   <   >   )   //разрешение на открытие хеджа второго уровня  
          ,   nimp   30   ;   //разрешение на открытие хеджа второго уровня  
          #property   ==   cci1   ;   1   ==  
       b    bsig   ||   ZZ2   ,    //add for all indicators   &&   return   ,   b   &&   p   summa   ,   &&   0.01   double   0   &&   =   ||   =   ,  
                 =  
          )   )   0   {   s   ,   return   >   "   ;   <-   ,   0   ObjectSet   50   =   ,   =   ,   2500   =   )   )   "   =   "   (   ,   -   LastTradeTime   ;   extern   ,   "   "   "   ,   =   ((   iCCI   (   summa   Bid   ,   //+------------------------------------------------------------------+  
          ,   1   =   1   // set 2nd level hedge  
          =   =   (   k1   double   150   0   ==   int   0  
       =    (   blok   =   s    If iZigZag line is up - sell now   &&   <-   "   (   &&   ,   Point   mlot   &&   }   iCustom   Ask   &&   (   -   -   ,  
                 1  
          ,   )   +   ,   if   ;   "   imp   Yellow   =   OP_SELL   ()   blok   "   1   }   0   (((   ,   cci1   ,   ()   ,   "   (   summa   ,   ,   d   &&   blok   Digits   =   Digits   "   ticket   *   (   150   {   >   summa   ZZ2   =   //+------------------------------------------------------------------+  
          1   200   Time   if   // mgod  - testing year  
          <   (   ||   ,   "   <   =   >   ZZ2   ;  
       1  
       cci0    *   ,   =   ZZ3    Goldwarrior02b.mq4 - MQL4 Code Base to //set hedge 1st level for position when profit > 30   LastTradeTime   <-   OrderSend   0   &&   b   ==   0   TakeProfit   (   bsb   =   &&   }   0   =   }     
                 ZZ3  
          nimp   ((   bsum   ;   [   ;   Yellow   1000   OP_BUY   ,   CCI0=   ;   +   OrderType   mgod   nimp   0   ;   mlot   ==   ))   ,   ZZ2   Yellow   Year   #property   0   =   bsum   OrderProfit   )   10000   =   Symbol   &&   Point   ==   )   ,   k1   50   return   sbo   High   ,   ,   ()   !   //alow 2nd lev hedge  
          ,   >   =   imp   //allow open 2nd level hedge  
          "   ,   (   ,   ,   ssig  
       Gold    0   imp   ZZ3   >    // imps  - positive impulse value   OBJPROP_COLOR   iCustom   if   )   OrderSymbol   nimp   ticket   {   &&   0   datetime   +   &&   0   if   k   ,  
                 ,  
          ())   ;   ;   ||   (   +   SetArrow   )   backstep   (   return   !=   mlot   color   ,   }   ()   ZZ1=   sbo   imp   <   0   =   summa   ,   OP_BUY   blok   ,   0   &&   ;   CurTime   ,   extern   "   Symbol   if   ,   {   ,   1   "   (   )   ;   b   ,   <   //alow 2nd lev hedge  
          0   ,   0   1   Copyright © 2005, Nick Bilak  
          DayImpuls   nimp   Low   wpr1   =   >  
       50    ,   <   0.30   )   OrderProfit   Arrow   30   (((   TakeProfit   Bid   (   ==   Sculp_Sell   NULL   5   ())   &&   )   ;   }   if  
                 =  
          b   Bid   ;   nimp   1   ())   "   =   "   b   <-   5   )   <=   ()   0   *   (   imp   (   bsb   if   2005   return   ()))   depth   ,   pm   )   &&   ssig   "   0   Comment   &&   double   cci0   mlot   k1   if   bsum   Point   3   >   1   )   0.15   100   //wpr1=iWPR(NULL,0,per,0);  
          ,   =   cci0   NULL   //alow 2nd lev hedge  
          StopLoss   =   ,   =   (   ,  
      nimp  
    )    {   \n   )   )    //  && imp<0)   &&   (   *   ;   <   ,   StopLoss   ,   &&   "   ObjectSet   imp     &&   TakeProfit   =   ==   =   0  
              *      //alow 2nd lev hedge of //open trade  
       // per   - period  
         (   cci1   )   s   ZZ3   &&   ZZ0   30   ((   (   *   30   if   (   )   ;   cci0   2000   =   &&   0   ,   ;   0   &&   *   ==   ==   &&   (   sbo   ;   &&   =   0   =   &&   ,   ,   if   (  
         k  
          ;   )   ,   (   Bid   ,   "   0   10000   Bid   Digits   ,   ,   "   =   +   ,   cci1   ,   3   iCCI   }   if   //   {   )   depth   )   ,   if   &&   150   "   15   Point   &&   "   1   ,   0   imp   imp   Comment   }   cci0   //|                                                                  |  
          ,   ==   ;   1   TakeProfit  
          //    {   if   )   <   )   bsb  
         link   }   ;   >   ,   &&   nimp   (   {   if   test   )   {   blok   0   ;   (   ZZ0=   }   &&   nimp   (   0   ;   &&   >   Bid   cci0   &&   )   =   ,   TrailingStop   (   Digits   (   &&   ,   StopLoss   b   241     
         cci1  
          <   ,   ,   )   ,   cnt   Yellow   (   summa   }   summa   )   ,   "   blok   b   ==   (   cnt