以文本方式查看主题 - 金字塔客服中心 - 专业程序化交易软件提供商 (http://weistock.com/bbs/index.asp) -- 公式模型编写问题提交 (http://weistock.com/bbs/list.asp?boardid=4) ---- 老师怎么写? (http://weistock.com/bbs/dispbbs.asp?boardid=4&id=84812) |
-- 作者:quanty -- 发布时间:2015/9/7 15:06:17 -- 老师怎么写? 老师,怎么写出如下程序:
在5分钟K线上,如果连续10个K线的收盘价大于(站在)20日均线上,下个周期开盘开多,跌破5日均线平仓; 如果连续10个K线的收盘价小于20日均线下,下个周期开盘开空,升破5日均线平仓;
十分感谢! |
-- 作者:jinzhe -- 发布时间:2015/9/7 15:10:35 -- ma20:=ma(c,20); ma5:=ma(c,5); if ref(all(close>ma20,10),1) then buy(holding=0,1,market); if holding>0 and cross(ma5,c) then sell(1,0,market);
if ref(all(close<ma20,10),1) then buyshort(holding=0,1,market); if holding<0 and cross(c,ma5) then sellshort(1,0,market); |
-- 作者:quanty -- 发布时间:2015/9/7 15:18:30 -- 谢谢老师! ![]() |