通达信公式通道主图
MID_TDMS:=(3*C+L+H)/5;
波动中枢:=EMA(EMA(EMA(MID_TDMS,20),2),2),POINTDOT;
BDUP:=REF(HHV(100*(HIGH-波动中枢)/波动中枢,120),1),NODRAW;
BDDN:=REF(LLV(100*(LOW-波动中枢)/波动中枢,120),1),NODRAW;
顶:=EMA(EMA(EMA(REF(波动中枢,1)*(1+BDUP/100),2),2),2);
底:=EMA(EMA(EMA(REF(波动中枢,1)*(1+BDDN/100),2),2),2);
地线:=底;
中线:=REF(波动中枢,1);
天线:=顶;
绘图范围:=IFF(BARSCOUNT(CLOSE)>120,1,0);
STICKLINE(绘图范围,地线,地线+(中线-地线)*(20/20),11,0),COLOR000000;
STICKLINE(绘图范围,地线,地线+(中线-地线)*(19/20),11,0),COLOR000008;
STICKLINE(绘图范围,地线,地线+(中线-地线)*(18/20),11,0),COLOR000010;
STICKLINE(绘图范围,地线,地线+(中线-地线)*(17/20),11,0),COLOR000018;
STICKLINE(绘图范围,地线,地线+(中线-地线)*(16/20),11,0),COLOR000020;
STICKLINE(绘图范围,地线,地线+(中线-地线)*(15/20),11,0),COLOR000028;
STICKLINE(绘图范围,地线,地线+(中线-地线)*(14/20),11,0),COLOR000030;
STICKLINE(绘图范围,地线,地线+(中线-地线)*(13/20),11,0),COLOR000038;
STICKLINE(绘图范围,地线,地线+(中线-地线)*(12/20),11,0),COLOR000040;
STICKLINE(绘图范围,地线,地线+(中线-地线)*(11/20),11,0),COLOR000048;
STICKLINE(绘图范围,地线,地线+(中线-地线)*(10/20),11,0),COLOR000050;
STICKLINE(绘图范围,地线,地线+(中线-地线)*(9/20),11,0),COLOR000058;
STICKLINE(绘图范围,地线,地线+(中线-地线)*(8/20),11,0),COLOR000060;
STICKLINE(绘图范围,地线,地线+(中线-地线)*(7/20),11,0),COLOR000068;
STICKLINE(绘图范围,地线,地线+(中线-地线)*(6/20),11,0),COLOR000070;
STICKLINE(绘图范围,地线,地线+(中线-地线)*(5/20),11,0),COLOR000078;
STICKLINE(绘图范围,地线,地线+(中线-地线)*(4/20),11,0),COLOR000080;
STICKLINE(绘图范围,地线,地线+(中线-地线)*(3/20),11,0),COLOR000088;
STICKLINE(绘图范围,地线,地线+(中线-地线)*(2/20),11,0),COLOR000090;
STICKLINE(绘图范围,地线,地线+(中线-地线)*(1/20),11,0),COLOR000098;
STICKLINE(绘图范围,天线,天线-(天线-中线)*(20/20),11,0),COLOR000000;
STICKLINE(绘图范围,天线,天线-(天线-中线)*(19/20),11,0),COLOR080800;
STICKLINE(绘图范围,天线,天线-(天线-中线)*(18/20),11,0),COLOR101000;
STICKLINE(绘图范围,天线,天线-(天线-中线)*(17/20),11,0),COLOR181800;
STICKLINE(绘图范围,天线,天线-(天线-中线)*(16/20),11,0),COLOR202000;
STICKLINE(绘图范围,天线,天线-(天线-中线)*(15/20),11,0),COLOR282800;
STICKLINE(绘图范围,天线,天线-(天线-中线)*(14/20),11,0),COLOR303000;
STICKLINE(绘图范围,天线,天线-(天线-中线)*(13/20),11,0),COLOR383800;
STICKLINE(绘图范围,天线,天线-(天线-中线)*(12/20),11,0),COLOR404000;
STICKLINE(绘图范围,天线,天线-(天线-中线)*(11/20),11,0),COLOR484800;
STICKLINE(绘图范围,天线,天线-(天线-中线)*(10/20),11,0),COLOR505000;
STICKLINE(绘图范围,天线,天线-(天线-中线)*(9/20),11,0),COLOR585800;
STICKLINE(绘图范围,天线,天线-(天线-中线)*(8/20),11,0),COLOR606000;
STICKLINE(绘图范围,天线,天线-(天线-中线)*(7/20),11,0),COLOR686800;
STICKLINE(绘图范围,天线,天线-(天线-中线)*(6/20),11,0),COLOR707000;
STICKLINE(绘图范围,天线,天线-(天线-中线)*(5/20),11,0),COLOR787800;
STICKLINE(绘图范围,天线,天线-(天线-中线)*(4/20),11,0),COLOR808000;
STICKLINE(绘图范围,天线,天线-(天线-中线)*(3/20),11,0),COLOR888800;
STICKLINE(绘图范围,天线,天线-(天线-中线)*(2/20),11,0),COLOR909000;
STICKLINE(绘图范围,天线,天线-(天线-中线)*(1/20),11,0),COLOR989800;
回归上限:IFF(绘图范围,天线,DRAWNULL),COLOR989800,LINETHICK2;
回归下限:IFF(绘图范围,地线,DRAWNULL),COLOR000098,LINETHICK2;
上涨偏离度:=100*(HIGH-波动中枢)/波动中枢,NODRAW;
下跌偏离度:=100*(LOW-波动中枢)/波动中枢,NODRAW;
STICKLINE(绘图范围 AND CLOSE>OPEN,HIGH,CLOSE,0,0),COLORRED;
STICKLINE(绘图范围 AND CLOSE>OPEN,LOW,OPEN,0,0),COLORRED;
STICKLINE(绘图范围 AND CLOSE>OPEN,CLOSE,OPEN,3,1),COLORRED;
STICKLINE(绘图范围 AND CLOSE==OPEN,HIGH,LOW,0,0),COLORWHITE;
STICKLINE(绘图范围 AND CLOSE==OPEN,CLOSE,OPEN,3,0),COLORWHITE;
STICKLINE(绘图范围 AND CLOSE<OPEN,HIGH,LOW,0,0),COLORGREEN;
STICKLINE(绘图范围 AND CLOSE<OPEN,CLOSE,OPEN,3,0),COLORGREEN;
波动敞口:((回归上限-波动中枢)/波动中枢+(波动中枢-回归下限)/波动中枢)*100,NODRAW,COLOR00C6FF;
涨过头:=IFF(HIGH>回归上限,1,0);
跌过头:=IFF(LOW<回归下限,1,0);
风险标记:IFF(涨过头,CLOSE,DRAWNULL),NODRAW,COLORCYAN;
机会标记:IFF(跌过头,CLOSE,DRAWNULL),NODRAW,COLORYELLOW;
DRAWICON(涨过头,HIGH*1.01,2);
DRAWICON(跌过头,LOW*0.99,1);
VARC:=SMA(MAX(CLOSE-REF(CLOSE,1),0),6,1)/SMA(ABS(CLOSE-REF(CLOSE,1)),6,1)*100;
逃顶:=IFF(CROSS(84,VARC) AND 上涨偏离度>20,1,0),NODRAW;
VAR1:=(HIGH+LOW+OPEN+2*CLOSE)/5;
VAR2:=REF(VAR1,1);
VAR3:=SMA(MAX(VAR1-VAR2,0),10,1)/SMA(ABS(VAR1-VAR2),10,1)*100;
VAR4:=FILTER(IFF(COUNT(VAR3<20,5)>=1 AND COUNT(VAR1==LLV(VAR1,10),10)>=1 AND CLOSE>=OPEN*1.038 AND VOL>MA(VOL,5)*1.2,1,0),5);
抄底:=IFF(VAR4 AND EXIST(下跌偏离度*(-1)>15,3),1,0);
DRAWICON(绘图范围 AND 逃顶,HIGH*1.02,14);
DRAWICON(绘图范围 AND 抄底,LOW*0.98,13);
DRAWTEXT(绘图范围 AND 逃顶,MAX(H*1.05,回归上限*1.03),'逃'),COLORCYAN;
DRAWTEXT(绘图范围 AND 抄底,MIN(LOW*0.995,回归下限),'抄'),COLORYELLOW; |