以下是通达信BBD顶底背离副图指标公式
源码
AL:=(O+L+H+C)/4;
AO:=SMA(AL,5,1)-SMA(AL,13,1);
BBD:(AO-SMA(AO,3,1))*100,COLORBC1717,LINETHICK2;
{BBD支撑线定义}
BBD支撑线:=SMA(BBD,5,2),COLOR0033FF,LINETHICK1;
RSV1:=BBD;
RSV2:=BBD支撑线;
STICKLINE(BBD>=REF(BBD,1) AND BBD>0,0,BBD,0.4,0),COLOR871F78;
STICKLINE(BBD>=REF(BBD,1) AND BBD<0,0,BBD,1,0),COLOR871F78;
STICKLINE(BBD<REF(BBD,1) AND BBD<0,0,BBD,0.4,0),COLOR8E6B23;
STICKLINE(BBD<REF(BBD,1) AND BBD>0,0,BBD,1,0),COLOR8E6B23;
SV1:=BARSLAST(REF(CROSS(RSV1,RSV2),1));
SV1A:=REF(CLOSE,SV1+1)>CLOSE AND RSV1>REF(RSV1,SV1+1) AND
CROSS(RSV1,RSV2); {www.goodgupiao.com}
B底背:IF(SV1A,RSV2,DRAWNULL),COLOR3366FF;
DRAWTEXT(SV1A,RSV2,'B底背'),COLOR0033FF;
SV2:=BARSLAST(REF(CROSS(RSV2,RSV1),1));
SV2A:=REF(CLOSE,SV2+1)<CLOSE AND REF(RSV1,SV2+1)>RSV1 AND CROSS(RSV2,RSV1);
B顶背:IF(SV2A,RSV2,DRAWNULL),COLORFFFF00;
DRAWTEXT(SV2A,RSV2,'B顶背'),COLORFFFF00;
顶:HHV(BBD,13),COLOR9F9F5F,DOTLINE;
底:LLV(BBD,13),COLOR9F9F5F,DOTLINE;
IF(BBD>REF(BBD,1)*1.008,BBD ,DRAWNULL),COLORWHITE,LINETHICK2;
IF(BBD<REF(BBD,1),BBD ,DRAWNULL),COLOR32CD32,LINETHICK2;