我也找了半天,就是不会搞
http://www.weistock.com/bbs/dispbbs.asp?BoardID=4&ID=2183&skin=0
简单的方法?读取全局变量是一个很好用的方法,不要因为不理解,就觉得难
如果K线将要走完,直接延续到下根K线
就是说不管K线是否走完,只要出了信号,就开始计时,到时间下单可以实现吗?谢谢
我建议用固定轮询 1秒,信号出来未走完k线,提前N秒下单,启用自动持仓同步
//N秒再下单 不需要信号确认
//红色所列为重点
ss:=1;
sec:=2;//2秒后下单
ma5:=ma(c,5);
ma20:=ma(c,20);
buycond:=cross(ma5,ma20);
sellcond:=cross(ma20,ma5);
//平多信号
if sellcond and extgbdata('selltime')=0 then
begin
extgbdataset('selltime',DYNAINFO(207));//记录平多信号出现时间
end
//平多下单
if TIMETOT0(DYNAINFO(207))>=TIMETOT0(extgbdata('selltime'))+sec then
begin
tsell(1,ss,mkt);
extgbdataset('selltime',0);
end
//开多信号
if buycond and extgbdata('buytime')=0 then
begin
extgbdataset('buytime',DYNAINFO(207));//记录开多信号出现时间
end
//开多下单
if TIMETOT0(DYNAINFO(207))>=TIMETOT0(extgbdata('buytime'))+sec then
begin
tbuy(1,ss,mkt);
extgbdataset('buytime',0);
end