ma5:ma(C,5);
ma30:ma(C,30);
多0:=cross(ma5,ma30);
多1:=ref(多0,1);
空0:=cross(ma30,ma5);
空1:=ref(空0,1);
时间:currenttime,linethick0;
多:=(多0 and islastbar=0) or (多1 and currenttime>=211500);
空:=(空0 and islastbar=0) or (空1 and currenttime>=211500);
if 多 and holding<=0 then
begin
sellshort(1,0,market),orderQueue;
buy(1,5,market),orderQueue;
end
if 空 and holding>=0 then
begin
sell(1,0,market),orderQueue;
buyshort(1,5,market),orderQueue;
end
为了试验currenttime 这个函数,特意出信号的当日晚上开盘后观察,结果currenttime升至211500以上时,并没发出单,不知何故?
我是实盘,用的图表交易,设定固定时间间隔,时间间隔设定为2秒(此设置从前其他盘中突破程序发单无问题),但上述语句并不发单,不知为何?(当时手中有多单,白天下穿出信号,夜盘开盘后应该时间上穿211500后下单才对)
是的,昨晚利用调试找出了问题。
还是不细心,只是觉得看着公式没问题,就来问了,如果仔细调试是能找到症结的。
再次感谢各位高手的帮助。