以文本方式查看主题

-  金字塔客服中心 - 专业程序化交易软件提供商  (http://222.73.7.161/bbs/index.asp)
--  公式模型编写问题提交  (http://222.73.7.161/bbs/list.asp?boardid=4)
----  [求助]文华转金字塔  (http://222.73.7.161/bbs/dispbbs.asp?boardid=4&id=157569)

--  作者:OLIVERLAC
--  发布时间:2017/9/4 12:04:28
--  [求助]文华转金字塔

老师请帮我把一个文华跨周期模型转换为金字塔的,谢谢

C:

T1:=C>MA(C,120)&&C>MA(C,240)&&MA(C,120)>REF(MA(C,120),1)&&MA(C,240)>REF(MA(C,240),1)&&MA(C,120)>MA(C,240);
T3:=C<MA(C,120)&&C<MA(C,240)&&MA(C,120)<REF(MA(C,120),1)&&MA(C,240)<REF(MA(C,240),1)&&MA(C,120)<MA(C,240);

跨周期模型C:

#IMPORT[MIN,30,C] AS VAR
T11:=VAR.T1;
T33:=VAR.T3;

T1:MA(C,30)>=MA(C,120);
T1&&T11,BK;
T2:=MA(C,30)<=MA(C,120);
T2,SP;
T3:=MA(C,30)<=MA(C,120);
T3&&T33,SK;
T4:=MA(C,30)>=MA(C,120);
T4,BP;
AUTOFILTER;


--  作者:FireScript
--  发布时间:2017/9/4 13:30:17
--  

新建一个被引用指标。指标名:VAR。

T1:=C>MA(C,120)&&C>MA(C,240)&&MA(C,120)>REF(MA(C,120),1)&&MA(C,240)>REF(MA(C,240),1)&&MA(C,120)>MA(C,240);
T3:=C<MA(C,120)&&C<MA(C,240)&&MA(C,120)<REF(MA(C,120),1)&&MA(C,240)<REF(MA(C,240),1)&&MA(C,120)<MA(C,240);

 

跨周期使用:

T11:= STKINDI(STKLABEL,\'VAR.T1\',0,4); 
T33:=STKINDI(STKLABEL,\'VAR.T3\',0,4);

T1:MA(C,30)>=MA(C,120);
买开:buy(T1 and T11 and holding=0,1,market);
T2:=MA(C,30)<=MA(C,120);
平多:sell(T2,holding,market);
T3:=MA(C,30)<=MA(C,120);
开空:buyshort(T3 and T33 and holding=0,1,market);
T4:=MA(C,30)>=MA(C,120);
平空:SELLSHORT(T4 and holding=0,holding,market);