Trailing Stop Problem

 
Hi 

I have a question regarding my trailing stop. So the trailing stop starts when my trades has reached 10 pips (100 points), but the problem is that my trailing stop sets the SL to +2pips, which is not enough, I want it to be at +5 pips. How can I include this in my MQL4 code? 

And that the Trailing stop changes automatically to 30 points instead of 100 points. After hitting the initial 100 points. 

Thank you

//+---------------------------------------------------------------------+
//|          Tral                                                       |
//+---------------------------------------------------------------------+
void tr()
  {
   double stop=MarketInfo(Symbol(),MODE_STOPLEVEL)+1;
   int cnt=OrdersTotal();
   for(int i=0; i<cnt; i++)
     {
      if(!OrderSelect(i,SELECT_BY_POS,MODE_TRADES))
         continue;
      else
         if(OrderSymbol()==Symbol() && OrderMagicNumber()==MagicNumber)
           {
            if(OrderType()==OP_BUY && Bid-(Traling)*Point>OrderOpenPrice())
              {
               double new_sl=NormalizeDouble(Bid-Traling*Point,Digits());
               if(new_sl>OrderStopLoss() || OrderStopLoss()==0)
                 {
                  if(new_sl<Bid-stop*Point)
                    {
                     bool check=OrderModify(OrderTicket(),OrderOpenPrice(),new_sl,OrderTakeProfit(),0,CLR_NONE);
                     if(!check)
                        Print("Trail modify StopLoss error : ",GetLastError());
                    }
                 }
              }
            if(OrderType()==OP_SELL && Ask+(Traling)*Point<OrderOpenPrice())
              {
               double new_sl_sell=NormalizeDouble(Ask+Traling*Point,Digits());
               if(new_sl_sell<OrderStopLoss() || OrderStopLoss()==0)
                 {
                  if(new_sl_sell>Ask+stop*Point)
                    {
                     bool check=OrderModify(OrderTicket(),OrderOpenPrice(),new_sl_sell,OrderTakeProfit(),0,CLR_NONE);
                     if(!check)
                        Print("Trail modify StopLoss error : ",GetLastError());
                    }
                 }
              }
           }
     }

 
Huvi Rap:
Hi 

I have a question regarding my trailing stop. So the trailing stop starts when my trades has reached 10 pips (100 points), but the problem is that my trailing stop sets the SL to +2pips, which is not enough, I want it to be at +5 pips. How can I include this in my MQL4 code? 

Thank you

show us your attempt trying to correct this problem you have by posting the relevant code and you may get help.

 
In future please post in the correct section
I will move this topic to the MQL4 and Metatrader 4 section.
 
Kenneth Parling:

show us your attempt trying to correct this problem you have by posting the relevant code and you may get help.

updated

 
Keith Watford:
In future please post in the correct section
I will move this topic to the MQL4 and Metatrader 4 section.

Sorry for that I'm new here

Reason: