通达信三浪趋势主图指标 源码 附图
DRAWGBK(O>C,RGB(0,50,50),RGB(66,0,0),0,'01',0);
N:=13;DO:=150612;DA:=150826;DB:=151117;DC:=160108;
{黄金分割}
高:IF (HIGH>PEAK(1,N,1),HHV(HIGH,N),PEAK(1,N,1))LINETHICK2,COLORBLUE;{最高价}
低:IF (LOW<TROUGH(2,N,1),LLV(LOW,N),TROUGH(2,N,1))LINETHICK2,COLORMAGENTA;{最低价}
F0191:(高-低)*0.191+低,DOTLINE,COLORMAGENTA;
F0382:(高-低)*0.382+低,DOTLINE,COLORCYAN;
F0500:(高-低)*0.500+低,DOTLINE,COLORWHITE;
F0618:(高-低)*0.618+低,DOTLINE,COLORCYAN;
F0809:(高-低)*0.809+低,DOTLINE,COLORYELLOW;
{三角背景}
趋势下:DRAWLINE(H=HHV(H,N),H,L=LLV(L,N),L,0)LINETHICK2,COLORGREEN;
SX:=REF(趋势下,1)<趋势下;
SS:=DRAWLINE(SX,趋势下,REF(SX,1),REF(趋势下,1),1);
DRAWBAND(SS,RGB(0,0,160),趋势下,RGB(0,0,0));
趋势上:DRAWLINE(L=LLV(L,N),L,H=HHV(H,N),H,0)LINETHICK2,COLORMAGENTA;
JX:=REF(趋势上,1)>趋势上;
JJ:=DRAWLINE(JX,趋势上,REF(JX,1),REF(趋势上,1),1);
DRAWBAND(JJ,RGB(0,0,0),趋势上,RGB(180,0,180));
DRAWKLINE(HIGH,OPEN,LOW,CLOSE) ;
{大资金流向}
超B:=L2_AMO(0,2)/10000.0;
大B:=L2_AMO(1,2)/10000.0;
中B:=L2_AMO(2,2)/10000.0;
小B:=L2_AMO(3,2)/10000.0;
超S:=L2_AMO(0,3)/10000.0;
大S:=L2_AMO(1,3)/10000.0;
中S:=L2_AMO(2,3)/10000.0;
小S:=L2_AMO(3,3)/10000.0;
大资金流向:(超B+大B)-(超S+大S)COLORYELLOW,NODRAW;
DRAWKLINE(HIGH,OPEN,LOW,CLOSE) ;
STICKLINE(大资金流向<0,O,C,2,0),COLORFF3300;
STICKLINE(大资金流向<0,O,C,1.2,0),COLORFF6600;
STICKLINE(大资金流向<0,O,C,0.5,0),COLORFF9900;
STICKLINE(大资金流向>0,O,C,2,0),COLOR0066FF;
STICKLINE(大资金流向>0,O,C,1.2,0),COLOR099FFF;
STICKLINE(大资金流向>0,O,C,0.5,0),COLOR00FFFF;
TL:=1000000+DA;
TH:=1000000+DB;
TC:=1000000+DC;
TO:=1000000+DO;
AL:=IF(REFDATE(CLOSE,TL)>REFDATE(CLOSE,TH),REFDATE(HIGH,TL),REFDATE(LOW,TL));
BH:=IF(REFDATE(CLOSE,TL)>REFDATE(CLOSE,TH),REFDATE(LOW,TH),REFDATE(HIGH,TH));
CZF:=IF(REFDATE(CLOSE,TL)>REFDATE(CLOSE,TH),REFDATE(HIGH,TC),REFDATE(LOW,TC));
DJB:=IF(REFDATE(CLOSE,TL)>REFDATE(CLOSE,TH),REFDATE(LOW,TO),REFDATE(HIGH,TO));
OP:=BH-AL+CZF;
COP:=0.618*(BH-AL)+CZF;
XOP:=IF((1.618*(BH-AL)+CZF)<0,OP,1.618*(BH-AL)+CZF);
TODAY:=DATE;
STICKLINE(DATE=TC,CZF,XOP,0,-1),COLORYELLOW;
DRAWLINE(DATE=TC,COP,DATE=TODAY,COP,1),DOTLINE,COLORYELLOW;
DRAWLINE(DATE=TC,OP,DATE=TODAY,OP,1),DOTLINE,COLORYELLOW;
DRAWLINE(DATE=TC,XOP,DATE=TODAY,XOP,1),DOTLINE,COLORYELLOW;
DRAWTEXT(DATE=TC,COP*1.003,'(COP=0.618)'),COLORYELLOW;
DRAWTEXT(DATE=TC,OP*1.003,'(OP=1.000)'),COLORYELLOW;
DRAWTEXT(DATE=TC,XOP*1.003,'(XOP=1.618)'),COLORYELLOW;
DRAWNUMBER(DATE=TC,COP,COP),COLORYELLOW;
DRAWNUMBER(DATE=TC,OP,OP),COLORYELLOW;
DRAWNUMBER(DATE=TC,XOP,XOP),COLORYELLOW;
DRAWLINE(DATE=TO,DJB,DATE=TL,AL,0)CIRCLEDOT,COLORGREEN;
DRAWLINE(DATE=TL,AL,DATE=TH,BH,0)LINETHICK2,COLORYELLOW;
DRAWLINE(DATE=TH,BH,DATE=TC,CZF,0)LINETHICK2,COLORCYAN;
{区间涨跌}
向上:=TROUGHBARS(2,N,1);
向下:=PEAKBARS(1,N,1);
涨%:=IF(向上<向下,(C/低-1)*100,REF((C/低-1)*100,向下));
跌%:=IF(向下<向上,(C/高-1)*100,REF((C/高-1)*100,向上));
DRAWNUMBER(向上=0,低*0.99,ABS(高-低)),COLORGREEN;
DRAWNUMBER(向下=0,高*1.02,ABS(高-低)),COLORRED;
ZHSJ:=IF(向下<向上,BACKSET(ISLASTBAR,向下),IF(向上<向下,BACKSET(ISLASTBAR,向上),0));
DRAWTEXT(向下<向上 AND CROSS(ZHSJ,0.1),高*1.004,'本 高'),COLORGREEN;
DRAWTEXT(向下<向上 AND CROSS(ZHSJ,0.1),低*1.004,'本 低'),COLORRED;
DRAWTEXT(向下<向上 AND CROSS(ZHSJ,0.1),F0191*1.003,'80.9%'),COLORYELLOW;
DRAWTEXT(向下<向上 AND CROSS(ZHSJ,0.1),F0382*1.003,'61.8%'),COLORCYAN;
DRAWTEXT(向下<向上 AND CROSS(ZHSJ,0.1),F0500*1.003,'50.0%'),COLORWHITE;
DRAWTEXT(向下<向上 AND CROSS(ZHSJ,0.1),F0618*1.003,'38.2%'),COLORGREEN;
DRAWTEXT(向下<向上 AND CROSS(ZHSJ,0.1),F0809*1.003,'19.1%'),COLORRED;
DRAWNUMBER(向下<向上 AND CROSS(ZHSJ,0.1),高,高)COLORGREEN;
DRAWNUMBER(向下<向上 AND CROSS(ZHSJ,0.1),F0191,F0191)COLORYELLOW;
DRAWNUMBER(向下<向上 AND CROSS(ZHSJ,0.1),F0382,F0382)COLORCYAN;
DRAWNUMBER(向下<向上 AND CROSS(ZHSJ,0.1),F0500,F0500)COLORGREEN;
DRAWNUMBER(向下<向上 AND CROSS(ZHSJ,0.1),F0618,F0618)COLORCYAN;
DRAWNUMBER(向下<向上 AND CROSS(ZHSJ,0.1),F0809,F0809)COLORMAGENTA;
DRAWNUMBER(向下<向上 AND CROSS(ZHSJ,0.1),低,低)COLORRED;
DRAWTEXT(向下>向上 AND CROSS(ZHSJ,0.1),高*1.003,'前 高'),COLORGREEN;
DRAWTEXT(向下>向上 AND CROSS(ZHSJ,0.1),低*1.003,'前 低'),COLORRED;
DRAWTEXT(向下>向上 AND CROSS(ZHSJ,0.1),F0191*1.003,'19.1%'),COLORRED;
DRAWTEXT(向下>向上 AND CROSS(ZHSJ,0.1),F0382*1.003,'38.2%'),COLORGREEN;
DRAWTEXT(向下>向上 AND CROSS(ZHSJ,0.1),F0500*1.003,'50.0%'),COLORWHITE;
DRAWTEXT(向下>向上 AND CROSS(ZHSJ,0.1),F0618*1.003,'61.8%'),COLORCYAN;
DRAWTEXT(向下>向上 AND CROSS(ZHSJ,0.1),F0809*1.003,'80.9%'),COLORYELLOW;
DRAWNUMBER(向下>向上 AND CROSS(ZHSJ,0.1),高,高)COLORGREEN;
DRAWNUMBER(向下>向上 AND CROSS(ZHSJ,0.1),F0809,F0809)COLORYELLOW;
DRAWNUMBER(向下>向上 AND CROSS(ZHSJ,0.1),F0618,F0618)COLORCYAN;
DRAWNUMBER(向下>向上 AND CROSS(ZHSJ,0.1),F0500,F0500)COLORGREEN;
DRAWNUMBER(向下>向上 AND CROSS(ZHSJ,0.1),F0382,F0382)COLORCYAN;
DRAWNUMBER(向下>向上 AND CROSS(ZHSJ,0.1),F0191,F0191)COLORMAGENTA;
DRAWNUMBER(向下>向上 AND CROSS(ZHSJ,0.1),低,低)COLORRED;
未来函数检测结果如下:
该公式包含未来函数:PEAK
该公式包含未来函数:PEAKBARS
该公式包含未来函数:TROUGH
该公式包含未来函数:TROUGHBARS
该公式包含未来函数:BACKSET
解密、编写股票、期货策略请联系QQ或微信同号:88652583
相关股票指标公式
原理解析:
填充背景(O>C,RGB(0,50,50),RGB(66,0,0),0,'01',0)
N赋值:13
DO赋值:150612
DA赋值:150826
DB赋值:151117
DC赋值:160108
输出{黄金分割}
高:IF (最高价>PEAK(1,N,1),N日内最高价最高值,PEAK(1,N,1))LINETHICK2, 画蓝色
输出{最高价}
低:IF (最低价输出{最低价}
F0191:(高-低)*0.191+低,DOTLINE,COLORMAGENTA
输出F0382:(高-低)*0.382+低,DOTLINE,COLORCYAN
输出F0500:(高-低)*0.500+低,DOTLINE,画白色
输出F0618:(高-低)*0.618+低,DOTLINE,COLORCYAN
输出F0809:(高-低)*0.809+低,DOTLINE,画黄色
输出{三角背景}
趋势下:DRAWLINE(H=N日内H最高值,H,L=N日内L最低值,L,0)LINETHICK2,COLORGREEN
SX赋值:1日前的趋势下<趋势下
SS赋值:DRAWLINE(SX,趋势下,1日前的SX,1日前的趋势下,1)
DRAWBAND(SS,RGB(0,0,160),趋势下,RGB(0,0,0))
输出趋势上:DRAWLINE(L=N日内L最低值,L,H=N日内H最高值,H,0)LINETHICK2,COLORMAGENTA
JX赋值:1日前的趋势上>趋势上
JJ赋值:DRAWLINE(JX,趋势上,1日前的JX,1日前的趋势上,1)
DRAWBAND(JJ,RGB(0,0,0),趋势上,RGB(180,0,180))
DRAWKLINE(最高价,OPEN,最低价,收盘价)
{大资金流向}
超B赋值:L2_AMO(0,2)/10000.0
大B赋值:L2_AMO(1,2)/10000.0
中B赋值:L2_AMO(2,2)/10000.0
小B赋值:L2_AMO(3,2)/10000.0
超S赋值:L2_AMO(0,3)/10000.0
大S赋值:L2_AMO(1,3)/10000.0
中S赋值:L2_AMO(2,3)/10000.0
小S赋值:L2_AMO(3,3)/10000.0
输出大资金流向:(超B+大B)-(超S+大S)画黄色,NODRAW
DRAWKLINE(最高价,OPEN,最低价,收盘价)
当满足条件大资金流向<0时,在O和C之间画柱状线
当满足条件大资金流向<0时,在O和C之间画柱状线
当满足条件大资金流向<0时,在O和C之间画柱状线
当满足条件大资金流向>0时,在O和C之间画柱状线
当满足条件大资金流向>0时,在O和C之间画柱状线
当满足条件大资金流向>0时,在O和C之间画柱状线
TL赋值:1000000+DA
TH赋值:1000000+DB
TC赋值:1000000+DC
TO赋值:1000000+DO
AL赋值:IF(REFDATE(收盘价,TL)>REFDATE(收盘价,TH),REFDATE(最高价,TL),REFDATE(最低价,TL))
BH赋值:IF(REFDATE(收盘价,TL)>REFDATE(收盘价,TH),REFDATE(最低价,TH),REFDATE(最高价,TH))
CZF赋值:IF(REFDATE(收盘价,TL)>REFDATE(收盘价,TH),REFDATE(最高价,TC),REFDATE(最低价,TC))
DJB赋值:IF(REFDATE(收盘价,TL)>REFDATE(收盘价,TH),REFDATE(最低价,TO),REFDATE(最高价,TO))
OP赋值:BH-AL+CZF
COP赋值:0.618*(BH-AL)+CZF
XOP赋值:IF((1.618*(BH-AL)+CZF)<0,OP,1.618*(BH-AL)+CZF)
TODAY:=DATE
当满足条件DATE=TC时,在CZF和XOP之间画柱状线
DRAWLINE(DATE=TC,COP,DATE=TODAY,COP,1),DOTLINE,画黄色
DRAWLINE(DATE=TC,OP,DATE=TODAY,OP,1),DOTLINE,画黄色
DRAWLINE(DATE=TC,XOP,DATE=TODAY,XOP,1),DOTLINE,画黄色
DRAWTEXT(DATE=TC,COP*1.003,'(COP=0.618)'),画黄色
DRAWTEXT(DATE=TC,OP*1.003,'(OP=1.000)'),画黄色
DRAWTEXT(DATE=TC,XOP*1.003,'(XOP=1.618)'),画黄色
DRAWNUMBER(DATE=TC,COP,COP),画黄色
DRAWNUMBER(DATE=TC,OP,OP),画黄色
DRAWNUMBER(DATE=TC,XOP,XOP),画黄色
DRAWLINE(DATE=TO,DJB,DATE=TL,AL,0)CIRCLEDOT,COLORGREEN
DRAWLINE(DATE=TL,AL,DATE=TH,BH,0)LINETHICK2,画黄色
DRAWLINE(DATE=TH,BH,DATE=TC,CZF,0)LINETHICK2,COLORCYAN
{区间涨跌}
向上赋值:TROUGHBARS(2,N,1)
向下赋值:PEAKBARS(1,N,1)
涨%赋值:IF(向上<向下,(C/低-1)*100,REF((C/低-1)*100,向下))
跌%赋值:IF(向下<向上,(C/高-1)*100,REF((C/高-1)*100,向上))
DRAWNUMBER(向上=0,低*0.99,高-低的绝对值),COLORGREEN
DRAWNUMBER(向下=0,高*1.02,高-低的绝对值),画红色
ZHSJ赋值:IF(向下<向上,BACKSET(ISLASTBAR,向下),IF(向上<向下,BACKSET(ISLASTBAR,向上),0))
DRAWTEXT(向下<向上 AND ZHSJ上穿0.1,高*1.004,'本 高'),COLORGREEN
DRAWTEXT(向下<向上 AND ZHSJ上穿0.1,低*1.004,'本 低'),画红色
DRAWTEXT(向下<向上 AND ZHSJ上穿0.1,F0191*1.003,'80.9%'),画黄色
DRAWTEXT(向下<向上 AND ZHSJ上穿0.1,F0382*1.003,'61.8%'),COLORCYAN
DRAWTEXT(向下<向上 AND ZHSJ上穿0.1,F0500*1.003,'50.0%'),画白色
DRAWTEXT(向下<向上 AND ZHSJ上穿0.1,F0618*1.003,'38.2%'),COLORGREEN
DRAWTEXT(向下<向上 AND ZHSJ上穿0.1,F0809*1.003,'19.1%'),画红色
DRAWNUMBER(向下<向上 AND ZHSJ上穿0.1,高,高)COLORGREEN
DRAWNUMBER(向下<向上 AND ZHSJ上穿0.1,F0191,F0191)画黄色
DRAWNUMBER(向下<向上 AND ZHSJ上穿0.1,F0382,F0382)COLORCYAN
DRAWNUMBER(向下<向上 AND ZHSJ上穿0.1,F0500,F0500)COLORGREEN
DRAWNUMBER(向下<向上 AND ZHSJ上穿0.1,F0618,F0618)COLORCYAN
DRAWNUMBER(向下<向上 AND ZHSJ上穿0.1,F0809,F0809)COLORMAGENTA
DRAWNUMBER(向下<向上 AND ZHSJ上穿0.1,低,低)画红色
DRAWTEXT(向下>向上 AND ZHSJ上穿0.1,高*1.003,'前 高'),COLORGREEN
DRAWTEXT(向下>向上 AND ZHSJ上穿0.1,低*1.003,'前 低'),画红色
DRAWTEXT(向下>向上 AND ZHSJ上穿0.1,F0191*1.003,'19.1%'),画红色
DRAWTEXT(向下>向上 AND ZHSJ上穿0.1,F0382*1.003,'38.2%'),COLORGREEN
DRAWTEXT(向下>向上 AND ZHSJ上穿0.1,F0500*1.003,'50.0%'),画白色
DRAWTEXT(向下>向上 AND ZHSJ上穿0.1,F0618*1.003,'61.8%'),COLORCYAN
DRAWTEXT(向下>向上 AND ZHSJ上穿0.1,F0809*1.003,'80.9%'),画黄色
DRAWNUMBER(向下>向上 AND ZHSJ上穿0.1,高,高)COLORGREEN
DRAWNUMBER(向下>向上 AND ZHSJ上穿0.1,F0809,F0809)画黄色
DRAWNUMBER(向下>向上 AND ZHSJ上穿0.1,F0618,F0618)COLORCYAN
DRAWNUMBER(向下>向上 AND ZHSJ上穿0.1,F0500,F0500)COLORGREEN
DRAWNUMBER(向下>向上 AND ZHSJ上穿0.1,F0382,F0382)COLORCYAN
DRAWNUMBER(向下>向上 AND ZHSJ上穿0.1,F0191,F0191)COLORMAGENTA
DRAWNUMBER(向下>向上 AND ZHSJ上穿0.1,低,低)画红色