龙听期货论坛's Archiver

C
+
+


 微信: QQ:

龙听 发表于 2018-11-30 10:43

蛟龙模型 日内交易模型[文华财经公式]

源码:[code]
//模型适用于 橡胶日内1—5分钟 模型的思路好不好,在这里供大家学习 交流!希望大家多多支持!



MA3:=MA(CLOSE,3);
MAM:=MA(CLOSE,M);
MA2M:=MA(CLOSE,2*M);
MAXX:=MA(CLOSE,XX);
EMAN:=EMA(C,N);
NA:=BARSLAST(DATE<>REF(DATE,1))+1;
HHH:=HHV(HIGH,NA);
LLL:=LLV(LOW,NA);
CC1:=VALUEWHEN(DATE<>REF(DATE,1),REF(CLOSE,1));
AA1:=VALUEWHEN(DATE<>REF(DATE,1),REF(HHH,1));
BB1:=VALUEWHEN(DATE<>REF(DATE,1),REF(LLL,1));
PT  := AA1-BB1;
CDP :=(AA1 + BB1 + CC1)/3;
AH  := CDP + PT;
HH :=AH + PT;
AL  : =CDP - PT;
CDL:=CDP;
NH  :=2*CDP-BB1;
NL  :=2*CDP-AA1;
LL:=AL - PT;
H1:=HHV(HIGH,NG);
L1:=LLV(LOW,NG);
A:=IFELSE(HIGH>=REF(HIGH,1)&&HIGH>=REF(HIGH,2)&&HIGH>=REF(HIGH,3),LOW,0);
B:=IFELSE(LOW<=REF(LOW,1)&&LOW<=REF(LOW,2)&&LOW<=REF(LOW,3),HIGH,888888);
P1:=IFELSE(A>REF(L1,1),REF(L1,1),0);
P2:=IFELSE(A>REF(L1,2)&&A<=REF(L1,1),REF(L1,2),0);
P3:=IFELSE(A>REF(L1,3)&&A<=REF(L1,1)&&A<=REF(L1,2),REF(L1,3),0);
P4:=IFELSE(A>REF(L1,4)&&A<=REF(L1,1)&&A<=REF(L1,2)&&A<=REF(L1,3),REF(L1,4),0);
P5:=IFELSE(A>REF(L1,5)&&A<=REF(L1,1)&&A<=REF(L1,2)&&A<=REF(L1,3)&&A<=REF(L1,4),REF(L1,5),0);
P6:=IFELSE(A>REF(L1,6)&&A<=REF(L1,1)&&A<=REF(L1,2)&&A<=REF(L1,3)&&A<=REF(L1,4)&&A<=REF(L1,5),REF(L1,6),0);
P7:=IFELSE(A>REF(L1,7)&&A<=REF(L1,1)&&A<=REF(L1,2)&&A<=REF(L1,3)&&A<=REF(L1,4)&&A<=REF(L1,5)&&A<=REF(L1,6),REF(L1,7),0);
P8:=IFELSE(A>REF(L1,8)&&A<=REF(L1,1)&&A<=REF(L1,2)&&A<=REF(L1,3)&&A<=REF(L1,4)&&A<=REF(L1,5)&&A<=REF(L1,6)&&A<=REF(L1,7),REF(L1,8),0);
P9:=IFELSE(A>REF(L1,9)&&A<=REF(L1,1)&&A<=REF(L1,2)&&A<=REF(L1,3)&&A<=REF(L1,4)&&A<=REF(L1,5)&&A<=REF(L1,6)&&A<=REF(L1,7)&&A<=REF(L1,8),REF(L1,9),0);
P10:=IFELSE(A>REF(L1,10)&&A<=REF(L1,1)&&A<=REF(L1,2)&&A<=REF(L1,3)&&A<=REF(L1,4)&&A<=REF(L1,5)&&A<=REF(L1,6)&&A<=REF(L1,7)&&A<=REF(L1,8)&&A<=REF(L1,9),REF (L1,10),0);
AA:=P1+P2+P3+P4+P5+P6+P7+P8+P9+P10;
PP1:=IFELSE(AA>REF(L1,1),REF(L1,1),0);
PP2:=IFELSE(AA>REF(L1,2)&&AA<=REF(L1,1),REF(L1,2),0);
PP3:=IFELSE(AA>REF(L1,3)&&AA<=REF(L1,1)&&AA<=REF(L1,2),REF(L1,3),0);
PP4:=IFELSE(AA>REF(L1,4)&&AA<=REF(L1,1)&&AA<=REF(L1,2)&&AA<=REF(L1,3),REF(L1,4),0);
PP5:=IFELSE(AA>REF(L1,5)&&AA<=REF(L1,1)&&AA<=REF(L1,2)&&AA<=REF(L1,3)&&AA<=REF(L1,4),REF(L1,5),0);
PP6:=IFELSE(AA>REF(L1,6)&&AA<=REF(L1,1)&&AA<=REF(L1,2)&&AA<=REF(L1,3)&&AA<=REF(L1,4)&&AA<=REF(L1,5),REF(L1,6),0);
PP7:=IFELSE(AA>REF(L1,7)&&AA<=REF(L1,1)&&AA<=REF(L1,2)&&AA<=REF(L1,3)&&AA<=REF(L1,4)&&AA<=REF(L1,5)&&AA<=REF(L1,6),REF(L1,7),0);
PP8:=IFELSE(AA>REF(L1,8)&&AA<=REF(L1,1)&&AA<=REF(L1,2)&&AA<=REF(L1,3)&&AA<=REF(L1,4)&&AA<=REF(L1,5)&&AA<=REF(L1,6)&&AA<=REF(L1,7),REF(L1,8),0);
PP9:=IFELSE(AA>REF(L1,9)&&AA<=REF(L1,1)&&AA<=REF(L1,2)&&AA<=REF(L1,3)&&AA<=REF(L1,4)&&AA<=REF(L1,5)&&AA<=REF(L1,6)&&AA<=REF(L1,7)&&AA<=REF(L1,8),REF (L1,9),0);
PP10:=IFELSE(AA>REF(L1,10)&&AA<=REF(L1,1)&&AA<=REF(L1,2)&&AA<=REF(L1,3)&&AA<=REF(L1,4)&&AA<=REF(L1,5)&&AA<=REF(L1,6)&&AA<=REF(L1,7)&&AA<=REF(L1,8)&&AA<=REF(L1,9),REF(L1,10),0);
AAA:=PP1+PP2+PP3+PP4+PP5+PP6+PP7+PP8+PP9+PP10;
C1:=VALUEWHEN(AAA>0,AAA);
T1:=IFELSE(B<REF(H1,1),REF(H1,1),0);
T2:=IFELSE(B<REF(H1,2)&&B>=REF(H1,1),REF(H1,2),0);
T3:=IFELSE(B<REF(H1,3)&&B>=REF(H1,1)&&B>=REF(H1,2),REF(H1,3),0);
T4:=IFELSE(B<REF(H1,4)&&B>=REF(H1,1)&&B>=REF(H1,2)&&B>=REF(H1,3),REF(H1,4),0);
T5:=IFELSE(B<REF(H1,5)&&B>=REF(H1,1)&&B>=REF(H1,2)&&B>=REF(H1,3)&&B>=REF(H1,4),REF(H1,5),0);
T6:=IFELSE(B<REF(H1,6)&&B>=REF(H1,1)&&B>=REF(H1,2)&&B>=REF(H1,3)&&B>=REF(H1,4)&&B>=REF(H1,5),REF(H1,6),0);
T7:=IFELSE(B<REF(H1,7)&&B>=REF(H1,1)&&B>=REF(H1,2)&&B>=REF(H1,3)&&B>=REF(H1,4)&&B>=REF(H1,5)&&B>=REF(H1,6),REF(H1,7),0);
T8:=IFELSE(B<REF(H1,8)&&B>=REF(H1,1)&&B>=REF(H1,2)&&B>=REF(H1,3)&&B>=REF(H1,4)&&B>=REF(H1,5)&&B>=REF(H1,6)&&B>=REF(H1,7),REF(H1,8),0);
T9:=IFELSE(B<REF(H1,9)&&B>=REF(H1,1)&&B>=REF(H1,2)&&B>=REF(H1,3)&&B>=REF(H1,4)&&B>=REF(H1,5)&&B>=REF(H1,6)&&B>=REF(H1,7)&&B>=REF(H1,8),REF(H1,9),0);
T10:=IFELSE(B<REF(H1,10)&&B>=REF(H1,1)&&B>=REF(H1,2)&&B>=REF(H1,3)&&B>=REF(H1,4)&&B>=REF(H1,5)&&B>=REF(H1,6)&&B>=REF(H1,7)&&B>=REF(H1,8)&&B>=REF(H1,9),REF (H1,10),0);
BB:=IFELSE((T1+T2+T3+T4+T5+T6+T7+T8+T9+T10)=0,888888,T1+T2+T3+T4+T5+T6+T7+T8+T9+T10);
TT1:=IFELSE(BB<REF(H1,1),REF(H1,1),0);
TT2:=IFELSE(BB<REF(H1,2)&&BB>=REF(H1,1),REF(H1,2),0);
TT3:=IFELSE(BB<REF(H1,3)&&BB>=REF(H1,1)&&BB>=REF(H1,2),REF(H1,3),0);
TT4:=IFELSE(BB<REF(H1,4)&&BB>=REF(H1,1)&&BB>=REF(H1,2)&&BB>=REF(H1,3),REF(H1,4),0);
TT5:=IFELSE(BB<REF(H1,5)&&BB>=REF(H1,1)&&BB>=REF(H1,2)&&BB>=REF(H1,3)&&BB>=REF(H1,4),REF(H1,5),0);
TT6:=IFELSE(BB<REF(H1,6)&&BB>=REF(H1,1)&&BB>=REF(H1,2)&&BB>=REF(H1,3)&&BB>=REF(H1,4)&&BB>=REF(H1,5),REF(H1,6),0);
TT7:=IFELSE(BB<REF(H1,7)&&BB>=REF(H1,1)&&BB>=REF(H1,2)&&BB>=REF(H1,3)&&BB>=REF(H1,4)&&BB>=REF(H1,5)&&BB>=REF(H1,6),REF(H1,7),0);
TT8:=IFELSE(BB<REF(H1,8)&&BB>=REF(H1,1)&&BB>=REF(H1,2)&&BB>=REF(H1,3)&&BB>=REF(H1,4)&&BB>=REF(H1,5)&&BB>=REF(H1,6)&&BB>=REF(H1,7),REF(H1,8),0);
TT9:=IFELSE(BB<REF(H1,9)&&BB>=REF(H1,1)&&BB>=REF(H1,2)&&BB>=REF(H1,3)&&BB>=REF(H1,4)&&BB>=REF(H1,5)&&BB>=REF(H1,6)&&BB>=REF(H1,7)&&BB>=REF(H1,8),REF (H1,9),0);
TT10:=IFELSE(BB<REF(H1,10)&&BB>=REF(H1,1)&&BB>=REF(H1,2)&&BB>=REF(H1,3)&&BB>=REF(H1,4)&&BB>=REF(H1,5)&&BB>=REF(H1,6)&&BB>=REF(H1,7)&&BB>=REF(H1,8)&&BB>=REF (H1,9),REF(H1,10),0);
BBB:=TT1+TT2+TT3+TT4+TT5+TT6+TT7+TT8+TT9+TT10;
D:=VALUEWHEN(BBB>0,BBB); UD:=IFELSE(CLOSE>D&&REF(CLOSE,1)<=D,1,IFELSE(CLOSE<C1&&REF(CLOSE,1)>=C1,-3,0)); K:=VALUEWHEN(UD<>0,UD); G:=IFELSE(K=1,C1,D);
LC:=REF(CLOSE,1);
RSV:=(CLOSE-LLV(LOW,10))/(HHV(HIGH,10)-LLV(LOW,10))*100;
KK:=SMA(RSV,5,1);
DD:=SMA(KK,5,1);
JJ:=3*KK-2*DD;
TR : =MAX(MAX((HIGH-LOW),ABS(REF(CLOSE,1)-HIGH)),ABS(REF(CLOSE,1)-LOW));
ATR := MA(TR,5);
ATR1:= MA(TR,4);
ATR2:=MA(TR,3);
MTR:= IFELSE(TIME<=0912,ATR2/C*100000,IFELSE(TIME>0912&&TIME<=0915,ATR1/C*100000,ATR/C*100000));
//RX:=REF(J,2)<10&&REF(H,1)>REF(H,2)&&REF(C,1)>REF(C,2)&&REF(C,1)>REF(O,2)&&REF(L,1)>REF(L,2);
//X1:=REF(JJ,1)<10&&H>REF(H,1)&&C>REF(C,1)&&C>REF(O,1)&&L>REF(L,1);//超S
//显示超卖和价升K线,抢反弹的敏感指标!
VR:=SUM(IFELSE(CLOSE>LC,VOL,0),20)/SUM(IFELSE(CLOSE<=LC,VOL,0),20)*100;
V2:=VALUEWHEN(TIME<=1000,COUNT(VR>50,NA));
V1:=VALUEWHEN(TIME<=1000,COUNT(VR<100,NA));
RC:=VALUEWHEN(DATE<>REF(DATE,1),REF(CLOSE,1));
OO:=VALUEWHEN(DATE<>REF(DATE,1),O);
TC:=VALUEWHEN(DATE<>REF(DATE,1),C);
AB:=CLOSE-REF(CLOSE,24);
MI:=SMA(AB,24,1);
SK1:=COUNT((H-G)/G>=0.00169&&AB>=850,NA)>=1&&AB<REF(AB,1)&&CROSS(MAM,MA3);
BK1:=DD>30&&COUNT((G-L)/L>=0.00169&&AB>=-950,NA)>=1&&AB>REF(AB,1)&&CROSS(MA3,MAM);
SKSK:=TIME<=1430&&NOT(TIME>=1000&&(V2>21||V2>=19&&V1<9))&&(OO<G&&((EXIST(C>=(RC-(RC-OO)/2)*0.9995,20)||VALUEWHEN(DATE<>REF(DATE,1),AB)<=-20)&&MI<=0&&AB<=MI&&AB<=REF(AB,1))||(REF(G,1)-REF(L,1))/REF(L,1)>0.01&&CROSS(MAM,MA3)||CROSS(G,MA2M)&&MA3<MAM&&MAM<EMAN&&EMAN<MA2M&&MA2M<MAXX&&MA3<REF(MA3,1)&&MAM<REF(MAM,1)||CROSS(G,MA2M)&&MA3<MAM&&MAM<MA2M&&MA2M<MAXX&&MI<=0&&AB<=MI&&AB<=REF(AB,1));//
BKBK:=IFELSE(TIME>=1000,V2>16,V2>0)&&TIME<=1430&&NOT(V1=21&&V2=0)&&(BK1||NA>3&&((OO>G||OO<RC&&TC>=G)&&(TIME<0957&&EXIST(CROSS(AB,MI),10)||TIME>=1330)&&(EXIST(AB>=400,NA)&&(H-OO)>=0.0076&&MA(MI,5)>REF(MA(MI,5),1)&&MI>=0&&AB>=MI&&AB>=REF(AB,1)&&MA3>REF(MA3,1)&&MA3>MAM*1.0001||(HHV(H,NA)-LLV(L,NA))/LLV(L,NA)>0.022&&MA3>MAM&&MAM>MA2M)||CROSS(MA2M,G)&&MA3>MAM&&MAM>EMAN&&EMAN>MA2M&&MA3>REF(MA3,1)&&MAM>REF(MAM,1)||CROSS(MA2M,G)&&MA3>MAM&&MAM>MA2M&&MI>=0&&AB>=MI&&AB>=REF(AB,1)));
WWW1:=VALUEWHEN(BARSLAST(BKBK)=1,CLOSE);
//满足开仓条件收盘价格处的轴心位置
DATE<>111010&&DATE<>111011&&DATE<>111017&&DATE<>110927&&DATE<>110928&&DATE<>110920&&DATE<>110921&&IFELSE(TIME>=1000,V2>16,V2>0)&&TIME<=1430&&NOT(V1=21&&V2=0)&&NA>3&&NOT((DD>80||JJ>90)&&MTR<200)&&NOT
(NOT(EVERY(MAM-EMAN>-2||MA2M>G*0.99,BARSLAST(BKBK))||V1=0||OO>HH))&&C>=HH*1.0013||(NOT(EVERY(EMAN<MA2M,BARSLAST(BKBK)))||LONGCROSS(EMAN,MAM,BARSLAST(BKBK)))&&WWW1>G&&C<G||C<WWW1*0.985||TIME>=1457,SP;
(RC-OO)/RC<=0.06&&NA>3&&NOT((DD<20||JJ<10)&&MTR<200)&&(TIME<=1430&&((OO<G||OO>RC&&TC<=G)&&((EXIST(C>=(RC-(RC-OO)/2)*0.9995,NA)||EXIST(AB<=-500,NA))&&MI<=0&&AB<=MI&&AB<=REF(AB,1)&&MA3<REF(MA3,1)&&C<G||(HHV(H,NA)-LLV(L,NA))/LLV(L,NA)>0.022&&MA3<MAM&&MAM<MA2M)||CROSS(G,MA2M)&&MA3<MAM&&MAM<EMAN&&EMAN<MA2M&&MA3<REF(MA3,1)&&MAM<REF(MAM,1)||CROSS(G,MA2M)&&MA3<MAM&&MAM<MA2M&&MI<=0&&AB<=MI&&AB<=REF(AB,1))),SK;
IFELSE(COUNT(SK1,NA)>=1,C<=LL*1.0039,(NOT(EVERY(EMAN-MAM>-2,BARSLAST(SKSK))||V2=0||OO<LL))&&C<=LL*1.0015||(NOT(EVERY(EMAN>MA2M,BARSLAST(SKSK)))||LONGCROSS(MAM,EMAN,BARSLAST(SKSK)))&&C>G)||TIME>=1457,BP;
[/code]

页: [1]