通达信股软的使用率,可以说是最为普遍,乘风也一直在用。以前是以飞狐为主,现在对通达信有点偏爱,于是用心研究了下通达信,其实通达信也能做成飞狐效果。在此,我会多解释写的方法!我说的只是方法,在论坛得到了那么多老师和热心人的帮助,所以也报以感恩的心,将自己的一点心得和技巧说出来,为指标热爱者作一点参考!
修改了一下陆游《卜算子 咏梅》的其中“无意苦争春,一任群芳妒。零落成泥碾作尘,只有香如故。”名句代表我的心境:
无意强争春,不与群芳妒。授人以渔报众恩,吾心乐如故。
第一课,如何在通达信里画色彩
通达信画色带,没有飞狐轻松随意方便,一点局限性,就是只能定义AB之间的画色带
DRAWBAND:画出带状线.
用法:DRAWBAND(VAL1,COLOR1,VAL2,COLOR2),当VAL1>VAL2时,在VAL1和VAL2之间填充COLOR1;当VAL1<VAL2时,填充COLOR2,这里的颜色均使用RGB函数计算得到。
例如:DRAWBAND(OPEN,RGB(0,224,224),CLOSE,RGB(255,96,96));
下面我以二条布林线画色带为例子说明一下,正常对MA20与MA60做二条布林画色带
{先隐藏赋值,为了能将你想看到的线型的数据显示在指标的当头位置}
MA20: MA(CLOSE,20),COLORRED,LINETHICK2;
MA60: MA(CLOSE,60),COLORFF0090,LINETHICK2;
UP:MA20+2*STD(CLOSE,20),LINETHICK1,COLOR404080;
DW:MA20-2*STD(CLOSE,20),LINETHICK1,COLORC0C0C0;
UP2:MA60+2*STD(CLOSE,60),LINETHICK1,COLOR808080;
DW2:MA60-2*STD(CLOSE,60),LINETHICK1,COLOR004000;
{然后画色带}
DRAWBAND(MA60,RGB(200,150,30),UP2,RGB(200,150,30));
DRAWBAND(MA60,RGB(100,100,150),DW2,RGB(100,100,150));
DRAWBAND(MA20,RGB(0,50,150),DW,RGB(0,50,150));
DRAWBAND(MA20,RGB(155,50,50),UP,RGB(155,50,50));
{因为画色带遮挡了原来的K线,所以要重做一次K线}
STICKLINE(C>O,H,L,0,0),COLORRED;
STICKLINE(C<=O,H,L,0,0),COLORCYAN;
STICKLINE(C>O,C,O,3.1,1),COLORRED;
STICKLINE(C<=O,C,O,3.1,0),COLORCYAN;
{最后将你想要的赋值的线画出来和变色处理}
MA20,COLOR00FFFF,LINETHICK2;
IF(MA(C,20)<REF(MA(C,20),1),MA(C,20),DRAWNULL),COLOR0B0000,LINETHICK2;
MA60,COLORFF0090,LINETHICK2;
IF(MA(C,60)<REF(MA(C,60),1),MA(C,60),DRAWNULL),COLORFFF000,LINETHICK2;
要解决这个问题,那么我们就变通一下,将指标修改一下
要做一个小限制
IF(A>B,A,B)--就是当A大于B时,显示A,否则显示B
{先隐藏赋值,为了能将你想看到的线型的数据显示在指标的当头位置}
MA20: MA(CLOSE,20),COLORRED,LINETHICK2;
MA60: MA(CLOSE,60),COLORFF0090,LINETHICK2;
UP:MA20+2*STD(CLOSE,20),LINETHICK1,COLOR404080;
DW:MA20-2*STD(CLOSE,20),LINETHICK1,COLORC0C0C0;
UP2:MA60+2*STD(CLOSE,60),LINETHICK1,COLOR808080;
DW2:MA60-2*STD(CLOSE,60),LINETHICK1,COLOR004000;
{然后画色带}
DRAWBAND(MA60,RGB(200,150,30),UP2,RGB(200,150,30));
DRAWBAND(MA60,RGB(100,100,150),DW2,RGB(100,100,150));
DRAWBAND(MA20,RGB(0,50,150),DW,RGB(0,50,150));
DRAWBAND(MA20,RGB(155,50,50),UP,RGB(155,50,50));
{IF(UP>UP2,UP2,UP)就是当UP大于UP2时,显示UP2,否则显示UP}
DRAWBAND(UP,RGB(0,150,50),IF(UP>UP2,UP2,UP),RGB(0,150,50));
DRAWBAND(DW,RGB(0,150,50),IF(DW<DW2,DW2,DW ),RGB(0,150,50));{因为画色带遮挡了原来的K线,所以要重做一次K线}
STICKLINE(C>O,H,L,0,0),COLORRED;
STICKLINE(C<=O,H,L,0,0),COLORCYAN;
STICKLINE(C>O,C,O,3.1,1),COLORRED;
STICKLINE(C<=O,C,O,3.1,0),COLORCYAN;
{最后将你想要的赋值的线画出来和变色处理}
MA20,COLOR00FFFF,LINETHICK2;
IF(MA(C,20)<REF(MA(C,20),1),MA(C,20),DRAWNULL),COLOR0B0000,LINETHICK2;
MA60,COLORFF0090,LINETHICK2;
IF(MA(C,60)<REF(MA(C,60),1),MA(C,60),DRAWNULL),COLORFFF000,LINETHICK2;
第二课,主图叠加指标,先说叠加最高和最低点无法确定的副图指标,这里以叠加MACD为例子
要叠加一个副图,首先要定义副图中心值的位置,然后再作分割处理
{先隐藏赋值,为了能将你想看到的线型的数据显示在指标的当头位置}
MA20: MA(CLOSE,20),COLORRED,LINETHICK2;
MA60: MA(CLOSE,60),COLORFF0090,LINETHICK2;
UP:MA20+2*STD(CLOSE,20),LINETHICK1,COLOR404080;
DW:MA20-2*STD(CLOSE,20),LINETHICK1,COLORC0C0C0;
UP2:MA60+2*STD(CLOSE,60),LINETHICK1,COLOR808080;
DW2:MA60-2*STD(CLOSE,60),LINETHICK1,COLOR004000;
{然后画色带}
DRAWBAND(MA60,RGB(200,150,30),UP2,RGB(200,150,30));
DRAWBAND(MA60,RGB(100,100,150),DW2,RGB(100,100,150));
DRAWBAND(MA20,RGB(0,50,150),DW,RGB(0,50,150));
DRAWBAND(MA20,RGB(155,50,50),UP,RGB(155,50,50));
{IF(UP>UP2,UP2,UP)就是当UP大于UP2时,显示UP2,否则显示UP}
DRAWBAND(UP,RGB(0,150,50),IF(UP>UP2,UP2,UP),RGB(0,150,50));
DRAWBAND(DW,RGB(0,150,50),IF(DW<DW2,DW2,DW ),RGB(0,150,50));
{叠加MACD}
DIFZ:=EMA(C,12)-EMA(C,26);
DEAZ:=EMA(DIFZ,9);
MACDZ:=2*(DIFZ-DEAZ);
HH0:=CONST(HHV(H,120))*1;{以现价的N日最高值为高点,我取120日,这个取值可以根据
自己电脑的版面而定}
LL0:=CONST(LLV(L,120))*1;{以现价的N日最低值为高点}
MM0:=CONST((HH0+LL0)/2);{取中间值}
HL0:=CONST(IF(CONST(C)>=MM0,LL0-(HH0-LL0)*0.2,HH0+(HH0-LL0)*0.2));
{此句为便于叠加副图不影响版面,当现价大于中间值时将叠加副图放在主图上沿反之放下沿
LL0-(HH0-LL0)*0.2是限制副图大小0.2可根据自己的喜好调节}
HH1:=IF(CONST(C)<MM0,HH0,HL0);{再次设定叠加副图的最高值,根据现价与中间值的关系可上可下}
LL1:=IF(CONST(C)>=MM0,LL0,HL0);{再次设定叠加副图的最低值}
HL1:=(HH1+LL1)/2;{最后确定副图的中间值位置}
STICKLINE(MACDZ>0,MACDZ*2+HL1,HL1,1,0),COLOR400080;
STICKLINE(MACDZ>0 AND MACDZ>REF(MACDZ,1),MACDZ*2+HL1,HL1,1,0),COLOR00FFFF;
STICKLINE(MACDZ<0,MACDZ*2+HL1,HL1,1,0),COLOR008080;
STICKLINE(MACDZ<0 AND MACDZ>REF(MACDZ,1),MACDZ*2+HL1,HL1,1,0),COLORC080FF;
(DIFZ*2+HL1),COLORRED;
(DEAZ*2+HL1),COLORFFFFFF;
IF(DIFZ<=REF(DIFZ,1),DIFZ*2+HL1,DRAWNULL),COLORFFF000;
{因为画色带遮挡了原来的K线,所以要重做一次K线}
STICKLINE(C>O,H,L,0,0),COLORRED;
STICKLINE(C<=O,H,L,0,0),COLORCYAN;
STICKLINE(C>O,C,O,3.1,1),COLORRED;
STICKLINE(C<=O,C,O,3.1,0),COLORCYAN;
{最后将你想要的赋值的线画出来和变色处理}
MA20,COLOR00FFFF,LINETHICK2;
IF(MA(C,20)<REF(MA(C,20),1),MA(C,20),DRAWNULL),COLOR0B0000,LINETHICK2;
MA60,COLORFF0090,LINETHICK2;
IF(MA(C,60)<REF(MA(C,60),1),MA(C,60),DRAWNULL),COLORFFF000,LINETHICK2;
第三课,如果在主图叠加有最高最低数据限制的副图,这里以叠加RSI为例子
RSI的数值最高是100,最低是0,有了这个定义就好办了(叠加KDJ性质一样),以叠加MACD的模板继续修改
首先我们要做一个叠加副图模板
HH:=CONST(HHV(C,120))*1;{取现价的N日最大值}
LL:=CONST(LLV(C,120))*1;{取现价的N日最小值}
HL:=CONST(IF(CONST((HH+LL)/2)<CONST(C),LL-(HH-LL)*0.2,HH+(HH-LL)*0.2));
{取叠加副图自动转换高低值,当现价小于中间值时以LL-(HH-LL)*0.2为副图自动转换高低值,反之以HH+(HH-LL)*0.2为副图自动转换高低值}
HH1:=IF(CONST((HH+LL)/2)>CONST(C),HH,HL);{当现价小于中间值时以最大值为最高点,反之以HL为最高点}
LL1:=IF(CONST((HH+LL)/2)<CONST(C),LL,HL);{当现价小于中间值时以最小值为最低点,反之以HL为最低点}
HLMAX:=MAX(HH1,LL1);{设定所要叠加副图比例的最大值}
HLMIN:=MIN(HH1,LL1);{设定所以叠加副图比例的最小值}
HLMN1:=(HLMAX+HLMIN)/2;{取设定所要叠加副图比例的最大最小值的中间值}
HLMN2:=HLMAX-HLMIN;{取设定所要叠加副图比例的最大最小值的差值}
HLMN3:=(副图比例最高值-副图比例最低值)/2;
HLMN4:=副图比例最高值-副图比例最低值;
所叠加副图线:(副图线形-HLMN4)*HLMN2/HLMN3+HLMN1;{按比例叠加副图线的计算方式}由于所要叠加副图的正常比例最高值是100,最低值是0,所以
HLMN3:=(副图比例最高值-副图比例最低值)/2;
HLMN4:=副图比例最高值-副图比例最低值;
所叠加副图线:(副图线形-HLMN3)*HLMN2/HLMN4+HLMN1;{按比例叠加副图线的计算方式}
可以修改成
HLMN3:=(100-0)/2;
HLMN4:=100-0;
直接简化为
所叠加副图线:(副图线形-50)*HLMN2/100+HLMN1;{按比例叠加副图线的计算方式}
-------------------
有了以上叠加副图的模板,那么就好办了,就以叠加RSI为例子
HH:=CONST(HHV(C,120))*1;
LL:=CONST(LLV(C,120))*1;
HL:=CONST(IF(CONST((HH+LL)/2)<CONST(C),LL-(HH-LL)*0.3,HH+(HH-LL)*0.3));
HH1:=IF(CONST((HH+LL)/2)>CONST(C),HH,HL);
LL1:=IF(CONST((HH+LL)/2)<CONST(C),LL,HL);
{以下是设定叠加副图的比例}
HLMAX:=MAX(HH1,LL1);
HLMIN:=MIN(HH1,LL1);
HLMN1:=(HLMAX+HLMIN)/2;
HLMN2:=HLMAX-HLMIN;
{叠加副图}
STICKLINE(C,HH1,HH1,1,0),COLOR858500;
STICKLINE(C,LL1,LL1,1,0),COLOR858500;
STICKLINE(C,(HH1+LL1)/2,(HH1+LL1)/2,1,0),COLOR858500;
("RSI.RSI1"-50)*HLMN2/100+HLMN1,COLORFC80FF,LINETHICK2;
("RSI.RSI2"-50)*HLMN2/100+HLMN1,COLOR00FFFF;
("RSI.RSI3"-50)*HLMN2/100+HLMN1,COLORFFFFFF;
STICKLINE(C>O,H,L,0,0),COLORRED;
STICKLINE(C<=O,H,L,0,0),COLORCYAN;
STICKLINE(C>O,C,O,3.1,1),COLORRED;
STICKLINE(C<=O,C,O,3.1,0),COLORCYAN;
M5:MA(C,5);
M10:MA(C,10);
M20:MA(C,20);
M60:MA(C,60);
如果你想再复杂点,多叠加那就加啊
HH:=CONST(HHV(C,120))*1;
LL:=CONST(LLV(C,120))*1;
HL:=CONST(IF(CONST((HH+LL)/2)<CONST(C),LL-(HH-LL)*0.3,HH+(HH-LL)*0.3));
HH1:=IF(CONST((HH+LL)/2)>CONST(C),HH,HL);
LL1:=IF(CONST((HH+LL)/2)<CONST(C),LL,HL);
{以下是设定叠加副图的比例}
HLMAX:=MAX(HH1,LL1);
HLMIN:=MIN(HH1,LL1);
HLMN1:=(HLMAX+HLMIN)/2;
HLMN2:=HLMAX-HLMIN;
{先对最高最低值画色带,也可用柱子表示}
STICKLINE(C,HH1,(HH1+LL1)/2,5,0),COLOR858500;
STICKLINE(C,LL1,(HH1+LL1)/2,5,0),COLOR330000;
{对副图的数值进行分割}
STICKLINE(C,(75-50)*HLMN2/100+HLMN1,(100-50)*HLMN2/100+HLMN1,5,0),
COLOR000088;
STICKLINE(C,(25-50)*HLMN2/100+HLMN1,(0-50)*HLMN2/100+HLMN1,5,0),
COLOR555555;
{叠加副图}
STICKLINE("KDJ.K"(9,3,3)>"KDJ.D"(9,3,3),("KDJ.K"(9,3,3)-50)*HLMN2/100
+HLMN1,("KDJ.D"(9,3,3)-50)*HLMN2/100+HLMN1,1.5,0),COLOR5955FF;
STICKLINE("KDJ.K"(9,3,3)<"KDJ.D"(9,3,3),("KDJ.K"(9,3,3)-50)*HLMN2/100
+HLMN1,("KDJ.D"(9,3,3)-50)*HLMN2/100+HLMN1,1.5,0),COLORFF5955;
W1:=(HHV(HIGH,14)-CLOSE)/(HHV(HIGH,14)-LLV(LOW,14))*100;
(W1-50)*HLMN2/100+HLMN1,COLORBLUE;
("RSI.RSI1"-50)*HLMN2/100+HLMN1,COLORFC80FF,LINETHICK2;
("RSI.RSI2"-50)*HLMN2/100+HLMN1,COLOR00FFFF;
("RSI.RSI3"-50)*HLMN2/100+HLMN1,COLORFFFFFF;
STICKLINE(C>O,H,L,0,0),COLORRED;
STICKLINE(C<=O,H,L,0,0),COLORCYAN;
STICKLINE(C>O,C,O,3.1,1),COLORRED;
STICKLINE(C<=O,C,O,3.1,0),COLORCYAN;
M5:MA(C,5);
M10:MA(C,10);
M20:MA(C,20);
M60:MA(C,60);
副图叠加
以MACD为例子,因为MACD的高低点值难以确定,所以要叠加KDJ/RSI等,就以MACD为主体
叠加可以做成二种方式
一是MACD在上叠加在下
DIF:"MACD.DIF",NODRAW;
DEA:"MACD.DEA",NODRAW;
MACD:"MACD.MACD",COLORSTICK,NODRAW;
HH:=CONST(HHV(DIF,60))*1;
LL:=CONST(LLV(DIF,60))*1;
HL:=CONST(IF(CONST((HH+LL)/2)>CONST(DIF),LL-(HH-LL)*0.5,HH+(HH-LL)*0.5));
HH1:=IF(CONST(HL)<CONST(DIF),LL,HL);
LL1:=IF(CONST(HL)>CONST(DIF),HH,HL);
{以下是设定叠加副图的比例}
HLMAX:=MAX(HH1,LL1);
HLMIN:=MIN(HH1,LL1);
HLMN1:=(HLMAX+HLMIN)/2;
HLMN2:=HLMAX-HLMIN;
{先对最高最低值画色带,也可用柱子表示}
STICKLINE(C,HH1,(HH1+LL1)/2,5,0),COLOR858500;
STICKLINE(C,LL1,(HH1+LL1)/2,5,0),COLOR330000;
{对副图的数值进行分割}
STICKLINE(C,(75-50)*HLMN2/100+HLMN1,(100-50)*HLMN2/100+HLMN1,5,0),
COLOR000088;
STICKLINE(C,(25-50)*HLMN2/100+HLMN1,(0-50)*HLMN2/100+HLMN1,5,0),
COLOR555555;
STICKLINE(MACD>REF(MACD,1) AND MACD>0,0,MACD,1.8,0),COLOR000055;
STICKLINE(MACD>REF(MACD,1) AND MACD>0,0,MACD,1.1,0),COLOR000099;
STICKLINE(MACD>REF(MACD,1) AND MACD>0,0,MACD,0.6,0),COLOR0000BB;
STICKLINE(MACD<=REF(MACD,1) AND MACD>0,0,MACD,1.8,0),COLOR888888;
STICKLINE(MACD<=REF(MACD,1) AND MACD>0,0,MACD,1.1,0),COLORBBBBBB;
STICKLINE(MACD<=REF(MACD,1) AND MACD>0,0,MACD,0.6,0),COLORDDDDDD;
STICKLINE(MACD>REF(MACD,1) AND MACD<0,0,MACD,1.8,0),COLOR3377AA;
STICKLINE(MACD>REF(MACD,1) AND MACD<0,0,MACD,1.1,0),COLOR3388BB;
STICKLINE(MACD>REF(MACD,1) AND MACD<0,0,MACD,0.6,0),COLOR4499CC;
STICKLINE(MACD<=REF(MACD,1) AND MACD<0,0,MACD,1.8,0),COLORFF3300;
STICKLINE(MACD<=REF(MACD,1) AND MACD<0,0,MACD,1.1,0),COLORFF5500;
STICKLINE(MACD<=REF(MACD,1) AND MACD<0,0,MACD,0.6,0),COLORFF7700;
{叠加副图}
STICKLINE("KDJ.K"(9,3,3)>"KDJ.D"(9,3,3),("KDJ.K"(9,3,3)-50)*HLMN2/100
+HLMN1,("KDJ.D"(9,3,3)-50)*HLMN2/100+HLMN1,1.5,0),COLOR5955FF;
STICKLINE("KDJ.K"(9,3,3)<"KDJ.D"(9,3,3),("KDJ.K"(9,3,3)-50)*HLMN2/100
+HLMN1,("KDJ.D"(9,3,3)-50)*HLMN2/100+HLMN1,1.5,0),COLORFF5955;
W1:=(HHV(HIGH,14)-CLOSE)/(HHV(HIGH,14)-LLV(LOW,14))*100;
(W1-50)*HLMN2/100+HLMN1,COLORBLUE;
("RSI.RSI1"-50)*HLMN2/100+HLMN1,COLORFC80FF,LINETHICK2;
("RSI.RSI2"-50)*HLMN2/100+HLMN1,COLOR00FFFF;
("RSI.RSI3"-50)*HLMN2/100+HLMN1,COLORFFFFFF;
DRAWBAND(DIF,RGB(200,50,55),DEA,RGB(50,100,10));
IF(C>0,DIF,DRAWNULL),COLORRED,LINETHICK1;
IF(C>0,DEA,DRAWNULL),COLOR00FFFF,LINETHICK1;
IF(DEA<REF(DEA,1),DEA,DRAWNULL),COLORBE7F6F,LINETHICK1;
IF(DIF<=REF(DIF,1),DIF,DRAWNULL),COLORBLUE,LINETHICK1;
二是MACD在上时叠加也在上
DIF:"MACD.DIF",NODRAW;
DEA:"MACD.DEA",NODRAW;
MACD:"MACD.MACD",COLORSTICK,NODRAW;
HH:=CONST(HHV(DIF,60))*1;
LL:=CONST(LLV(DIF,60))*1;
HL:=CONST(IF(CONST((HH+LL)/2)<CONST(DIF),LL-(HH-LL)*0.5,HH+(HH-LL)*0.5));
HH1:=IF(CONST(HL)>CONST(DIF),HH,HL);
LL1:=IF(CONST(HL)<CONST(DIF),LL,HL);{以下是设定叠加副图的比例}
HLMAX:=MAX(HH1,LL1);
HLMIN:=MIN(HH1,LL1);
HLMN1:=(HLMAX+HLMIN)/2;
HLMN2:=HLMAX-HLMIN;
{先对最高最低值画色带,也可用柱子表示}
STICKLINE(C,HH1,(HH1+LL1)/2,5,0),COLOR858500;
STICKLINE(C,LL1,(HH1+LL1)/2,5,0),COLOR330000;
{对副图的数值进行分割}
STICKLINE(C,(75-50)*HLMN2/100+HLMN1,(100-50)*HLMN2/100+HLMN1,5,0),
COLOR000088;
STICKLINE(C,(25-50)*HLMN2/100+HLMN1,(0-50)*HLMN2/100+HLMN1,5,0),
COLOR555555;
STICKLINE(MACD>REF(MACD,1) AND MACD>0,0,MACD,1.8,0),COLOR000055;
STICKLINE(MACD>REF(MACD,1) AND MACD>0,0,MACD,1.1,0),COLOR000099;
STICKLINE(MACD>REF(MACD,1) AND MACD>0,0,MACD,0.6,0),COLOR0000BB;
STICKLINE(MACD<=REF(MACD,1) AND MACD>0,0,MACD,1.8,0),COLOR888888;
STICKLINE(MACD<=REF(MACD,1) AND MACD>0,0,MACD,1.1,0),COLORBBBBBB;
STICKLINE(MACD<=REF(MACD,1) AND MACD>0,0,MACD,0.6,0),COLORDDDDDD;
STICKLINE(MACD>REF(MACD,1) AND MACD<0,0,MACD,1.8,0),COLOR3377AA;
STICKLINE(MACD>REF(MACD,1) AND MACD<0,0,MACD,1.1,0),COLOR3388BB;
STICKLINE(MACD>REF(MACD,1) AND MACD<0,0,MACD,0.6,0),COLOR4499CC;
STICKLINE(MACD<=REF(MACD,1) AND MACD<0,0,MACD,1.8,0),COLORFF3300;
STICKLINE(MACD<=REF(MACD,1) AND MACD<0,0,MACD,1.1,0),COLORFF5500;
STICKLINE(MACD<=REF(MACD,1) AND MACD<0,0,MACD,0.6,0),COLORFF7700;
{叠加副图}
STICKLINE("KDJ.K"(9,3,3)>"KDJ.D"(9,3,3),("KDJ.K"(9,3,3)-50)*HLMN2/100
+HLMN1,("KDJ.D"(9,3,3)-50)*HLMN2/100+HLMN1,1.5,0),COLOR5955FF;
STICKLINE("KDJ.K"(9,3,3)<"KDJ.D"(9,3,3),("KDJ.K"(9,3,3)-50)*HLMN2/100
+HLMN1,("KDJ.D"(9,3,3)-50)*HLMN2/100+HLMN1,1.5,0),COLORFF5955;
W1:=(HHV(HIGH,14)-CLOSE)/(HHV(HIGH,14)-LLV(LOW,14))*100;
(W1-50)*HLMN2/100+HLMN1,COLORBLUE;
("RSI.RSI1"-50)*HLMN2/100+HLMN1,COLORFC80FF,LINETHICK2;
("RSI.RSI2"-50)*HLMN2/100+HLMN1,COLOR00FFFF;
("RSI.RSI3"-50)*HLMN2/100+HLMN1,COLORFFFFFF;
DRAWBAND(DIF,RGB(200,50,55),DEA,RGB(50,100,10));
IF(C>0,DIF,DRAWNULL),COLORRED,LINETHICK1;
IF(C>0,DEA,DRAWNULL),COLOR00FFFF,LINETHICK1;
IF(DEA<REF(DEA,1),DEA,DRAWNULL),COLORBE7F6F,LINETHICK1;
IF(DIF<=REF(DIF,1),DIF,DRAWNULL),COLORBLUE,LINETHICK1;
叠加到最低值确定最高值不确定的副图,如VOL
相对来说,这个更简单,还是那个模板,因为VOL的低点是确立的0,所以只要取阶段最高点做叠加高点,取阶段最高点的1/2做叠加最低点就行了
量:V,NODRAW;
R1:"RSI.RSI1"(6,12,24),COLOR00FFFF,NODRAW;
R2:"RSI.RSI2"(6,12,24),COLORFFFFFF,NODRAW;
R3:EMA("RSI.RSI3"(6,12,24),21),COLOR1477FF,NODRAW;
HH:=CONST(HHV(V,100))*1.2;
LL:=CONST(HH/2),POINTDOT;
MM:=(HH+LL)/2;
STICKLINE(C,HH,MM,5,0),COLOR858500;
STICKLINE(C,LL,MM,5,0),COLOR330000;
HKMAX:=MAX(HH,LL);
LKMIN:=MIN(HH,LL);
KHLB:=(HKMAX+LKMIN)/2;
KHLC:=HKMAX-LKMIN;
STICKLINE(C,(0.8-0.5)*KHLC/1+KHLB,(1-0.5)*KHLC/1+KHLB,5,0),COLOR000088;
STICKLINE(C,(0.2-0.5)*KHLC/1+KHLB,(0-0.5)*KHLC/1+KHLB,5,0),COLOR555555;
STICKLINE(C>REF(C,1),0,V,2.5,1),COLORRED;
STICKLINE(C<=REF(C,1),0,V,2.5,1),COLORFFF000;
MV5:INTPART(MA(V,5)),COLORRED;
MV10:MA(V,10),COLORFF00FF,LINETHICK1;
MV35:INTPART(MA(V,35)),COLORYELLOW,LINETHICK2;
IF(MV35<=REF(MV35,1),MV35,DRAWNULL),COLORBLUE,LINETHICK2;
IF(MV10<=REF(MV10,1),MV10,DRAWNULL),COLOR008080,LINETHICK1;
IF(MV5<=REF(MV5,1),MV5,DRAWNULL),COLORCYAN;
(EMA("RSI.RSI3"(6,12,24)/100,21)-0.5)*KHLC/1+KHLB,COLOR1477FF,LINETHICK2;
IF(EMA(EMA("RSI.RSI3"(6,12,48)/100,14),5)<=REF(EMA(EMA("RSI.RSI3"(6,12,48)/100,14),5),1)
,(EMA(EMA("RSI.RSI3"(6,12,48)/100,14),5)-0.5)*KHLC/1+KHLB,DRAWNULL)
,COLORFFF000,LINETHICK2;
("RSI.RSI1"(6,12,24)/100-0.5)*KHLC/1+KHLB,COLOR00FFFF;
("RSI.RSI2"(6,12,24)/100-0.5)*KHLC/1+KHLB,COLORFFFFFF;
整套方法已经写完,谨以此奉献给热爱指标的朋友们!希望你能提炼出更好的方法和技巧!
|