以文本方式查看主题

-  金字塔客服中心 - 专业程序化交易软件提供商  (http://weistock.com/bbs/index.asp)
--  公式模型编写问题提交  (http://weistock.com/bbs/list.asp?boardid=4)
----  指标基础编写  (http://weistock.com/bbs/dispbbs.asp?boardid=4&id=76179)

--  作者:q835560665
--  发布时间:2015/3/5 12:49:23
--  指标基础编写

CCI指标

 

TYP := (HIGH + LOW + CLOSE)/3;
(TYP-MA(TYP,M))/(0.015*AVEDEV(TYP,M));

 

请问如何编写,当CCI指标线 大于0轴线时平空开多,小于时平多开空?



--  作者:pyd
--  发布时间:2015/3/5 13:33:19
--  

TYP : (HIGH + LOW + CLOSE)/3;
cci:(TYP-MA(TYP,m))/(0.015*AVEDEV(TYP,m)),NOAXIS;
if cci>0 then begin
sellshort(holding<0,holding,market);
buy(holding=0,1,market);
end
if cci<0 then begin
sell(holding>0,holding,market);
buyshort(holding=0,1,market);
end