获取某个时间后开仓的订单
- 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[0]-_opentime))>0) return(true);
- else return(false);
- }
|