一、通达信指令式买卖指标公式
MA1:=MA(CLOSE,5);
MA2:=MA(CLOSE,10);
P01:=IF(MA1>MA2,1,IF(MA2>MA1,-1,0));
MA3:=MA(CLOSE,3);
MA4:=MA(CLOSE,5);
P02:=IF(MA3>MA4,1,IF(MA4>MA3,-1,0));
MA5:=MA(CLOSE,12);
MA6:=MA(CLOSE,50);
P03:=IF(MA5>MA6,1,IF(MA6>MA5,-1,0));
RSV:=(CLOSE-LLV(LOW,5))/(HHV(HIGH,5)-LLV(LOW,5))*100;
K:=EMA(RSV,3);
D:=EMA(K,3);
P04:=IF(K>D,1,IF(D>K,-1,0));
DIF:=EMA(CLOSE,12)-EMA(CLOSE,26);
DEA:=EMA(DIF,9);
MACD:=(DIF-DEA)*2;
P05:=IF(DIF>DEA,1,IF(DEA>DIF,-1,0));
TR2:=EMA(EMA(EMA(CLOSE,12),12),12);
TRIX:=(TR-REF(TR,1))/REF(TR,1)*100;
MATRIX:=MA(TRIX,9) ;
P06:=IF(TRIX>MATRIX,1,IF(MATRIX>TRIX,-1,0));
TR1:=EMA(MAX(MAX(HIGH-LOW,ABS(HIGH-REF(CLOSE,1))),ABS(REF(CLOSE,1)-LOW)),7);
HD :=HIGH-REF(HIGH,1);
LD :=REF(LOW,1)-LOW;
DMP:=EMA(IF(HD>0 AND HD>LD,HD,0),7);
DMM:=EMA(IF(LD>0 AND LD>HD,LD,0),7);
PDI:= DMP*100/TR;
MDI:= DMM*100/TR;
ADX:= EMA(ABS(MDI-PDI)/(MDI+PDI)*100,7);
ADXR:=EMA(ADX,7);
P07:=IF(PDI>MDI AND ADX>PDI AND ADX>50,3,
IF(PDIMDI AND ADX>50,-3,0));
LC:=REF(CLOSE,1);
RSI1:=EMA(MAX(CLOSE-LC,0),5)/EMA(ABS(CLOSE-LC),5)*100;
P08:=IF(RSI1>80,1,IF(RSI1<20,-1,0));
TYP:=(HIGH+LOW+CLOSE)/3;
CCI:=(TYP-MA(TYP,8))/(0.015*AVEDEV(TYP,8));
P09:=IF(CCI>180,2,IF(CCI<-180,-2,0));
WR1:=(CLOSE-LLV(LOW,6))/(HHV(HIGH,6)-LLV(LOW,6))*100;
P10:= IF(WR1>80,1,IF(WR1<20,-1,0));
OSC:=100*(CLOSE-MA(CLOSE,20));
P11:=IF(OSC>0,1,IF(OSC<0,-1,0));
MOM:=CLOSE-REF(CLOSE,7);
P12:=IF(MOM>0,1,IF(MOM<0,-1,0));
DPO:=CLOSE-REF(MA(CLOSE,11),11/2+1);
P13:=IF(DPO>0,1,IF(DPO<0,-1,0));
MB:=MA(CLOSE,12);
R:=(CLOSE-MB)*(CLOSE-MB);
X1:=MA(R,12);
X2:=SQRT(X1);
D1:=1;
UPPER:=MB+(D1*X2);
LOWER:=MB-(D1*X2);
P14:=IF(CLOSE>UPPER,2,IF(CLOSE
BR:=SUM(MAX(0,HIGH-REF(CLOSE,1)),14)/SUM(MAX(0,REF(CLOSE,1)-LOW),14)*100;
AR:=SUM(HIGH-OPEN,14)/SUM(OPEN-LOW,14)*100;
P15:=IF(BR>350 OR AR>180,3,IF(BR<45 OR AR<45,-3,0));
TH:=SUM(IF(CLOSE>REF(CLOSE,1),VOL,0),14);
TL:=SUM(IF(CLOSE[
]TQ:=SUM(IF(CLOSE=REF(CLOSE,1),VOL,0),14);
VR:=0100*(TH*2+TQ)/(TL*2+TQ);
P16:=IF(VR>350,3,IF(VR<45,-3,0));
WVAD:=SUM((CLOSE-OPEN)/(HIGH-LOW)*VOL,6)/10000;
P17:=IF(WVAD>0,1,IF(WVAD<0,-1,0));
VOLUME:=MA(VOL,4)/VOL;
MID:=100*(HIGH+LOW-REF(HIGH+LOW,1))/(HIGH+LOW);
EMV:=MA(MID*VOLUME*(HIGH-LOW)/MA(HIGH-LOW,4),4);
P18:=IF(EMV>0,1,IF(EMV<0,-1,0));
VA:=IF(CLOSE>REF(CLOSE,1),VOL,-VOL);
OBV:=SUM(IF(CLOSE=REF(CLOSE,1),0,VA),0);
MAOBV:=EMA(OBV,24);
P19:=IF(OBV>MAOBV,1,IF(OBV
PVI:= PVI,COLORWHITE;
MPVI:=EMA(PVI,24),COLORYELLOW;
P20:=IF(PVI>MPVI,1,IF(PVI
NVI:=NVI,COLORWHITE;
MNVI:=EMA(NVI,24),COLORYELLOW;
P21:=IF(NVI>MNVI,2,IF(NVI
MASS:=SUM(MA(HIGH-LOW,9)/MA(MA(HIGH-LOW,9),9),25);
MA7:=MA(CLOSE,9);
P22:=IF(MA7>REF(MA7,1) AND MASS>26.5,2,IF(MA7[
]AND MASS<26.5,-2,0));
NUM:=ABS(HHV(HIGH,15)-LLV(LOW,15));
DEN:=SUM(ABS(CLOSE-REF(CLOSE,1)),15);
VHF:=IF(DEN=0,0,NUM/DEN);
VHF1:=EMA(VHF,240);
P23:=IF(VHF>VHF1,1,IF(VHF
PU:=MA(CLOSE,13);
CU:=MA(VOL,13);
PU1:=(PU-REF(PU,1))/REF(PU,1)*100;
CU1:=(CU-REF(CU,1))/REF(CU,1)*100;
逆时针曲线:=PU1+CU1;
P24:=IF(逆时针曲线>REF(逆时针曲线,1),1,IF(逆时针曲线[
]LC2:=REF(CLOSE,1);
AA:=ABS(HIGH-LC2);
BB:=ABS(LOW-LC2);
CC:=ABS(HIGH-REF(LOW,1));
DD:=ABS(LC2-REF(OPEN,1));
R2:=IF(AA>BB AND AA>CC,AA+BB/2+DD/4,IF(BB>CC AND BB>AA,BB+AA/2+DD/4,CC+DD/4));
X01:=(CLOSE-LC2+(CLOSE-OPEN)/2+LC2-REF(OPEN,1));
SI:=16*X01/R2*MAX(AA,BB);
ASI:=SUM(SI,0),COLORWHITE;
MASI:=MA(ASI,6),COLORYELLOW;
P25:=IF(CLOSELLV(CLOSE,13) AND ASI=LLV(ASI,13),-1,0));
BIAS1 :=(CLOSE-MA(CLOSE,12))/MA(CLOSE,12)*100;
P26:=IF(BIAS1>10,1,IF(BIAS1<-10,-1,0));
决策曲线: (36+P01+P02+P03+P04+P05+P06+P07+P08+P09+P10+P11+P12+P13+P14+P15+P16+
P17+P18+P19+P20+P21+P22+P23+P24+P25+P26)*1.36,COLORMAGENTA;
MAJCQX:MA(决策曲线,3),COLORWHITE;
DRAWTEXT(CROSS(82.5, 决策曲线),80,'↖清仓'),COLORYELLOW;
DRAWTEXT(CROSS(75, 决策曲线),74,'减点'),COLORGREEN;
DRAWTEXT(CROSS( 决策曲线,18),16,'↖买点'),COLORRED;
回调持币:IF(决策曲线<=REF(决策曲线,1),决策曲线,DRAWNULL),COLORGREEN,LINETHICK2;
持股:IF(决策曲线>REF(决策曲线,1),决策曲线,DRAWNULL),COLORRED,LINETHICK2;
二、通达信薛斯通道和布林线主图指标公式
{参数D1是找大底的参数,默认60,只适用于大盘,如果想用于个股,需要单独定制调整}
D1:=60;
{薛斯通道1加2}
N:=13;N1:=102;M:=7;
VAR2:=CLOSE*VOL;
VAR3:=EMA((EXPMA(VAR2,3)/EXPMA(VOL,3)+EXPMA(VAR2,6)/EXPMA(VOL,6)
+EXPMA(VAR2,12)/EXPMA(VOL,12)+EXPMA(VAR2,24)/EXPMA(VOL,24))/4,N);
SUP:1.06*VAR3,COLORLIGREEN;
SDN:VAR3*0.94,COLORLIGREEN;
VAR4:=EXPMA(CLOSE,9);
LUP:EXPMA(VAR4*1.14,5),COLORCBCBFF;
LDN:EXPMA(VAR4*0.86,5),COLORCBCBFF;
{DRAWBAND(LUP,RGB(0,0,130),LDN,RGB(0,0,130));
DRAWBAND(SUP,RGB(130,81,0),SDN,RGB(130,81,0));}
{STICKLINE(1,LUP,LDN,0.1,0),COLORFAD39D;
STICKLINE(1,SUP,SDN,0.1,0),COLOR005082;}
DRAWBAND(LUP,RGB(31,111,181),LDN,RGB(31,111,181));
DRAWBAND(SUP,RGB(157,211,250),SDN,RGB(157,211,250));
AAX:=MA((2*CLOSE+HIGH+LOW)/4,5);
通道1:=AAX*N1/100;{,LINETHICK2,COLORYELLOW; }
通道2:=AAX*(200-N1)/100;{,LINETHICK2,COLORYELLOW; }
CC:=ABS((2*CLOSE+HIGH+LOW)/4-MA(CLOSE,20))/MA(CLOSE,20);
DD:=DMA(CLOSE,CC);
通道3:(1+M/100)*DD;{,LINETHICK2,COLORMAGENTA;}
通道4:(1-M/100)*DD;{,LINETHICK2,COLORMAGENTA;}
{DRAWICON(L<=SDN AND L<=LDN AND L<=通道2 AND L<=通道4 AND O<=C,L*0.97,1);
DRAWICON(H>=SUP AND H>=LUP AND H>=通道1 AND H>=通道3,H*1.03,2);}
{布林加均线加BBI}
MID : MA(CLOSE,26),COLORFFFFFF,POINTDOT;
UPPER: MID + 2*STD(CLOSE,26),COLORFFFFFF,POINTDOT;
LOWER: MID - 2*STD(CLOSE,26),COLORFFFFFF,POINTDOT;
{STICKLINE((UPPER-LOWER)
DRAWBAND(UPPER,RGB(161,94,0),LOWER,RGB(161,94,0));
MID1 : MA(CLOSE,26),COLORFFFFFF,POINTDOT;
UPPER1: MID1 + 2*STD(CLOSE,26),COLORFFFFFF,POINTDOT;
LOWER1: MID1 - 2*STD(CLOSE,26),COLORFFFFFF,POINTDOT;
MA5:MA(CLOSE,5),COLOR0220D2;
MA60:MA(CLOSE,60),COLOR00AAAA,LINETHICK2;
MA120:MA(CLOSE,120),COLORFF44FF,LINETHICK3;
MA250:MA(CLOSE,250),COLORFF0000,LINETHICK3;
BBI:(MA(CLOSE,3)+MA(CLOSE,6)+MA(CLOSE,12)+MA(CLOSE,24))/4,COLOR00FF00;
{通道31:(1+M/100)*DD,LINETHICK2,COLORMAGENTA;
通道41:(1-M/100)*DD,LINETHICK2,COLORMAGENTA;}
{重绘K线}
DRAWKLINE(HIGH,OPEN,LOW,CLOSE);