|
关于减仓,这个算法,对于0.01的单子无解啊
- //+------------------------------------------------------------------+
- //| 平1/3仓 |
- //+------------------------------------------------------------------+
- void close三分之一()
- {
- int cnt, total;
- total=OrdersTotal();
- for(cnt=total-1; cnt>=0; cnt--)
- {
- OrderSelect(cnt, SELECT_BY_POS, MODE_TRADES);
- double lot = NormalizeDouble(OrderLots() * 1/3, 2);
- if(OrderType()==OP_SELL && OrderSymbol()==Symbol() && OrderMagicNumber()==magic)
- {
- OrderClose(OrderTicket(),lot,Ask,3,CLR_NONE);
- }
- if(OrderType()==OP_BUY && OrderSymbol()==Symbol() && OrderMagicNumber()==magic)
- {
- OrderClose(OrderTicket(),lot,Bid,3,CLR_NONE);
- }
- }
- }
复制代码 |
|