以文本方式查看主题 - 金字塔客服中心 - 专业程序化交易软件提供商 (http://weistock.com/bbs/index.asp) -- 公式模型编写问题提交 (http://weistock.com/bbs/list.asp?boardid=4) ---- 反手开仓 (http://weistock.com/bbs/dispbbs.asp?boardid=4&id=63251) |
-- 作者:vagary -- 发布时间:2014/3/28 14:37:02 -- 反手开仓 我现在想编写一段反手的代码! 5日均线上穿10日均线做多,下穿反手做空,再上穿就直接平仓不再开仓! 求大神指教!
|
-- 作者:jinzhe -- 发布时间:2014/3/28 14:49:42 -- ma5:ma(c,5); ma10:ma(c,10); variable:n=0; if cross(ma5,ma10) and holding=0 and n=0 then begin buy(holding=0,1,market); n:=1; end
if cross(ma10,ma5) then begin sell(holding>0,1,market); buyshort(holding=0,1,market); end
if cross(ma5,ma10) and holding>0 and n=1 then begin sellshort(holding<0,1,market); end [此贴子已经被作者于2014/3/28 14:50:57编辑过]
|