大智慧用背离看波段买卖指标公式
INPUT:K(9,0,120);
DRAWGBK(C,strip(RGB(0,0,0),RGB(0,0,0),0));
{-----------波段----------}
DRAWTEXTAbs(10,10,'■可考察股性调整【线性回归预测(C,K)】的参数.当前【"'+STKLABEL+'"参数.K='+K+'】'),COLOR00FFFF,LINETHICK2,LAYER0;
PC:((2*C+H+L+(2*C-H-L))/4+AMOUNT/vol/100)/2,COLOR00FFFF,linethick0;
JC9:(FORCAST(PC,K)+WMA(PC,K)+EMA(PC,K/2)+MA(PC,K/2))/4,linethick0;;
LLX:=llV(JC9,2);
DRAWGBK(JC9<>LLX,STRIP(RGB(0,0,255),RGB(60,0,50),0)),LAYER0; {-------波段背景------};
{----------波段辅助看透乖离率的背离----------}
JC99:=(PC-JC9)/JC9*100;
LLX2:=(PC-LLX)/LLX*100;
PARTLINE(JC99,JC99=LLX2,rgb(0,255,255),JC99<>LLX2,rgb(255,0,0)),linethick2,LAYER0;
FILLRGN(JC99,0,JC99=LLX2,rgb(0,40,0),JC99<>LLX2,rgb(80,0,80)),layer7;
{补充和预判主线}
PMA:(PC-FORCAST(PC,K))/FORCAST(PC,K)*100,COLOR00FFFF,DOTLINE;
{显示背离}
gj:=MAX(C,O);
L4:=LLV(gj,5);
gt:=JC99>REF(JC99,1) AND REF(JC99,1)<REF(JC99,2);
A1:=BArslAST(REF(gt,1));
底背离:=REF(L4,A1+1)>CLOSE AND JC99>REF(JC99,A1+1) AND gt;
DRAWTEXT(底背离,JC99-2.,'▼'),ALIGN1,COLOR00FF00,LINETHICK1,LAYER0;
DRAWTEXT(底背离,JC99-2.5,''+NUMTOSTRN((L+C)/2,2)+'←底背'),ALIGN1,Color00FF00,linethick1;
STICKLINE( 底背离,JC99,JC99-2,0.5,0 ),color00FF00 ;
H4:=HHV(gj,5);
gt2:=JC99<REF(JC99,1) AND REF(JC99,1)>REF(JC99,2);
A2:=BARSLAST(REF(gt2,1));
顶背离:= REF(H4,A2+1)<H4 AND JC99<REF(JC99,A2+1) AND gt2;
DRAWTEXT(顶背离,JC99+2,'▲'),ALIGN1,COLOR00ffFF,LINETHICK1,LAYER0;
DRAWTEXT(顶背离,JC99+2.5,''+NUMTOSTRN((H+C)/2,2)+'←顶背'),ALIGN1,Color00ffFF,linethick1;
STICKLINE( 顶背离,JC99,JC99+2,0.5,0 ),color0089FF ;
{--------未来函zig仅仅用于对着波段调整参数---------}
ZF:=10;
Z10:=ZIG(4,ZF);
{PARTLINE(Z10,Z10>=REF(Z10,1),rgb(255,0,0),Z10<REF(Z10,1),rgb(0,255,0)),DOTLINE;}
Low1:=TROUGH(4,10 ,1);
High1:=PEAK(4,10,1);
0,COLOR00FFFF,DOTLINE;
DRAWLINE(Z10=Low1,0,Z10=High1,0,0),COLOR0000FF,LINETHICK2;
DRAWLINE(Z10=High1,0,Z10=Low1,0,0),COLOR00Ff00,LINETHICK2;
STICKLINE(Z10=Low1,0.5,-0.5,2,0),COLOR00FF00,LAYER0;
STICKLINE(Z10=High1,0.5,-0.5,2,0),COLOR0000FF,LAYER0;
STICKLINE(barstatus=2 ,0.5,-0.5,2,0),COLOR00FFFF;