Im not really sure what to do here.....Anyone can help me out by adding the codes in?
PHP Code
void DoModify1()
{
int atr=ATR(1);
for(int i=0;i<OrdersTotal(); i++)
{
RefreshRates();
bool b=OrderSelect(i,SELECT_BY_POS,MODE_TRADES);
if (!b) continue;
if (OrderSymbol()!=Symbol()) continue;
if (OrderMagicNumber()!=Magic) continue;
if (OrderType()==OP_BUY)
{
if(OrderStopLoss()==0)
{
double sl= OrderOpenPrice()-atr*myPoint*AtrPecSL;
OrderModify(OrderTicket(),OrderOpenPrice(),sl,OrderTakeProfit(),0,Red);
}
else if(OrderTakeProfit()==0 && ! IsClosePer)
{
double tp= OrderOpenPrice()+atr*myPoint*AtrPecTP;
OrderModify(OrderTicket(),OrderOpenPrice(),OrderStopLoss(),tp,0,Green);
}
else if(IsClosePer && OrderTakeProfit()!=0)
{
OrderModify(OrderTicket(),OrderOpenPrice(),OrderStopLoss(),0,0,White);
}
}
else if (OrderType()==OP_SELL)
{
if(OrderStopLoss()==0)
{
sl= OrderOpenPrice()+atr*myPoint*AtrPecSL;
OrderModify(OrderTicket(),OrderOpenPrice(),sl,OrderTakeProfit(),0,Red);
}
else if(OrderTakeProfit()==0 && ! IsClosePer)
{
tp= OrderOpenPrice()-atr*myPoint*AtrPecTP;
OrderModify(OrderTicket(),OrderOpenPrice(),OrderStopLoss(),tp,0,Green);
}
else if(IsClosePer && OrderTakeProfit()!=0)
{
OrderModify(OrderTicket(),OrderOpenPrice(),OrderStopLoss(),0,0,White);
}
}
}
}