//交易系统
if aa+bb+cc+dd+ee+ff>0 and aaa+bbb+ccc+ddd+eee>=0 and todaybar=1 and HOLDING=0 then buy(1,ss,limitr,open+MINDIFF);
if aa+bb+cc+dd+ee+ff<0 and aaa+bbb+ccc+ddd+eee<=0 and todaybar=1 and HOLDING=0 then buyshort(1,ss,limitr,open-MINDIFF);
//平仓
if aa+bb+cc+dd+ee+ff>0 and aaa+bbb+ccc+ddd+eee>=0 and todaybar=1 and HOLDING>0 then sell(1,ss,THISCLOSE);
if aa+bb+cc+dd+ee+ff<0 and aaa+bbb+ccc+ddd+eee<=0 and todaybar=1 and HOLDING<0 then sellshort(1,ss,THISCLOSE);
要求次日开盘价开仓,收盘价平仓。
SetExitOnClose;金子塔没有收盘平仓这个函数
交易控制符使用 NEXTOPEN 即可实现下周期开仓,控制符THISCLOSE就是本周期收盘价交易指令。
上述方法对于测试很容易,但是实盘交易本周期收盘价入场这个有问题,因为只有当下跟K线生成时才能确定上根K线的收盘价的,因此你的测试可能与实盘交易有出入。
相关参考 http://www.weistock.com/bbs/dispbbs.asp?boardid=17&Id=159472
在日线如何在开盘开仓,收盘平仓? 关键收盘平,日线如何写
用固定时间间隔
if ref(kd,1) then buy();
if (currenttime>145800 and currenttime<150000) or not(islastbar) and pd then sell();
不是非常建议在图表上涉及一些会改变历史信号的函数,如果一定要用考虑上面这种方式处理