老周 发表于 2017-3-21 14:04:11

获取某个时间后开仓的订单

获取某个时间后开仓的订单

bool CheckAddPos () {
//return true if we can enter new position, or adding another one
int _num=0;
int _opentime=0;
bool _return=false;
for (int i=0; i<OrdersTotal(); i++) {
if (OrderSelect(i,SELECT_BY_POS)==true && OrderSymbol()==Symbol() && OrderType()<3
&& ((OrderMagicNumber()==MagicNumber) || MagicNumber==0)) {
_num++;
if (OrderOpenTime()>_opentime) _opentime=OrderOpenTime();
}
}
if (_num==0) return(true);
if (_num>0 && ((Time-_opentime))>0) return(true);
else return(false);
}

页: [1]
查看完整版本: 获取某个时间后开仓的订单