How do I get a stop loss to follow a sma

 
How do I get a stop loss to follow a sma, new to mql4 and trying to figure this out
 
Use iMA to get the value of the sma and then use the value in an OrderModify() to modify the stoploss if applicable.