This will get you started, if it's running on the PC and you trade off phone / tablet it'll still work, version that moves is being tweaked at the moment, send that over later.
extern string Product="Overwatch V2.16 - 24Esma 0.04%";
extern double MinStopLoss=8;
extern double MaxStopLoss=12;
int start()
{
if(OrdersTotal()>0){
for(int i=1; i<=OrdersTotal(); i++)
{
if (OrderSelect(i-1,SELECT_BY_POS)==true)
{
if((OrderType()==OP_BUY)&&(OrderStopLoss()==0)&&(OrderSymbol()==Symbol())) {
RefreshRates();
double slb=NormalizeDouble(iMA(NULL,0,24,0,MODE_EMA,PRICE_MEDIAN,0)*0.9996,Digits);
double sla=Bid-slb;
if (sla<MinStopLoss){
slb=NormalizeDouble(Bid-MinStopLoss,Digits);
}
if (sla>MaxStopLoss){
slb=NormalizeDouble(Bid-MaxStopLoss,Digits);
}
OrderModify(OrderTicket(),0,slb,0,0,CLR_NONE);
}
if((OrderType()==OP_SELL)&&(OrderStopLoss()==0)&&(OrderSymbol()==Symbol())) {
RefreshRates();
double sls=NormalizeDouble(iMA(NULL,0,24,0,MODE_EMA,PRICE_MEDIAN+Ask-Bid,0)*1.0004,Digits);
double slc=sls-Ask;
if (slc<MinStopLoss){
sls=NormalizeDouble(Bid+MinStopLoss+Ask-Bid,Digits);
}
if (slc>MaxStopLoss){
sls=NormalizeDouble(Bid+MaxStopLoss+Ask-Bid,Digits);
}
OrderModify(OrderTicket(),0,sls,0,0,CLR_NONE);
}
}
}
}
int Error=GetLastError();
if(Error==130){Alert("Wrong stops. Retrying."); RefreshRates();}
if(Error==133){Alert("Trading prohibited.");}
if(Error==2){Alert("Common error.");}
if(Error==146){Alert("Trading subsystem is busy. Retrying."); Sleep(500); RefreshRates();}
return(0);
}