同花顺区间三分割主图指标公式
[code]起点:=60;终点:=10;切换:=5;
DRAWGBKLAST(1,STRIP(RGB(30,80,220),RGB(130,80,180),1));
nx:=CURRBARSCOUNT+1;
wz:=CURRBARSCOUNT+1=1;
wx:=CURRBARSCOUNT+1=起点;
wt:=BARSLAST(wx);
wxz:=IF(wt>=0,1,DRAWNULL);
QH:=IF(nx>=终点 AND nx<=起点,H,DRAWNULL);
QL:=IF(nx>=终点 AND nx<=起点,L,DRAWNULL);
XZ:=IF(nx>=终点,1,DRAWNULL);
//分割计算
ZH:=HHV(QH,0);
ZL:=LLV(QL,0);
HXT:=(ZH-ZL);
J1:=ZH-HXT*0.241;
J2:=ZH-HXT*0.382;
J3:=ZH-HXT*0.613;
J4:=ZH-HXT*0.786;
JXT:=(ZH-ZL)/8;
H1:=ZH-JXT*1;
H2:=ZH-JXT*2;
H3:=ZH-JXT*3;
H4:=ZH-JXT*5;
H5:=ZH-JXT*6;
H6:=ZH-JXT*7;
BXT:=(ZH-ZL)/10;
B1:=ZH-BXT*1;
B2:=ZH-BXT*2;
B3:=ZH-BXT*3;
B4:=ZH-BXT*4;
B5:=ZH-BXT*6;
B6:=ZH-BXT*7;
B7:=ZH-BXT*8;
B8:=ZH-BXT*9;
//股票k线
STICKLINE(OPEN,CLOSE ,OPEN,9,0 ),COLOR000000;
STICKLINE(OPEN>CLOSE ,CLOSE ,OPEN,8,0 ),COLOR007700;
STICKLINE(OPEN>CLOSE ,CLOSE ,OPEN,7,0 ),COLOR009900;
STICKLINE(OPEN>CLOSE ,CLOSE ,OPEN,5,0 ),COLOR00bb00;
STICKLINE(OPEN>CLOSE ,CLOSE ,OPEN,3,0 ),COLOR00dd00;
STICKLINE(OPEN>CLOSE ,HIGH,LOW,1.5 ,0 ),COLOR00ff00;
STICKLINE(CLOSE>=OPEN ,CLOSE,OPEN,8,0) ,COLOR000077;
STICKLINE(CLOSE>=OPEN ,CLOSE,OPEN,7,0) ,COLOR000099;
STICKLINE(CLOSE>=OPEN ,CLOSE,OPEN,5,0) ,COLOR0000bb;
STICKLINE(CLOSE>=OPEN ,CLOSE,OPEN,3,0) ,COLOR0000dd;
STICKLINE(CLOSE>=OPEN ,HIGH,LOW,1.5,0 ),COLOR0000FF;
STICKLINE(HIGH=LOW AND CLOSE>REF(CLOSE,1),HIGH-0.01,HIGH+0.01,8,0 ),COLOR0000FF;
STICKLINE(HIGH=LOW AND CLOSE<REF(CLOSE,1),HIGH-0.01,HIGH+0.01,8,0 ),COLOR00FF00;
//分割显示
IF 切换>=1 AND 切换<=3 THEN BEGIN
VERLINE(nx=终点 OR nx=起点,2),COLOR009fff;
x1:=IF(切换=1,J1,IF(切换=2,H1,IF(切换=3,B1,DRAWNULL)));
x2:=IF(切换=1,J2,IF(切换=2,H2,IF(切换=3,B2,DRAWNULL)));
x3:=IF(切换=1,J3,IF(切换=2,H3,IF(切换=3,B3,DRAWNULL)));
x4:=IF(切换=1,J4,IF(切换=2,H4,IF(切换=3,B4,DRAWNULL)));
高:BACKSET(IF(wz,ZH,DRAWNULL),起点-1)*wxz,COLORff88ff,LINETHICK2;
低:BACKSET(IF(wz,ZL,DRAWNULL),起点-1)*wxz,COLORff88ff,LINETHICK2;
中:BACKSET(IF(wz,(ZH+ZL)/2,DRAWNULL),起点-1)*wxz,COLORff88ff;
分1:BACKSET(IF(wz,X1,DRAWNULL),起点-1)*wxz,COLORffff00;
分2:BACKSET(IF(wz,X2,DRAWNULL),起点-1)*wxz,COLORffff00;
分3:BACKSET(IF(wz,X3,DRAWNULL),起点-1)*wxz,COLORffff00;
分4:BACKSET(IF(wz,X4,DRAWNULL),起点-1)*wxz,COLORffff00;
END;
IF 切换=2 OR 切换=3 THEN BEGIN
x5:=IF(切换=2,H5,B5);
x6:=IF(切换=2,H6,B6);
分5:BACKSET(IF(wz,X5,DRAWNULL),起点-1)*wxz,COLORffff00;
分6:BACKSET(IF(wz,X6,DRAWNULL),起点-1)*wxz,COLORffff00;
END;
IF 切换=3 THEN BEGIN
x7:=B7;
x8:=B8;
分7:BACKSET(IF(wz,X7,NULL),起点-1)*wxz,COLORffff00;
分8:BACKSET(IF(wz,X8,NULL),起点-1)*wxz,COLORffff00;
END;
//分割提示
DRAWTEXT(wz,高,‘`’+TOSTRING(高,2)+‘(高)’),COLORff88ff;
DRAWTEXT(wz,低,‘`’+TOSTRING(低,2)+‘(低)’),COLORff88ff;
DRAWTEXT(wz,中,‘`’+TOSTRING(中,2)+‘(中)’),COLORff88ff;
DRAWTEXT(wz,分1,‘`’+TOSTRING(分1,2)+‘(分1)’),COLORffffff;
DRAWTEXT(wz,分2,‘`’+TOSTRING(分2,2)+‘(分2)’),COLORffffff;
DRAWTEXT(wz,分3,‘`’+TOSTRING(分3,2)+‘(分3)’),COLORffffff;
DRAWTEXT(wz,分4,‘`’+TOSTRING(分4,2)+‘(分4)’),COLORffffff;
DRAWTEXT(wz,分5,‘`’+TOSTRING(分5,2)+‘(分5)’),COLORffffff;
DRAWTEXT(wz,分6,‘`’+TOSTRING(分6,2)+‘(分6)’),COLORffffff;
DRAWTEXT(wz,分7,‘`’+TOSTRING(分7,2)+‘(分7)’),COLORffffff;
DRAWTEXT(wz,分8,‘`’+TOSTRING(分8,2)+‘(分8)’),COLORffffff;
IF 切换=4 THEN BEGIN
AA5:MA(C,5),colorffffff;
AA10:MA(C,10),color00ffff;
AA20:MA(C,20),color009fff;
AA30:MA(C,30),colorffff00;
AA60:MA(C,60),color0000ff;
AA120:MA(C,120),color00ff00;
AA250:MA(C,250),colorff00ff;
zdx:=MAX(AA5,AA10,AA20,AA30,AA60,AA120,AA250);
ZXx:=MIN(AA5,AA10,AA20,AA30,AA60,AA120,AA250);
nhd:=(zdx/ZXx-1)*100;
中位线:=(AA5+AA10+AA20+AA30+AA60+AA120+AA250)/7;
PARTLINE(中位线,1,RGB(255,100,255),1,RGB(255,100,255)),LINETHICK2;
DRAWTEXT(CURRBARSCOUNT+1=1,中位线,‘``中位线:’+TOSTRING(中位线,2)+‘`\n``粘合度:’+TOSTRING(nhd,2)+‘%’),colorff88ff;
END;
IF 切换=5 THEN BEGIN
BOLL:MA(CLOSE,20),COLORcccccc;//曲线属性--输出线性--不输出
PARTLINE(BOLL,BOLL>BOLL[1],RGB(255,0,0),BOLL<=BOLL[1],RGB(0,255,255));
UB:BOLL+2*STD(CLOSE,20),COLORff88ff;
LB:BOLL-2*STD(CLOSE,20),COLOR00FFff;
DRAWTEXT(CURRBARSCOUNT+1=1,BOLL,‘``中轨值:’+TOSTRING(BOLL,2)+‘`\n``上下轨比:’+TOSTRING((UB/LB-1)*100,2)+‘%’),colorff88ff;
END;
DRAWTEXT_FIX(CURRBARSCOUNT=1,1/100,0,0,‘股旁网【分割图】 当前是’+IF(切换=1,‘[黄金分割]’,IF(切换=2,‘[江恩分割]’,
IF(切换=3,‘[百分比]’,IF(切换=4,‘[平均线]’,‘布林线’))))),color00ffff;
[/code]
页:
[1]