以文本方式查看主题 - 金字塔客服中心 - 专业程序化交易软件提供商 (http://www.weistock.com/bbs/index.asp) -- 交易策略发布专区 (http://www.weistock.com/bbs/list.asp?boardid=10) ---- [交易系统]红黑三兵 (http://www.weistock.com/bbs/dispbbs.asp?boardid=10&id=5056) |
-- 作者:z7c9 -- 发布时间:2011/1/29 10:40:04 -- [交易系统]红黑三兵 以下内容为程序代码:
1 runmode:0; 2 3 variable:myholding=0; 4 5 buycond:=ref(all(isup,3),1); 6 buyshortcond:=ref(all(isdown,3),1); 7 8 if myholding=0 and buycond then begin 9 lots:=cash(0)/(open*multiplier*0.1); 10 buy(1,lots,limitr,open); 11 myholding:=lots; 12 end 13 14 if myholding=0 and buyshortcond then begin 15 lots:=cash(0)/(open*multiplier*0.1); 16 buyshort(1,lots,limitr,open); 17 myholding:=-lots; 18 end 19 20 if myholding>0 and time=closetime(0) then begin 21 sell(1,myholding,limitr,close); 22 myholding:=0; 23 end 24 25 if myholding<0 and time=closetime(0) then begin 26 sellshort(1,myholding,limitr,close); 27 myholding:=0; 28 end [此贴子已经被作者于2011-10-3 11:30:44编辑过]
|