通达信价格波段调整指标公式
2020/9/7 19:11:46
{适用范围:因存在概率统计(正态分布算法),所以本指标仅适用于大盘或指数基金。}
{RSI赋值}
LC:=REF(CLOSE,1);
RSICLOSE:=SMA(MAX(CLOSE-LC,0),14,1)/SMA(ABS(CLOSE-LC),14,1)*CLOSE;
LH:=REF(HIGH,1);
RSI_H:=SMA(MAX(HIGH-LH,0),14,1)/SMA(ABS(HIGH-LH),14,1)*HIGH;
LL:=REF(LOW,1);
RSI_L:=SMA(MAX(LOW-LL,0),14,1)/SMA(ABS(LOW-LL),14,1)*LOW;
RSIHIGH:=MAX(RSICLOSE,MAX(RSI_H,RSI_L));
RSILOW:=MIN(RSICLOSE,MIN(RSI_H,RSI_L));
{KD模糊数学化}
HLJ:=(HHV(RSIHIGH,5)+LLV(RSILOW,5))/2;
HLC:=HHV(RSIHIGH,5)-LLV(RSILOW,5);
RSV1:=2*POW((RSICLOSE-LLV(RSILOW,5))/HLC,2);
RSV2:=1-2*POW((RSICLOSE-HHV(RSIHIGH,5))/HLC,2);
RSVX:=100*IF(RSICLOSE<=HLJ,RSV1,RSV2);
RSIK:=SMA(RSVX,3,1)*RSICLOSE;
RSID:=SMA(RSIK,3,1);
{正态分布画线}
RSI_K: IF(CURRBARSCOUNT>30,DRAWNULL,RSIK),COLORWHITE;
RSI_D: IF(CURRBARSCOUNT>30,DRAWNULL,RSID),COLORBLUE;
K_UB: IF(CURRBARSCOUNT>30,DRAWNULL,MA(RSIK,21)+2*STDP(RSIK,21)),DOTLINE,COLORYELLOW;
K_LB: IF(CURRBARSCOUNT>30,DRAWNULL,MA(RSIK,21)-2*STDP(RSIK,21)),DOTLINE,COLORLIGREEN;
线斜率:=(SLOPE(RSID,3)+SLOPE(RSIK,3))>0 OR CROSS(RSIK,RSID);
红线条件:=CURRBARSCOUNT<=30 AND 线斜率=1;
红线:IF(红线条件=1,RSIK,DRAWNULL),COLORRED;
红线提示1:=IF(红线条件=1 AND 红线条件!=REF(红线条件,1),1,0);
红线提示2:=IF(红线条件=0 AND 红线条件!=REF(红线条件,1),1,0);
DRAWICON(红线提示1=1,RSIK,1);
DRAWICON(红线提示2=1,RSIK,2);
{大盘风向标}
DHLJ:=(HHV("999999$HIGH",5)+LLV("999999$LOW",5))/2;
DHLC:=HHV("999999$HIGH",5)-LLV("999999$LOW",5);
DRSV1:=2*POW(("999999$CLOSE"-LLV("999999$LOW",5))/DHLC,2);
DRSV2:=1-2*POW(("999999$CLOSE"-HHV("999999$HIGH",5))/DHLC,2);
DRSVD:=100*IF("999999$CLOSE"<=DHLJ,DRSV1,DRSV2);
DPK:=SMA(DRSVD,3,1)*"999999$CLOSE";
DPD:=SMA(DPK,3,1);
大风:=(SLOPE(DPD,3)+SLOPE(DPK,3))>0 OR CROSS(DPK,DPD);
DRAWTEXT_FIX(BARSTATUS=2 AND 大风=1,0.1,0.3,0,'【大 盘 顺 风】'),COLORCYAN;
DRAWTEXT_FIX(BARSTATUS=2 AND 大风=0,0.1,0.3,0,'【大 盘 无 风 或 逆 风】'),COLORRED;
DRAWTEXT_FIX(1,0,0,0,'【 大 盘(指数基金) 波 段 指 标 】'),COLORGRAY;
投股票 网 www.tou18. cn
股市公式下载推荐