以文本方式查看主题 - 金字塔客服中心 - 专业程序化交易软件提供商 (http://weistock.com/bbs/index.asp) -- 公式模型编写问题提交 (http://weistock.com/bbs/list.asp?boardid=4) ---- 模型编写问题 (http://weistock.com/bbs/dispbbs.asp?boardid=4&id=169180) |
-- 作者:jzt666 -- 发布时间:2019/4/4 8:55:43 -- 模型编写问题 老师帮我写个模型: 5均线10均线金叉再等K线走5根,且当前K线(第五根K线)收盘价大于前四根K线收盘价的平均值,做多; 5均线10均线死叉再等K线走5根,且当前K线(第五根K线)收盘价小于前四根K线收盘价的平均值,平仓;
|
-- 作者:FireScript -- 发布时间:2019/4/4 9:16:56 -- 提供一个参考范例: ma5:ma(c,5);
ma10:ma(c,10); majc:cross(ma5,ma10); masc:cross(ma10,ma5); sc_len:SUMBARS(masc,1); jc_len:SUMBARS(majc,1); buycond:jc_len=5 and sc_len>5 and c>ref(ma(c,4),1);//sc_len>5 保证最近一次是金叉而不是死叉 sellcond:sc_len=5 and jc_len>5 and c<ref(ma(c,4),1); buy(buycond and holding=0,1,market); sell(sellcond and holding>0,holding,market); |