龙听期货论坛's Archiver

C
+
+


 微信: QQ:

龙听 发表于 2018-9-30 13:36

金字塔kdj,macd组合策略例子

源码如下:
[code]
//kdj,macd组合策略例子

N:=26;P1:=12;P2:=9;
DIFF : =EMA(CLOSE,12) - EMA(CLOSE,26);
DEA  : =EMA(DIFF,9);
RSV:=(CLOSE-LLV(LOW,N))/(HHV(HIGH,N)-LLV(LOW,N))*100;
K:=SMA(RSV,P1,1);
D:=SMA(K,P2,1);
J:=3*K-2*D;// WWW.CXH99.COM

//MA1:=DIFF;
//MA2:=DEA ;

//MA3:=J;
//MA4:=D;

long:=any(CROSS(diff,dea),10) and any(cross(j,d),10) and (cross(diff,dea) or cross(j,d));//((CROSS(diff,dea) and J>D) or (CROSS(J,D) and diff>dea));


IF long THEN
BEGIN
BUY(long,1,thisclose);
END

SELL(CROSS(dea,diff),1,thisclose);
[/code]

页: [1]