以文本方式查看主题

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

--  作者:zhngbotao
--  发布时间:2011/9/30 16:09:35
--  [求助]改模型

我在文华里的模型,放到金字塔后,信号与文华里的不一致,还有一根线柱同时有2个方向相反的信号等。刚刚接触金字塔,望各位老师帮忙改进。

模型:

 

MA150:=MA(CLOSE,150);
MA200:=MA(CLOSE,200);
XDMA200:=(-REF(MA200,5)+REF(MA200,0));
L1:=(MA(CLOSE,100)-R);
L2:=MA(CLOSE,100)-R+2;
H1:=MA(CLOSE,100)+R;
H2:=MA(CLOSE,100)+R-2;
LL1:=MA(CLOSE,100)-R*2;
LL2:=MA(CLOSE,100)-R*2+2;
HH1:=MA(CLOSE,100)+R*2;
HH2:=MA(CLOSE,100)+R*2-2;
300LL1:=MA(CLOSE,300)-R*2;
300LL2:=MA(CLOSE,300)-R*2+2;
300L1:=MA(CLOSE,300)-R;
300L2:=MA(CLOSE,300)-R+2;
B:=MA(CLOSE,5);
D:=MA(CLOSE,10);
//总思路   线带开仓  穿多空结束
//在下降趋势中,如果5个连续有3个在LL上,不做多
KCTJD:=ABS(REF(XDMA200,1))>1||ABS(REF(XDMA200,0))>1;
KCTJK:=ABS(REF(XDMA200,1))>1||ABS(REF(XDMA200,0))>1;
QSDW:=COUNT(L2<REF(L2,1),5)>=4;
QSUP:=COUNT(L2>REF(L2,1),5)>=4;
CROSS(CLOSE,B),BP;
CROSS(B,CLOSE),SP;
CROSS(MA200,CLOSE),SP;
CROSS(CLOSE,MA200)&&KCTJD=1,BK;
///
CROSS(CLOSE,HH1)&&ISUP&&KCTJD=1,BK;
CROSS(CLOSE,HH2),BP;
CROSS(HH2,CLOSE)&&ISDOWN&&KCTJK=1,SK;
CROSS(HH1,CLOSE),SP;
CROSS(HH2,CLOSE),SP;
CROSS(H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SK;
CROSS(HIGH,L1)&&CLOSE<L2&&ISDOWN&&QSDW=1,SK;
//
CROSS(HIGH,HH2)&&CLOSE<HH2&&ISDOWN&&QSDW=1,SP;
CROSS(HIGH,HH1)&&CLOSE<HH2&&ISDOWN&&QSDW=1,SP;
CROSS(HIGH,H2)&&CLOSE<H2&&ISDOWN&&QSDW=1,SP;
CROSS(HIGH,H1)&&CLOSE<H2&&ISDOWN&&QSDW=1,SP;
CROSS(HIGH,LL1)&&CLOSE<LL1&&ISDOWN&&QSDW=1,SP;
CROSS(HIGH,LL2)&&CLOSE<LL1&&ISDOWN&&QSDW=1,SP;
CROSS(HIGH,L2)&&CLOSE<L2&&ISDOWN&&QSDW=1,SP;
CROSS(HIGH,L1)&&CLOSE<L2&&ISDOWN&&QSDW=1,SP;
//NOFILTER;


--  作者:fly
--  发布时间:2011/10/8 11:23:16
--  
下个版本,将兼容文化的SK,SP等下单语句.