求教一思路编写问题,之前一工作人员给出的代码如下,经测试有误,再此请教
//////////////////////////////////
上一根K线的最高价与收盘价、最高价与开盘价价差大于等于10MD时,放空,开仓价格在涨停减去20MD,跌停加上20MD之间
tt:=(time>=090300 and time<145700);//交易时间
a1:=ref(h,1)-ref(o,1);
a2:=ref(c,1)-ref(o,1);
if tt then begin
buyshort (a1>=10*MinDiff and a2>=10*MinDiff and holding=0,1,limit,DYNAINFO( 54)-20*mindiff);
buyshort (a1>=10*MinDiff and a2>=10*MinDiff and holding=0,1,limit,DYNAINFO( 55)+20*mindiff);
end;
//开空
////////////////////////////////////
你回测试下,不能按照思路来触发
请发帖时注意板块分类,谢谢合作
你之前的发的贴子已经帮你转移到问题区
嗯,那请处理下,谢谢
我贴出较完整的代码
tt:=(time>=090300 and time<145700);//交易时间
a1:=ref(h,1)-ref(o,1);
a2:=ref(c,1)-ref(o,1);
a3:=ref(o,1)-ref(l,1);
a4:=ref(c,1)-ref(l,1);
if tt then begin
buyshort (a1>=10*MinDiff and a2>=10*MinDiff and holding=0,1,limit,DYNAINFO( 54)-20*mindiff);
buyshort (a1>=10*MinDiff and a2>=10*MinDiff and holding=0,1,limit,DYNAINFO( 55)+20*mindiff);
//开空
buy (a3>=12*MinDiff and a4>=12*MinDiff and holding=0 ,1,limit,DYNAINFO( 54)-20*mindiff);
buy (a3>=12*MinDiff and a4>=12*MinDiff and holding=0,1,limit,DYNAINFO( 55)+20*mindiff);
end//开多
我估计你是想在2个价格之间报单,这个逻辑是正确的
但是你现在的逻辑是我报单在2个价格之间,难不成区间之内的每个价格你都报单吗?逻辑出错了
所以我建议你用c 也就是收盘价在你要的2个价格之间,条件成立,用市价或者限价下单。