批量追踪止损
//+------------------------------------------------------------------+//+------------------------------------------------------------------+ 追踪止损
void move_sl()
{
int total=OrdersTotal();
for(int i=0; i<total; i++)
{
if(OrderSelect(i, SELECT_BY_POS))
{
if(OrderSymbol()==Symbol()&& OrderMagicNumber()==识别码3)
{
if(OrderType()==OP_BUY)
{
if(NormalizeDouble(Bid-OrderOpenPrice(),Digits)>=追踪止损启动点数*Point)
{
if(OrderStopLoss()>OrderOpenPrice() && OrderStopLoss()<OrderClosePrice()-追踪止损点数*Point)
{
bool res22=OrderModify(OrderTicket(), OrderOpenPrice(), OrderClosePrice()-追踪止损点数*Point, OrderTakeProfit(), 0);
}
}
}
if(OrderType()==OP_SELL)
{
if(NormalizeDouble(OrderOpenPrice()-Ask,Digits)>=追踪止损启动点数*Point)
{
if((OrderStopLoss()==0 || OrderStopLoss()>OrderClosePrice()+追踪止损点数*Point) && OrderStopLoss()<OrderOpenPrice())
{
bool res11=OrderModify(OrderTicket(), OrderOpenPrice(), OrderClosePrice()+追踪止损点数*Point, OrderTakeProfit(), 0);
}
}
}
}
}
}
}
页:
[1]