void buyxiugaisl(double sl) //修改BUY单的止损
{
for (int i=0;i<OrdersTotal();i++)
{
if (OrderSelect(i,SELECT_BY_POS,MODE_TRADES)==true)
{
if ( OrderSymbol()==Symbol()&& OrderType()==OP_BUY && OrderMagicNumber()==magic)
{
if(NormalizeDouble(OrderStopLoss(),Digits)!=NormalizeDouble(sl,Digits))
{
bool OM;
OM=OrderModify(OrderTicket(),OrderOpenPrice(),sl,OrderTakeProfit(),0,Green);
}
}
}
}
}
void sellxiugaisl(double sl) //修改SELL单的止损
{
for (int i=0;i<OrdersTotal();i++)
{
if (OrderSelect(i,SELECT_BY_POS,MODE_TRADES)==true)
{
if ( OrderSymbol()==Symbol()&& OrderType()==OP_SELL && OrderMagicNumber()==magic)
{
if(NormalizeDouble(OrderStopLoss(),Digits)!=NormalizeDouble(sl,Digits))
{
bool OM;
OM=OrderModify(OrderTicket(),OrderOpenPrice(),sl,OrderTakeProfit(),0,Green);
}
}
}
}
}
- void buyxiugaisl(double sl) //修改BUY单的止损
- {
- for (int i=0;i<OrdersTotal();i++)
- {
- if (OrderSelect(i,SELECT_BY_POS,MODE_TRADES)==true)
- {
- if ( OrderSymbol()==Symbol()&& OrderType()==OP_BUY && OrderMagicNumber()==magic)
- {
- if(NormalizeDouble(OrderStopLoss(),Digits)!=NormalizeDouble(sl,Digits))
- {
- bool OM;
- OM=OrderModify(OrderTicket(),OrderOpenPrice(),sl,OrderTakeProfit(),0,Green);
- }
- }
-
- }
-
- }
- }
-
-
- void sellxiugaisl(double sl) //修改SELL单的止损
- {
- for (int i=0;i<OrdersTotal();i++)
- {
- if (OrderSelect(i,SELECT_BY_POS,MODE_TRADES)==true)
- {
- if ( OrderSymbol()==Symbol()&& OrderType()==OP_SELL && OrderMagicNumber()==magic)
- {
- if(NormalizeDouble(OrderStopLoss(),Digits)!=NormalizeDouble(sl,Digits))
- {
- bool OM;
- OM=OrderModify(OrderTicket(),OrderOpenPrice(),sl,OrderTakeProfit(),0,Green);
- }
- }
-
- }
-
- }
- }
复制代码
|