Hi,
please could someone tell me why the following code alters prices on other charts which the EA isn't attached to? it basically uses a moving average as a SL,
I thought the line "if (OrderSymbol() == Symbol())" made it chart specific?
thanks.
int totalorders = OpenOrders;
for(int i=OrdersTotal()-1;i>=0;i--)
{
OrderSelect(i, SELECT_BY_POS,MODE_TRADES);
if (OrderSymbol() == Symbol())
{
if ( OrderType() == OP_BUY )
{
sl=movavg;
OrderModify(OrderTicket(),OrderOpenPrice(),sl,OrderTakeProfit(),0,Green);
}
if ( OrderType() == OP_SELL)
{
sl=movavg+(Spread*10)*Point;
OrderModify(OrderTicket(),OrderOpenPrice(),sl,OrderTakeProfit(),0,Green);
}
}
}
//----
}
please could someone tell me why the following code alters prices on other charts which the EA isn't attached to? it basically uses a moving average as a SL,
I thought the line "if (OrderSymbol() == Symbol())" made it chart specific?
thanks.
int totalorders = OpenOrders;
for(int i=OrdersTotal()-1;i>=0;i--)
{
OrderSelect(i, SELECT_BY_POS,MODE_TRADES);
if (OrderSymbol() == Symbol())
{
if ( OrderType() == OP_BUY )
{
sl=movavg;
OrderModify(OrderTicket(),OrderOpenPrice(),sl,OrderTakeProfit(),0,Green);
}
if ( OrderType() == OP_SELL)
{
sl=movavg+(Spread*10)*Point;
OrderModify(OrderTicket(),OrderOpenPrice(),sl,OrderTakeProfit(),0,Green);
}
}
}
//----
}