龙听期货论坛's Archiver

C
+
+


 微信: QQ:

龙听 发表于 2018-3-24 09:31

鳄鱼法则交易策略(鳄鱼线、AO、AC指标公式源码)[通达信源码]

策略说明:鳄鱼线交易法则策略为鳄鱼线为均线类,所以在主图上。AO AC以及最后面的视窗为副图。设置指标公式源码时注意一下。鳄鱼线法则这个策略需要四个图的,一个主技术图,3个指标图,我在最后有一个示例效果图。


鳄鱼-线源码:[code]
Y:=(H+L)/2;
AA:=REF((SMA(Y,5,1)),3);
BB:=REF((SMA(Y,8,1)),5);
CC:=REF((SMA(Y,13,1)),8);
鳄:CC,COLORFF6600;
齿:BB,COLORRED;
唇:AA,COLORGREEN;
R2:=REF(齿,5);
KU1:=IF(HIGH=HHV(HIGH,3),1,0);
KD1:=IF(LOW=LLV(LOW,3),1,0);
UL:=IF(REF(KU1,2)=1 AND REF(KU1,1)=0 AND KU1=0,REF(HIGH,2),REF(HIGH,2+BARSLAST(REF(KU1,2)=1 AND REF(KU1,1)=0 AND KU1=0)));
DL:=IF(REF(KD1,2)=1 AND REF(KD1,1)=0 AND KD1=0,REF(LOW,2),REF(LOW,2+BARSLAST(REF(KD1,2)=1 AND REF(KD1,1)=0 AND KD1=0)));
上分形:IF(HIGH>=R2,UL,REF(UL,BARSLAST(HIGH>R2))),POINTDOT,LINETHICK3,,COLORMAGENTA;
下分形:IF(LOW<=R2,DL,REF(DL,BARSLAST(LOW<=R2))),POINTDOT,LINETHICK3,COLORYELLOW;
DRAWICON(CLOSE>上分形 AND REF(CLOSE,1)<REF(上分形,1),HIGH*1.03,1);
DRAWICON(CLOSE<下分形 AND REF(CLOSE,1)>REF(下分形,1),LOW*0.99,2);
AO:=MA(Y,5)-MA(Y,34);
MAO:=MA(AO,5);
AC:=AO-MAO;
AC1:=REF(AC,1);
AO1:=REF(AO,1);
KAC:=IF(AC>AC1 AND AO>AO1,1,0);
KAO:=IF(AC<AC1 AND AO<AO1,-1,0);
STICKLINE(KAC=1 AND CLOSE>=OPEN,OPEN,CLOSE,3,1),COLORRED;
STICKLINE(KAO=-1 AND CLOSE>=OPEN,OPEN,CLOSE,3,1),COLORGREEN;
STICKLINE(KAO=0 AND KAC=0 AND CLOSE>=OPEN,OPEN,CLOSE,3,1),COLORDDDDDD;
STICKLINE(CLOSE>=OPEN,HIGH,CLOSE,0.0.1,0),COLORRED;
STICKLINE(CLOSE>=OPEN,OPEN,LOW,0.0.1,0),COLORRED;
STICKLINE(KAC=1 AND CLOSE<OPEN,OPEN,CLOSE,3,0),COLORRED;
STICKLINE(KAO=-1 AND CLOSE<OPEN,OPEN,CLOSE,3,0),COLORGREEN;
STICKLINE(KAO=0 AND KAC=0 AND CLOSE<OPEN,OPEN,CLOSE,3,0),COLORDDDDDD;
[/code]


AO动量源码:

[code]
VAR1:=(HIGH+LOW)/2;
AO:MA(VAR1,5)-MA(VAR1,34),LINETHICK0;
STICKLINE(AO>=REF(AO,1),0,AO,2.2,1),COLORRED;
STICKLINE(AO<REF(AO,1),0,AO,2.2,1),COLORGREEN;
AO5:MA(AO,5),COLORFF6600;
S1:=CROSS(0,AO);
DRAWTEXT(S1,AO,'S'),COLORWHITE;
DRAWICON(S1,AO,2);
S2:=AO<0 AND REF(AO,1)>REF(AO,2) AND AO<REF(AO,1);
DRAWTEXT(S2,AO,'S'),COLORWHITE;
DRAWICON(S2,AO,2);
SCOUNT:=BARSLAST(AO<0);
SD:=HHV(AO,SCOUNT);
SCOUNTD:=HHVBARS(AO,SCOUNT);
S3:=AO>0 AND REF(AO,1)>REF(AO,2) AND AO<REF(AO,1);
S31:=COUNT(S3,SCOUNTD);
DRAWTEXT(S31>=2 AND S3,AO,'S'),COLORWHITE;
DRAWICON(S31>=2 AND S3,AO,2);
B1:=CROSS(AO,0);
DRAWTEXT(B1,AO,'B'),COLORWHITE;
DRAWICON(B1,AO,1);
B2:=AO>0 AND REF(AO,1)<REF(AO,2) AND AO>REF(AO,1) ;
DRAWTEXT(B2,AO,'B'),COLORWHITE;
DRAWICON(B2,AO,1);
BCOUNT:=BARSLAST(AO>0);
BD:=LLV(AO,BCOUNT);
BCOUNTD:=LLVBARS(AO,BCOUNT);
B3:=AO<0 AND REF(AO,1)<REF(AO,2) AND AO>REF(AO,1);
B31:=COUNT(B3,BCOUNTD);
DRAWTEXT(B31>=2 AND B3,AO,'B'),COLORWHITE;
DRAWICON(B31>=2 AND B3,AO,1);
[/code]


AC加速源码:

[code]
AO:=MA((HIGH+LOW)/2,5)-MA((HIGH+LOW)/2,34);
AO5:=MA(AO,5);
AC:AO-AO5,LINETHICK0;
STICKLINE(AC>=REF(AC,1),0,AC,2.2,1),COLORRED;
STICKLINE(AC< REF(AC,1),0,AC,2.2,1),COLORGREEN;
AC1:=REF(AC,1);
BUY1:=REF(AC,3)<REF(AC1,3) AND REF(AC,2)<REF(AC1,2) AND REF(AC,2)<REF(AC,3) AND REF(AC,1)>REF(AC1,1) AND AC>AC1 AND COUNT(AC>0,4)=4;
DRAWTEXT(BUY1,AC,'B'),COLORWHITE;
DRAWICON(BUY1,AC,1);
BUY2:=COUNT(AC<0,4)=4 AND REF(AC,3)<REF(AC1,3) AND COUNT(AC>AC1,3)=3;
DRAWTEXT(BUY2,AC, 'B'),COLORWHITE;
DRAWICON(BUY2,AC,1);
BUY3:=REF(AC,3)<REF(AC1,3) AND REF(AC,2)<REF(AC1,2) AND REF(AC,2)<REF(AC,3) AND COUNT(AC>AC1,2)=2 AND REF(AC,1)<0 AND AC>0;
DRAWTEXT(BUY3,AC, 'B'),COLORWHITE;
DRAWICON(BUY3,AC,1);
BUY4:=REF(AC,4)<REF(AC1,4) AND REF(AC,3)<REF(AC1,3) AND REF(AC,3)<REF(AC,4) AND COUNT(AC>AC1,3)=3 AND REF(AC,1)<0 AND AC>0;
DRAWTEXT(BUY4,AC, 'B'),COLORWHITE;
DRAWICON(BUY4,AC,1);
S1:=REF(AC,3)>REF(AC1,3) AND REF(AC,2)>REF(AC1,2) AND REF(AC,2)>REF(AC,3) AND REF(AC,1)<REF(AC1,1) AND AC<AC1 AND COUNT(AC<0,4)=4;
DRAWTEXT(S1,AC,'S'),COLORWHITE;
DRAWICON(S1,AC,2);
S2:=COUNT(AC>0,4)=4 AND REF(AC,3)>REF(AC1,3) AND COUNT(AC<AC1,3)=3;
DRAWTEXT(S2,AC,'S'),COLORWHITE;
DRAWICON(S2,AC,2);
S3:=REF(AC,3)>REF(AC1,3) AND REF(AC,2)>REF(AC1,2) AND REF(AC,2)>REF(AC,3) AND COUNT(AC<AC1,2)=2 AND REF(AC,1)>0 AND AC<0;
DRAWICON(S3,AC,2);
[/code]


MFI视窗源码:

[code]
MFI:(H-L)*1000000/V,STICK;
A1:=MFI>=REF(MFI,1)*1.1 AND V>=REF(V,1)*1.1;
A2:=MFI<=REF(MFI,1)*0.9 AND V<=REF(V,1)*0.9;
A3:=MFI>=REF(MFI,1)*1.1 AND V<=REF(V,1)*0.9;
A4:=MFI<=REF(MFI,1)*0.9 AND V>=REF(V,1)*1.1;  
STICKLINE(A1,0,MFI,0.1,1),COLORGREEN;
STICKLINE(A2,0,MFI,0.1,1),COLORBLUE;
STICKLINE(A3,0,MFI,0.1,1),COLORBROWN;
STICKLINE(A4,0,MFI,0.1,1),COLORMAGENTA;
MA5:MA(MFI,5);
绿灯:IF(A1,MFI,DRAWNULL),STICK,COLORGREEN;
衰退:IF(A2,MFI,DRAWNULL),STICK,COLORBLUE;
伪装:IF(A3,MFI,DRAWNULL),STICK,COLORBROWN;
蛰伏:IF(A4,MFI,DRAWNULL),STICK,COLORMAGENTA;
[/code]


效果图如下:
[img]http://p.qhlt.cn/filestores/2018/03/24/1114e0b208e9f823fa77c76323804438.jpg[/img]

获嘉小马哥 发表于 2019-3-19 02:18

谢谢,学习了

阿土伯 发表于 2019-3-21 16:07

看看

伸手党二 发表于 2019-6-18 20:30

学习

沸水煮绿蛙 发表于 2020-10-15 11:38

学习了

页: [1]