当前位置:首页 > 通达信 > 正文

【通达信分享源码】精品指标公式-自动画趋势线源码

2022-12-27未知 编 辑:掌上指标


公式源码:
 
WN:=N;
 
WA1:=REF(H,WN)=HHV(H,2*WN+1); 
 
WB1:=FILTER(WA1,WN); 
 
WC1:=BACKSET(WB1,WN+1); 
 
WD1:=FILTER(WC1,WN);
 
WA2:=REF(L,WN)=LLV(L,2*WN+1); 
 
WB2:=FILTER(WA2,WN); 
 
WC2:=BACKSET(WB2,WN+1); 
 
WD2:=FILTER(WC2,WN);
 
WE1:=(REF(LLV(L,2*WN),1)+REF(HHV(H,2*WN),1))/2; 
 
WE2:=(H+L)/2;
 
WH1:=(WD1 AND NOT(WD2 AND WE1>=WE2)) OR ISLASTBAR OR BARSCOUNT(C)=1;
 
WL1:=(WD2 AND NOT(WD1 AND WE1<WE2));  
 
WH2:=WD1 AND NOT(WD2 AND WE1>=WE2);
 
WX1:=REF(BARSLAST(WH1),1)+1; 
 
WF1:=BACKSET(WH1 AND COUNT(WL1,WX1)>0,LLVBARS(IF(WL1,L,10000),WX1));
 
WG1:=WF1>REF(WF1,1); 
 
WI1:=BACKSET(WG1,2); 
 
WLD:=WI1>REF(WI1,1);
 
WL2:=WLD OR ISLASTBAR OR BARSCOUNT(C)=1;
 
WX2:=REF(BARSLAST(WL2),1)+1; WF2:=BACKSET(WL2 AND COUNT(WH2,WX2)>0,HHVBARS(IF(WH2,H,0),WX2));
 
WG2:=WF2>REF(WF2,1); 
 
WI2:=BACKSET(WG2,2);
 
WHD:=WI2>REF(WI2,1);
 
WR1:=BACKSET(ISLASTBAR,BARSLAST(WHD)+1); WS1:=WR1>REF(WR1,1); 
 
WT1:=BACKSET(ISLASTBAR,BARSLAST(WLD)+1); WU1:=WT1>REF(WT1,1); 
 
WR2:=BACKSET(WS1,REF(BARSLAST(WHD),1)+2); WS2:=WR2>REF(WR2,1); 
 
WT2:=BACKSET(WU1,REF(BARSLAST(WLD),1)+2); WU2:=WT2>REF(WT2,1); 
 
WT3:=BACKSET(WU2,REF(BARSLAST(WLD),1)+2); WU3:=WT3>REF(WT3,1); 
 
WT4:=BACKSET(WU3,REF(BARSLAST(WLD),1)+2); WU4:=WT4>REF(WT4,1); 
 
WR3:=BACKSET(WS2,REF(BARSLAST(WHD),1)+2); WS3:=WR3>REF(WR3,1); 
 
WR4:=BACKSET(WS3,REF(BARSLAST(WHD),1)+2); WS4:=WR4>REF(WR4,1); 
 
DRAWLINE(WS2,H,WS1,H,1),COLORYELLOW;          
 
DRAWLINE(WU2,L,WU1,L,1),DOTLINE,COLORYELLOW;
 
DRAWLINE(WS3,H, WS2,H,1),COLORBLUE; 
 
DRAWLINE(WU3,L,WU2,L,1),DOTLINE,COLORBLUE;     
 
DRAWLINE(WS4,H,WS3,H,1),COLORRED;
 
DRAWLINE(WU4,L,WU3,L,1),DOTLINE,COLORRED; 
 
 
 
VAR1:=SUM(MAX(MAX(HIGH-LOW,ABS(HIGH-REF(CLOSE,1))),ABS(LOW-REF(CLOSE,1))),25);
 
VAR2:=HIGH-REF(HIGH,1);
 
VAR3:=REF(LOW,1)-LOW;
 
VAR4:=SUM(IF(VAR2>0 AND VAR2>VAR3,VAR2,0),25);
 
VAR5:=SUM(IF(VAR3>0 AND VAR3>VAR2,VAR3,0),25);
 
VAR6:=VAR4*100/VAR1;
 
VAR7:=VAR5*100/VAR1;
 
VAR8:=MA(ABS(VAR7-VAR6)/(VAR7+VAR6)*100,15);
 
VAR9:=(VAR8+REF(VAR8,15))/2;
 
A:=(VAR7>VAR6 AND VAR7>25 AND VAR6<25);
 
B:=ZIG(3,5)*100;
 
G:=MA(B,2);
 
D:=CROSS(B,G);
 
W:=CROSS(G,B);
 
E:=REF(INDEXC,1);
 
F:=SMA(MAX(INDEXC-E,0),3,1)/SMA(ABS(INDEXC-E),3,1);
 
VAR10:=F AND F<8;
 
VAR11:=(CLOSE-LLV(LOW,9))/(HHV(HIGH,9)-LLV(LOW,9))*100;
 
VAR12:=SMA(VAR11,3,1);
 
VAR13:=SMA(VAR12,3,1);
 
VAR14:=VAR13 AND VAR13<20;
 
DRAWTEXT(FILTER(D=1,5),LOW-0.1,'↖买'),COLORFFFFFF;
 
DRAWTEXT(W=1,HIGH*1.02,'逃'),COLORRED;
 
STICKLINE(W=1,O,C,0.1,0),COLORBLUE;
 
STICKLINE(D=1,O,C,0.1,0),COLORYELLOW;
 
 
 
M5:=MA(C,5);
 
M10:=MA(C,10);
 
M20:=MA(C,20);
 
V1:=IF(V=CONST(LLV(V,100)),1,0);
 
V2:=BARSLAST(V1);
 
V3:=REF(H,V2);
 
V4:=EMA(((SLOPE(C,22)*20)+C),55);
 
V5:=EMA(C,12);
 
V6:=L<V3 AND L<V4 AND L<V5 AND CROSS(V5,V4) AND C>V3 AND C>V4;
 
DRAWICON(V6,LLV(L,10),1);
大家都爱看
查看更多热点新闻
点击进入掌上指标资源网-下载各类指标