描述:夜盘/日次开盘n分钟不交易,夜盘/日次尾盘n分钟不交易
也就是把黑框中的时间段给剔除了。
[PEL] 复制代码 //夜盘/日次开盘
time_:=time;
open1:=t0totime(timetot0(opentime(1))+nmin1*60);
open2:=t0totime(timetot0(opentime(2))+nmin1*60);
not_tradeopen1:=time_>=opentime(1) and time_<=open1;
not_tradeopen2:=time_>=opentime(2) and time_<=open2;
//夜盘/日次尾盘
close1:=t0totime(timetot0(closetime(1))-nmin2*60);
close2:=t0totime(timetot0(closetime(4))-nmin2*60);
not_tradeclose1:=time_>=close1 and time_<=closetime(1);
not_tradeclose2:=time_>=close2 and time_<=closetime(4);
//不交易时段
tradetime:=not(not_tradeopen1 or not_tradeopen2 or not_tradeclose1 or not_tradeclose2);
代码还是挺长的,但比较整洁,较容易维护。
提问:
1.上述代码还有那些需要修改的地方?
2.请问,有更简单更直观的写法吗?(保证运行效率)
|