同花顺个股K线主图源码同花顺公式
个股K线指标公式
在本指标里,我加入好几个的选股公式,如macd翻红,sar翻红,ema翻红,蓝红黄(牛熊三色),macd上拐,MACD止跌,当它们有数据显示时,即为选股。
生命线:MA(CLOSE,22),LINETHICK1,colorwhite;
A:=(3*C+L+O+H)/6;
X:=(20*A+19*REF(A,1)+18*REF(A,2)+17*REF(A,3)+16*REF(A,4)+15*REF(A,5)+
14*REF(A,6)+13*REF(A,7)+12*REF(A,8)+11*REF(A,9)+10*REF(A,10)+9*REF(A,11)+8*REF(A,12)
+7*REF(A,13)+6*REF(A,14)+5*REF(A,15)+4*REF(A,16)+3*REF(A,17)+2*REF(A,18)+
REF(A,20))/210;
S2:=SMA(C,3,1);
S6:=SMA(C,5,1);
DK:=2*(S2-S6);
成本:EMA(X,13),COLORFF00FF,LINETHICK0;
底部:LLV(HIGH,30),LINETHICK2,COLORFFCC00;
IF(MA(C,3),MA(C,3),DRAWNULL),coloryellow,LINETHICK2;
IF(MA(C,9),MA(C,9),DRAWNULL),colormagenta,LINETHICK2;
IF(MA(C,23.5),MA(C,23.5),DRAWNULL),colorwhite;
DRAWKLINE(HIGH,OPEN,LOW,CLOSE);
MA5:=MA(C,5);
MA10:=MA(C,10);
MA30:=MA(C,30);
FA:=BARSLAST(CROSS(MA10,MA5)) AND CROSS(MA5,MA10);
FB:=FA AND MA5>MA30 AND MA10>MA30 AND MA10>REF(MA10,1);
DRAWTEXT(FB,L-0.58,''),colorred;
V1:=EMA(CLOSE,5);
V2:=EMA(EMA(CLOSE,90)*1.01,10);
DRAWTEXT(CROSS(V1,V2),V1+0.05,''),colorgreen;
VAR1:=LLV(LOW,21);
VAR2:=HHV(HIGH,21);
AK1:=EMA((((CLOSE - VAR1) / (VAR2 - VAR1)) * 100),5);
AK:=EMA((((CLOSE - VAR1) / (VAR2 - VAR1)) * 50),13);
AB:=CROSS(AK1,AK);
DRAWTEXT((AB = 1),(LOW * 0.99),''),colormagenta;
AA1:=AMOUNT/V;
BB1:=L<AA1*0.9;
CC1:=(C-REF(C,1))/REF(C,1)*100>1.2;
DD1:=L<MA(C,5)*0.921;
EE1:=V<MA(V,5)*1.5;
建仓:=BB1 AND CC1 AND DD1 AND EE1,LINETHICK0,COLOR0099FF;
DRAWTEXT(建仓,L*0.99,''),COLOR0099FF;
VAR3AA:=IF((CLOSE>REF(CLOSE,1)),88,0);
VAR4AA:=IF(((CLOSE)/(REF(CLOSE,1))>1.05) AND ((HIGH)/(CLOSE)<1.01) AND (VAR3AA>0),91,0);
DRAWTEXT(FILTER((VAR4AA>90),45),(LOW)*(0.93),'★ '),COLOR00FFFF;
DRAWTEXT(FILTER((VAR4AA>90),35),(LOW)*(0.99000001),'★'),COLOR00FFFF;
A1AA:=9;
A2AA:=(REF(CLOSE,A1AA+1)<CLOSE);
DRAWTEXT(FILTER((A2AA>-0.5),84),(HIGH)*(1.05),''),COLORFFFFFF;
VAR6:=REF(C,1);
VAR7:=SMA(MAX(C-VAR6,0),6,1)/SMA(ABS(C-VAR6),6,1)*100;
DRAWTEXT(CROSS(82,VAR7),H*1.01,''),colorblue;
DIF:=EMA(C,12)-EMA(C,26);
DEA:=EMA(DIF,9);
MACD:=(DIF-DEA)*2,COLORSTICK;
MACD翻红:CROSS(DIF,DEA);
SAR翻红:CROSS(C,SAR(10,2,20));
EMA翻红:CROSS(EXPMA(C,7),EXPMA(C,21));
MTM:=C-REF(C,1);
DX:=100*EMA(EMA(MTM,6),6)/EMA(EMA(ABS(MTM),6),6);
YXF:=IF(LLV(DX,2)=LLV(DX,7) AND COUNT(DX<0,2) AND CROSS(DX,MA(DX,2)),1,0);
蓝:IF(FILTER(YXF=1,5),20,0),colorliblue,LINETHICK3;
红: IF(FILTER(YXF=1,5),10,0),colorred,LINETHICK2;
黄: IF(FILTER(YXF=1,5),5,0),coloryellow,LINETHICK1;
DIF3:=EMA(CLOSE,12)-EMA(CLOSE,26);
DEA3:=EMA(DIF3,9);
MACD3 := 2*(DIF3-DEA3);
RSV:=(CLOSE-LLV(LOW,9))/(HHV(HIGH,9)-LLV(LOW,9))*100;
K:=SMA(RSV,3,1);
D:=SMA(K,3,1);
J:=3*K-2*D;
止跌:MACD3>REF(MACD3,1) AND REF(MACD3,2)>=REF(MACD3,1) AND J<50 AND C>REF(C,1) AND C>O AND J>REF(J,1);
DIFF:=EMA(CLOSE,12)-EMA(CLOSE,26);
DEA:=EMA(DIFF,9);
macd上拐:REF(DEA,2)>REF(DEA,1) AND REF(DEA,1)<DEA;
VAR2:MA(C,13),colorred,LINETHICK1;
上翘:IF(VAR2>REF(VAR2,1),VAR2,DRAWNULL),colorred,LINETHICK1;
下拐:IF(VAR2<REF(VAR2,1),VAR2,DRAWNULL),colorgreen,LINETHICK1;