Help needed!!Stop lost indicator based on MA’s percentage

 
Hi all,
I am a beginner at coding and trying to write an percentage SL indicator of MA at mql4. The percentage (double) and MA period (int) will be changable. I take the percentage But i couldnt make it act as SL. Could anyone help me?
I want it act as picture. 
Thanx
P.S: computer is not with me so i couldnt post the code that i wrote. I will do when i can ASAP. 

 
Exphantom:
Hi all,
I am a beginner at coding and trying to write an percentage SL indicator of MA at mql4. The percentage (double) and MA period (int) will be changable. I take the percentage But i couldnt make it act as SL. Could anyone help me?
I want it act as picture. 
Thanx
P.S: computer is not with me so i couldnt post the code that i wrote. I will do when i can ASAP. 

ok.

//+------------------------------------------------------------------+
//|                                     HaskayafxTakeProfitEAV01.mq4 |
//|                        Copyright 2018, MetaQuotes Software Corp. |
//|                                             https://www.mql5.com |
//+------------------------------------------------------------------+
#property copyright "Copyright 2018, MetaQuotes Software Corp."
#property link      "https://www.haskayabilgi.com"
#property version   "1.00"
#property strict

input int MA=632;
//+------------------------------------------------------------------+
//| Expert initialization function                                   |
//+------------------------------------------------------------------+
int OnInit()
  {
//---
   
//---
   return(INIT_SUCCEEDED);
  }
//+------------------------------------------------------------------+
//| Expert deinitialization function                                 |
//+------------------------------------------------------------------+
void OnDeinit(const int reason)
  {
//---
   
  }
//+------------------------------------------------------------------+
//| Expert tick function                                             |
//+------------------------------------------------------------------+
void OnTick()
  {
//---
   
   StopUdate();
  }
//+------------------------------------------------------------------+


int StopUdate()
{
  int total = OrdersTotal();
  
  bool tck;
  double SLNew=iMA(NULL,0,MA,0,MODE_SMA,PRICE_CLOSE,0);
  SLNew=NormalizeDouble(SLNew,Digits);
  for(int i=total-1;i>=0;i--)
  {
   tck= OrderSelect(i, SELECT_BY_POS);
    int type   = OrderType();
   
    bool result = false;
      if(OrderSymbol()==Symbol()) tck=OrderModify(OrderTicket(),OrderOpenPrice(),SLNew,OrderTakeProfit(),0,CLR_NONE);
 
    
    
  }
  return(0);
}