平仓所有盈利的空单
extern int Profit=1;void start()
{
int slippage=3;
int ask, bid, open;
double point;
for (int i=OrdersTotal()-1; i>=0; i--)
{
if (!OrderSelect(i,SELECT_BY_POS,MODE_TRADES)) break;
if (OrderType()==OP_SELL)
{
point=MarketInfo(OrderSymbol(),MODE_POINT);
if (point==0) break;
ask=MathRound(MarketInfo(OrderSymbol(),MODE_ASK)/point);
open=MathRound(OrderOpenPrice()/point);
if (open-ask<Profit) continue;
OrderClose (OrderTicket(),OrderLots(),ask*point,slippage);
}
}
}
楼主分享一个1根K线下跌多少点的代码下不胜感激 有点复杂了,不是提供了一个直接获取当前订单盈利金额的方法么 mql4编程中文手册{:1_186:}
页:
[1]