My EA moves TP but sets SL to 0 why?

 

in this EA my problem is that it moves the TP but doesn`t set  the SL and in the journal the value for stoploss is ZERO please help me with this.

//+------------------------------------------------------------------+

//| Expert tick function                                             |

//+------------------------------------------------------------------+

void OnTick()

  {


Calculations ();

ModifyOrders ();


  }

//+------------------------------------------------------------------+

void Calculations () 

{

TMA_Middle  = iCustom(Symbol(),0,"!   mth_FastTMALine",TimeFrame,61,Price,3,110,TrendThreshold,ShowCenterLine,alertsOn,alertsMessage,alertsSound,alertsEmail,MoveEndpointEveryTick,MaxBarsBack,0,1);

TMA_Upper   = iCustom(Symbol(),0,"!   mth_FastTMALine",TimeFrame,61,Price,3,110,TrendThreshold,ShowCenterLine,alertsOn,alertsMessage,alertsSound,alertsEmail,MoveEndpointEveryTick,MaxBarsBack,1,1);

TMA_Lower   = iCustom(Symbol(),0,"!   mth_FastTMALine",TimeFrame,61,Price,3,110,TrendThreshold,ShowCenterLine,alertsOn,alertsMessage,alertsSound,alertsEmail,MoveEndpointEveryTick,MaxBarsBack,2,1);

TMA_TG      = iCustom(Symbol(),0,"!   mth_FastTMALine",TimeFrame,61,Price,3,110,TrendThreshold,ShowCenterLine,alertsOn,alertsMessage,alertsSound,alertsEmail,MoveEndpointEveryTick,MaxBarsBack,3,1);

TMA_TR      = iCustom(Symbol(),0,"!   mth_FastTMALine",TimeFrame,61,Price,3,110,TrendThreshold,ShowCenterLine,alertsOn,alertsMessage,alertsSound,alertsEmail,MoveEndpointEveryTick,MaxBarsBack,4,1);

TMA_TS      = iCustom(Symbol(),0,"!   mth_FastTMALine",TimeFrame,61,Price,3,110,TrendThreshold,ShowCenterLine,alertsOn,alertsMessage,alertsSound,alertsEmail,MoveEndpointEveryTick,MaxBarsBack,5,1);


TMA_BU      = iCustom(Symbol(),0,"!   mth_FastTMALine",TimeFrame,61,Price,1,110,TrendThreshold,ShowCenterLine,alertsOn,alertsMessage,alertsSound,alertsEmail,MoveEndpointEveryTick,MaxBarsBack,1,1);

TMA_BL      = iCustom(Symbol(),0,"!   mth_FastTMALine",TimeFrame,61,Price,1,110,TrendThreshold,ShowCenterLine,alertsOn,alertsMessage,alertsSound,alertsEmail,MoveEndpointEveryTick,MaxBarsBack,2,1);



StopLoss  = iSAR(Symbol(),0,0.02,0.2,1);                     


}    


//+-------------------------------------------------------------------+

void ModifyOrders ()

{

   for(int a=OrdersTotal()-1; a >= 0; a--)

{

      if (OrderSelect(a,SELECT_BY_POS,MODE_TRADES))

            if (OrderSymbol()==Symbol())

               if (OrderType()==OP_BUY)

                  if (TMA_TG != 2147483647.0)

                  if (!OrderModify(OrderTicket(),OrderOpenPrice(),StopLoss,TMA_Upper,0,CLR_NONE))

                        Print("OrderModify error ",GetLastError());

                     }

   for(int b=OrdersTotal()-1; b >= 0; b--)

{

      if (OrderSelect(b,SELECT_BY_POS,MODE_TRADES))

            if (OrderSymbol()==Symbol())

               if (OrderType()==OP_BUY)

               if (TMA_TR != 2147483647.0)

                  if (!OrderModify(OrderTicket(),OrderOpenPrice(),StopLoss,TMA_BL,0,CLR_NONE))

                        Print("OrderModify error ",GetLastError());

                     }

   for(int c=OrdersTotal()-1; c >= 0; c--)

{

      if (OrderSelect(c,SELECT_BY_POS,MODE_TRADES))

            if (OrderSymbol()==Symbol())

               if (OrderType()==OP_BUY)

               if (TMA_TS != 2147483647.0)

                  if (!OrderModify(OrderTicket(),OrderOpenPrice(),StopLoss,TMA_BU,0,CLR_NONE))

                        Print("OrderModify error ",GetLastError());

                     }

   for(int d=OrdersTotal()-1; d >= 0; d--)

{

      if (OrderSelect(d,SELECT_BY_POS,MODE_TRADES))

            if (OrderSymbol()==Symbol())

               if (OrderType()==OP_SELL)

               if (TMA_TG != 2147483647.0)

                  if (!OrderModify(OrderTicket(),OrderOpenPrice(),StopLoss,TMA_BU,0,CLR_NONE))

                        Print("OrderModify error ",GetLastError());

                     }                                                               

   for(int e=OrdersTotal()-1; e >= 0; e--)

{

      if (OrderSelect(e,SELECT_BY_POS,MODE_TRADES))

            if (OrderSymbol()==Symbol())

               if (OrderType()==OP_SELL)

               if (TMA_TR != 2147483647.0)

                  if (!OrderModify(OrderTicket(),OrderOpenPrice(),StopLoss,TMA_Lower,0,CLR_NONE))

                        Print("OrderModify error ",GetLastError());

                     }

   for(int f=OrdersTotal()-1; f >= 0; f--)

{

      if (OrderSelect(f,SELECT_BY_POS,MODE_TRADES))

            if (OrderSymbol()==Symbol())

               if (OrderType()==OP_SELL)

               if (TMA_TS != 2147483647.0)

                  if (!OrderModify(OrderTicket(),OrderOpenPrice(),StopLoss,TMA_BL,0,CLR_NONE))

                        Print("OrderModify error ",GetLastError());

                     }

}

Reason: