自己组合短线中线主图指标公式源码[通达信公式]
相关标签:
原理解析:
来源:程序化99( WWW.CXH99.COM )
源码:
MA1:MA(CLOSE,5);
MA2:MA(CLOSE,10);
MA3:MA(CLOSE,20);
MA4:MA(CLOSE,60);
AAF:=LLV(LOW,34),LINETHICK1,COLORFFFFCC;
BBF:=MA(AAF,4),LINETHICK1,COLORYELLOW;
TYP := (HIGH + LOW + CLOSE)/3;
CCI1:=(TYP-MA(TYP,6))/(0.015*AVEDEV(TYP,5));
差值1:=ABS(REF(CCI1,1)-CCI1),LINETHICK0;
CCI2:=(TYP-MA(TYP,10))/(0.015*AVEDEV(TYP,10));
差值2:=ABS(REF(CCI2,1)-CCI2),LINETHICK0;
CCI3:=(TYP-MA(TYP,20))/(0.015*AVEDEV(TYP,20));
差值3:=ABS(REF(CCI3,1)-CCI3),LINETHICK0;
CCI4:=(TYP-MA(TYP,30))/(0.015*AVEDEV(TYP,30));
差值4:=ABS(REF(CCI4,1)-CCI4),LINETHICK0;
CCI5:=(TYP-MA(TYP,60))/(0.015*AVEDEV(TYP,60));
差值5:=ABS(REF(CCI5,1)-CCI5),LINETHICK0;
CCI:=CCI1+CCI2+CCI3+CCI4+CCI5;
AAA:=(3*C+H+L+O)/6;
VAR1:=(8*AAA+7*REF(AAA,1)+6*REF(AAA,2)+5*REF(AAA,3)
+4*REF(AAA,4)+3*REF(AAA,5)+2*REF(AAA,6)+REF(AAA,8))/36;
VAR2:=(HHV(VAR1,5)+HHV(VAR1,10)+HHV(VAR1,20))/3;
VAR3:=(LLV(VAR1,5)+LLV(VAR1,10)+LLV(VAR1,20))/3;
VAR4:=(HHV(VAR2,5)+HHV(VAR2,10)+HHV(VAR2,20))/3;
VAR5:=(LLV(VAR3,5)+LLV(VAR3,10)+LLV(VAR3,20))/3;
VAR6:=(LLV(VAR1,2)+LLV(VAR1,4)+LLV(VAR1,6))/3;
短线:=VAR1,COLORWHITE;
中线:=VAR6,COLORYELLOW;
下跌:=IF(VAR1=VAR6,VAR6, DRAWNULL),COLORGREEN;
TJ1:= CCI1>差值4;
立桩量:=FILTER(TJ1,0),NODRAW;
TJ2:=IF(BARSLAST(立桩量)=1 ,1,0);{STICKLINE(立桩量 !=1,REF(HIGH,BARSLAST(立桩量)),
REF(HIGH,BARSLAST(立桩量)),1,1),COLORCYAN;}{STICKLINE(立桩量 !=1,REF(LOW,BARSLAST(立桩量)),
REF(LOW,BARSLAST(立桩量)),1,1),COLORCYAN;}
成立1:=TJ2=1;
条件成立1:=FILTER(成立1,5);
DRAWTEXT(条件成立1, REF(HIGH,BARSLAST(立桩量)),'看跌'),COLORLIBLUE;
TJ11:= CCI1<-差值4 ;
立桩量2:=FILTER(TJ11,0),NODRAW;
TJ22:=IF(BARSLAST(立桩量2)=1 AND CLOSE>REF(HIGH,1),1,0);
突破2:=TJ22=1;
{STICKLINE(CLOSE AND 下跌!= VAR6,REF(HIGH,BARSLAST(立桩量2)),
REF(HIGH,BARSLAST(立桩量2)),1,1),COLORYELLOW;}
STICKLINE(CLOSE AND 下跌!= VAR6,REF(LOW,BARSLAST(立桩量2)),
REF(LOW,BARSLAST(立桩量2)),1,1),COLORYELLOW;
TJ:=IF(BARSLAST(立桩量2)=1 AND CLOSE>REF(LOW,1),1,0);
成立2:=TJ=1;
条件成立2:=FILTER(成立2,5);
DRAWTEXT(条件成立2,REF(LOW,BARSLAST(立桩量2)),'看涨'),COLORLIMAGENTA;
TJ111:=ABS(CCI1)>CCI AND ABS( 差值1)> ABS(差值5);
立桩量3:=FILTER(TJ111,3);
TJ3:=IF(BARSLAST(立桩量3)=1 AND CLOSE>REF(LOW,1),1,IF(BARSLAST(立桩量3)=2 AND CLOSE>REF(LOW,2),1,IF(BARSLAST(立桩量3)=3 AND CLOSE>REF(LOW,3),1,0)));
成立:=TJ3=1;
条件成立:=FILTER(成立,5);
DRAWTEXT(条件成立 AND 下跌!= VAR6,L*0.97,'☆成立');
LC:=REF(CLOSE,1);
RSI:=((SMA(MAX((CLOSE - LC),0),3,1) / SMA(ABS((CLOSE - LC)),3,1)) * 100);
FF:=EMA(CLOSE,3);
MA15:=EMA(CLOSE,21);
DRAWTEXT(CROSS(FF,MA15),BBF,'底背离'),COLORA6E500;
DRAWTEXT(CROSS(88,RSI),(HIGH * 1.01),'顶背离'),COLOR1880FF;
{X1:=(C+L+H)/3;
BB13:=ATAN(EMA(X1,13)-REF(EMA(X1,13),1))*3.1416*10;
EMA8:=EMA(C,8);
DRAWTEXT(FILTER(BB13>1 AND EMA(X1,13)>REF(EMA(X1,8),1),10),
EMA8,'∠45'),COLORWHITE;}{通达信单阳不破}
单阳:=C>O*1.03 AND VOL>REF(VOL,1)*1.5;
不破价:=REF(L,BARSLAST(单阳));
DRAWTEXT(单阳,L-L*0.02,'阳'),COLOR00FFFF;
LS0:=BARSLAST(单阳);
LS11:=IF(1,LS0=1,单阳);
LS21:=IF(1,LLV(L,1)>REF(L,1),1);
单阳不破:=LS11 AND LS21;
STICKLINE(单阳不破,不破价-不破价*0.002,不破价,4,0),COLORRED;
DRAWTEXT(单阳不破,不破价-不破价*0.02,'1'),COLORGREEN;
LS12:=IF(2,LS0=2,单阳);
LS22:=IF(2,LLV(L,2)>REF(L,2),1);
单阳不破2:=LS12 AND LS22;
STICKLINE(单阳不破2,不破价-不破价*0.002,不破价,4,0),COLORRED;
DRAWTEXT(单阳不破2,不破价-不破价*0.02,'2'),COLORGREEN;
LS13:=IF(3,LS0=3,单阳);
LS23:=IF(3,LLV(L,3)>REF(L,3),1);
单阳不破3:=LS13 AND LS23;
STICKLINE(单阳不破3,不破价-不破价*0.002,不破价,4,0),COLORRED;
DRAWTEXT(单阳不破3,不破价-不破价*0.02,'3'),COLORGREEN;
LS14:=IF(4,LS0=4,单阳);
LS24:=IF(4,LLV(L,4)>REF(L,4),1);
单阳不破4:=LS14 AND LS24;
STICKLINE(单阳不破4,不破价-不破价*0.002,不破价,4,0),COLORRED;
DRAWTEXT(单阳不破4,不破价-不破价*0.02,'4'),COLORGREEN;
LS15:=IF(5,LS0=5,单阳);
LS25:=IF(5,LLV(L,5)>REF(L,5),1);
单阳不破5:=LS15 AND LS25;
STICKLINE(单阳不破5,不破价-不破价*0.002,不破价,4,0),COLORRED;
DRAWTEXT(单阳不破5,不破价-不破价*0.02,'5'),COLORGREEN;
LS16:=IF(6,LS0=6,单阳);
LS26:=IF(6,LLV(L,6)>REF(L,6),1);
单阳不破6:=LS16 AND LS26;
STICKLINE(单阳不破6,不破价-不破价*0.002,不破价,4,0),COLORRED;
DRAWTEXT(单阳不破6,不破价-不破价*0.02,'6'),COLORGREEN;
LS17:=IF(7,LS0=7,单阳);
LS27:=IF(7,LLV(L,7)>REF(L,7),1);
单阳不破7:=LS17 AND LS27;
STICKLINE(单阳不破7,不破价-不破价*0.002,不破价,4,0),COLORRED;
DRAWTEXT(单阳不破7,不破价-不破价*0.02,'7'),COLORGREEN;
LS18:=IF(8,LS0=8,单阳);
LS28:=IF(8,LLV(L,8)>REF(L,8),1);
单阳不破8:=LS18 AND LS28;
STICKLINE(单阳不破8,不破价-不破价*0.002,不破价,4,0),COLORRED;
DRAWTEXT(单阳不破8,不破价-不破价*0.02,'8'),COLORGREEN;
LS19:=IF(9,LS0=9,单阳);
LS29:=IF(9,LLV(L,9)>REF(L,9),1);
单阳不破9:=LS19 AND LS29;
STICKLINE(单阳不破9,不破价-不破价*0.002,不破价,4,0),COLORRED;
DRAWTEXT(单阳不破9,不破价-不破价*0.02,'9'),COLORGREEN;
LS110:=IF(10,LS0=10,单阳);
LS210:=IF(10,LLV(L,10)>REF(L,10),1);
单阳不破10:=LS110 AND LS210;
STICKLINE(单阳不破10,不破价-不破价*0.002,不破价,4,0),COLORRED;
DRAWTEXT(单阳不破10,不破价-不破价*0.02,'10'),COLORGREEN;{买入卖出}
MA7:=MA(C,7);
VAR71:=ATAN((MA7/REF(MA7,1)-1)*100)*180/3.1416;
AA01:=ATAN((MA7/REF(MA7,1)-1)*100)*180/3.1416;
BB01:=MA(AA01,4);
AA:=AA01>=BB01;
BB0:=AA01<BB01;
买入:DRAWICON(CROSS(AA,BB0),L-0.1,1);
卖出:DRAWICON(CROSS(BB0,AA),H+0.1,2);COHL:=(C+O+H+L)/4;{算术均价}
成交均价:=AMOUNT/VOL/100;
TEST:=BETWEEN(成交均价,L,H);
CC0:=IF(TEST,成交均价,COHL),COLORWHITE;{当均价远离算术均价时,用算术均价}
CC:=FORCAST(CC0,5),COLORWHITE;
EMA34:=EMA(CC,34),COLORFFCC66;
EMA21:=EMA(CC,21),COLORGREEN;
EMA13:=EMA(CC,13),COLORFF00FF;
EMA5:=EMA(EMA(CC,5),2),COLORYELLOW;
TJ0:=C>O AND ABS(EMA13-EMA5)<EMA5*0.01
AND ABS(EMA13-EMA21)<EMA21*0.01
AND ABS(EMA34-EMA21)<EMA21*0.01
AND EMA5>REF(EMA5,1) AND EMA13>REF(EMA13,1)
AND EMA21>REF(EMA21,1) AND EMA34>REF(EMA34,1);
启动点:=FILTER(TJ0,5);
DRAWTEXT(启动点,L*0.92,'启动点'),COLORMAGENTA;RSV:=(C-LLV(L,9))/(HHV(H,9)-LLV(L,9))*100;
K:=SMA(RSV,3,1);
D:=SMA(K,3,1);
J:=3*K-2*D;
X:=LLV(J,2)=LLV(J,8);
VAR01:=LLV(LOW,10);
VAR02:=HHV(HIGH,25);
VAR03:=100*EMA((CLOSE-VAR01)/(VAR02-VAR01),4);
DRAWTEXT(CROSS(VAR03,87.5),HIGH*1.02,'收手'),COLORYELLOW;
DRAWTEXT(CROSS(J,REF(J+0.01,1)) AND X AND J<20,LOW*0.96,'抢钱'),COLORRED;MA5:=MA(CLOSE,5),POINTDOT,COLOR000000,LINETHICK1;
MA21:=EMA(CLOSE,21);
MID:=MA(CLOSE,21),COLOR000000,LINETHICK0;
风险线:=MA(CLOSE,13),LINETHICK3,COLORGREEN;
止损线:=MA(CLOSE,27),LINETHICK0,COLOREE00EE;
DRAWTEXT(CROSS(C,止损线)AND 止损线>风险线,(LOW * 0.92),'主升浪'),COLORRED,LINETHICK3;VAR100:=(CLOSE-LLV(LOW,9))/(HHV(HIGH,9)-LLV(LOW,9))*100;
VAR200:=SMA(VAR100,3,1);
AA9:=VAR100>=VAR200;
BB6:=VAR100<VAR200;
买:DRAWICON(CROSS(AA9,BB6),L-0.1,1);
卖:DRAWICON(CROSS(BB6,AA9),H,2);DRAWTEXT_FIX(C>O,0.01,0.9,0,' WWW.CXH99.COM '),COLORRED;
DRAWTEXT_FIX(C>O,1,1,0,'程序化交易模型'),COLORRED;
公式导入教程: 【通达信公式源码导入方法教程】 【同花顺公式源码导入方法教程】 【大智慧新一代公式源码导入方法教程】
有思路,想编写各种指标公式,程序化交易模型,选股公式,预警公式的朋友
可联系技术人员 QQ: 262069696 或微信:cxhjy888 进行 有偿收费 编写!(注:由于人数限制,QQ或微信请选择方便的一个联系我们就行,谢谢您!)
相关文章
-
没有相关内容