通达信【趋势买卖】主副图指标 支持手机电脑 源码附图
{趋势买卖副图指标源码如下}
GSKZ1:=REF((LOW+OPEN+CLOSE+HIGH)/4,1);
GSKZ2:=SMA(ABS(LOW-GSKZ1),13,1)/SMA(MAX(LOW-GSKZ1,0),10,1);
GSKZ3:=EMA(GSKZ2,10);
GSKZ4:=LLV(LOW,33);
GSKZ5:=EMA(IF(LOW<=GSKZ4,GSKZ3,0),3);
主力进场:IF(GSKZ5>REF(GSKZ5,1),GSKZ5,0),COLORRED,NODRAW;
STICKLINE(GSKZ5>REF(GSKZ5,1),0,-GSKZ5,3,-1),COLORFFFF00;
洗盘:IF(GSKZ5<REF(GSKZ5,1),GSKZ5,0),COLORGREEN,NODRAW;
STICKLINE(GSKZ5<REF(GSKZ5,1),0,-GSKZ5,3,-1),COLORFF00FF;
NMTM:=C-REF(C,1);
生命线:100*EMA(EMA(NMTM,5),5)/EMA(EMA(ABS(NMTM),5),5),COLORRED,LINETHICK1;
趋势线:MA(生命线,9),COLORFFCAC5,LINETHICK1,DOTLINE;
买点:=BARSLASTCOUNT(REF(生命线,1)<=生命线)=1;
STICKLINE(REF(生命线,1)<=生命线,生命线,REF(生命线,1),2,0),COLORRED;
STICKLINE(REF(生命线,1)>生命线,生命线,REF(生命线,1),2,0),COLORGREEN;
XG:(GSKZ5<REF(GSKZ5,1) AND REF(NOT(GSKZ5<REF(GSKZ5,1)),1)) AND (REF(生命线,1)<=生命线
AND REF(NOT(REF(生命线,1)<=生命线),1)),COLORFF00FF,NODRAW;
DRAWICON(买点,生命线,9);
{趋势买卖主图指标源码如下}
回归斜率线A:=EMA(SLOPE(C,4)*20+C,42);
趋势RL:=(CLOSE-LLV(LOW,9))/(HHV(HIGH,9)-LLV(LOW,9))*100;
趋势K:=SMA(趋势RL,3,1); 趋势D:=SMA(趋势K,3,1); 趋势J:=3*趋势K-2*趋势D;
MAHL1:=100*((EMA((H+L)/2,3)-LLV(EMA((H+L)/2,5),30)-(EMA(H,20)-EMA(L,20))) /(LLV(EMA((H+L)/2,5),30)-(EMA(H,20)-EMA(L,20))));
MAHL2:=IF(EMA(C,2)>回归斜率线A AND MAHL1>0,EMA(C,3),LLV(EMA((H+L)/2,5),30));
MAHL3:=IF(EMA(C,2)>回归斜率线A AND MAHL1>0,LLV(EMA((H+L)/2,5),30),EMA(C,5));
回归斜率带:DRAWBAND(回归斜率线A,RGB(235,0,230),REF(回归斜率线A,2),RGB(0,104,154));
顶线:=SMA(C,6.5,1);
支撑趋势线:SMA(C,14.5,1);
顶线1:=SMA(C,3,1);
支撑趋势线1:=SMA(C,8,1);
顶线2:=SMA(C,3.5,1);
DRAWTEXT(CROSS(支撑趋势线1,顶线1),H*1.08,'洗盘'),COLOR00FF00;
BBI:=(MA(CLOSE,3)+MA(CLOSE,6)+MA(CLOSE,12)+MA(CLOSE,25))/4;
UPR:=BBI+3*STD(BBI,13),LINETHICK2;
DWN:=BBI-3*STD(BBI,13);
安全:=MA(CLOSE,55),LINETHICK2;
LC:=REF(CLOSE,1);
RSI:=SMA(MAX(CLOSE-LC,0),6,1)/SMA(ABS(CLOSE-LC),6,1)*100;
DRAWTEXT( CROSS(82,RSI) AND CLOSE<顶线1 , HIGH*1.04,'减仓') ,COLORFF9966,LINETHICK2;
A7:=(2*C+H+L)/4;
使用:MA(A7,5),COLORBLUE,LINETHICK2;
使用1:=MA(A7,5)*1.03,LINETHICK2;
使用2:=MA(A7,5)*0.97,LINETHICK2;
DRAWTEXT( CROSS(顶线1,顶线) AND 顶线1>使用,LOW *0.92,'买进' ),COLORYELLOW;
GSKZ1:LLV(A7,21);
GSKZ2:HHV(A7,30);
DRAWTEXT( CROSS(顶线1,使用) AND 顶线1<支撑趋势线 AND 顶线1<支撑趋势线1 AND 顶线1<顶线 AND CLOSE>GSKZ1,LOW *0.98,'见底' ),COLORYELLOW;
YCX:=使用>=REF(使用,1);
H1:=MAX(MAX(顶线,支撑趋势线1),支撑趋势线);
L1:=MIN(MIN(顶线,支撑趋势线1),支撑趋势线);
DRAWTEXT(CROSS(顶线1,支撑趋势线1) AND 顶线1>使用 ,LOW *0.98,'全仓' ),COLORYELLOW;
SK:=EMA((A7-GSKZ1)/(GSKZ2-GSKZ1)*100,7);
SD:=EMA(0.667*REF(SK,1)+0.333*SK,5);
M1:=1000*使用/支撑趋势线<=1015 AND 1000*使用/支撑趋势线>=975;
M2:=1000*支撑趋势线1/支撑趋势线<=1020 AND 支撑趋势线1/支撑趋势线>=980;
M3:=1000*顶线/支撑趋势线<=1015 AND 顶线/支撑趋势线>=985;
DRAWTEXT(IF(COUNT(CLOSE<REF(CLOSE,1),13)/13>6/10 AND
COUNT(SK>SD,6) AND REF(LOW,5)=LLV(LOW,120) AND REF(CLOSE>=OPEN,4) AND
REF(CLOSE>OPEN,3) AND REF(CLOSE>OPEN,2) AND REF(OPEN>CLOSE,1) AND
OPEN>REF(CLOSE,1),1,0),LOW*0.94,'买进') ,COLORYELLOW;
D:=MA(CLOSE,89)-MA(CLOSE,10)/3;
DRAWTEXT(IF(CLOSE<D AND VOL/240>MA(VOL,5)/240 AND CLOSE>REF(CLOSE,1)*1.08
AND CLOSE<MA(CLOSE,13)*1.3,1,0),LOW*0.88,'抄底'),COLORBROWN;
RSV:=(CLOSE-LLV(LOW,25))/(HHV(HIGH,25)-LLV(LOW,25))*100;
K:=SMA(RSV,3,1);
D1:=SMA(K,3,1);
J:=3*K-2*D1;
GSKZ3:=(2*CLOSE+HIGH+LOW)/3;
GSKZ4:=EMA(EMA(EMA(GSKZ3,4),4),4);
E:=(GSKZ4-REF(GSKZ4,1))/REF(GSKZ4,1)*100;
F:=MA(E,3)+0.03;
G:=MA(E,1);
DRAWICON(CROSS(F,G) AND J>65,HIGH*1.02,15),COLORGREEN;
DRAWICON(CROSS(G,F),LOW,9),COLORYELLOW;
DRAWTEXT(CLOSE>OPEN AND H1<C AND O<L1 AND YCX AND CROSS(顶线1,使用) AND LOW>GSKZ1 AND 顶线1>支撑趋势线 AND J<90,LOW *0.9,'主升' ),COLORRED;
DRAWTEXT( CROSS(顶线1,使用) AND M1 AND M2 AND M3,LOW *0.94,'买进' ),COLORYELLOW;
DRAWTEXT(CLOSE>OPEN AND 顶线>支撑趋势线1 AND 支撑趋势线1>支撑趋势线 AND CLOSE>MA(CLOSE,支撑趋势线) AND 使用>=REF(CLOSE,使用) AND CROSS(顶线1,使用) AND LOW>GSKZ1 AND J<90,LOW *0.9,'主升' ),COLORRED;
DRAWTEXT(CLOSE>OPEN AND 使用>顶线 AND 顶线>支撑趋势线1 AND 支撑趋势线1>支撑趋势线 AND CROSS(顶线1,使用) AND LOW>GSKZ1 AND J<90,LOW *0.86,'回踩买进' ),COLORRED;
DRAWTEXT(CLOSE>OPEN AND CROSS(顶线,支撑趋势线) AND LOW>GSKZ1 AND J<90,LOW *0.86,'回踩买进' ),COLORRED;
STICKLINE(CLOSE> REF(CLOSE,1) ,HIGH,LOW,0,0 ),COLORRED;
STICKLINE(C<O AND C>REF(C,1),C,O,3,0),COLORFFCC00;
STICKLINE(CLOSE> REF(CLOSE,1) AND C>O ,OPEN,CLOSE,3,0 ),COLOR000055;
STICKLINE(CLOSE> REF(CLOSE,1) AND C>O ,OPEN,CLOSE,2.7,0 ),COLOR000077;
STICKLINE(CLOSE> REF(CLOSE,1) AND C>O ,OPEN,CLOSE,2.1,0 ),COLOR000099;
STICKLINE(CLOSE> REF(CLOSE,1) ,OPEN,CLOSE,1.5,0 ),COLOR0000BB;
STICKLINE(CLOSE> REF(CLOSE,1) ,OPEN,CLOSE,0.9,0 ),COLOR0000DD;
STICKLINE(CLOSE> REF(CLOSE,1) ,OPEN,CLOSE,0.3,0 ),COLOR0000FF;
STICKLINE(CLOSE= REF(CLOSE,1) ,H,L,3,1 ),COLOR999999;
STICKLINE(CLOSE= REF(CLOSE,1) ,HIGH,LOW,0,0 ),COLORWHITE;
STICKLINE(CLOSE= REF(CLOSE,1) ,OPEN,CLOSE,3,0 ),COLOR555555;
STICKLINE(CLOSE= REF(CLOSE,1) ,OPEN,CLOSE,2.7,0 ),COLOR777777;
STICKLINE(CLOSE= REF(CLOSE,1) ,OPEN,CLOSE,2.1,0 ),COLOR999999;
STICKLINE(CLOSE= REF(CLOSE,1) ,OPEN,CLOSE,1.5,0 ),COLORBBBBBB;
STICKLINE(CLOSE= REF(CLOSE,1) ,OPEN,CLOSE,0.9,0 ),COLORDDDDDD;
STICKLINE(CLOSE= REF(CLOSE,1) ,OPEN,CLOSE,0.3,0 ),COLORFFFFFF;
STICKLINE(CLOSE< REF(CLOSE,1) ,HIGH,LOW,0,1 ),COLORCYAN;
STICKLINE(C<REF(C,1) AND C>O,C,O,3,0),COLORFFCC00;
STICKLINE(C<REF(C,1) AND C<O ,OPEN,CLOSE,3,0 ),COLOR990000;
STICKLINE(C<REF(C,1) AND C<O ,OPEN,CLOSE,2.7,0 ),COLORCC0000;
STICKLINE(CLOSE< REF(C,1) ,OPEN,CLOSE,2.1,0 ),COLORFF4400;
STICKLINE(CLOSE< REF(C,1) ,OPEN,CLOSE,1.5,0 ),COLORFF8800;
STICKLINE(CLOSE< REF(C,1) ,OPEN,CLOSE,0.9,0 ),COLORFFCC00;
STICKLINE(CROSS(J,D1) AND J<70,CLOSE,OPEN,3.2,0),COLORBB00FF;
STICKLINE(CROSS(J,D1) AND J<70,CLOSE,OPEN,2.7,0),COLORFF33FF;
STICKLINE(CROSS(J,D1) AND J<70,CLOSE,OPEN,2.1,0), COLORFF66FF;
STICKLINE(CROSS(J,D1) AND J<70,CLOSE,OPEN,1.5,0),COLORFF99FF;
STICKLINE(CROSS(J,D1) AND J<70,CLOSE,OPEN,0.9,0),COLORFFBBFF;
STICKLINE(CROSS(J,D1) AND J<70,CLOSE,OPEN,0.3,0),COLORFFDDFF;
来函数检测结果如下:
该公式没有未来函数
解密、编写股票、期货策略请联系QQ或微信同号:88652583
相关股票指标公式
原理解析:
{趋势买卖副图指标源码如下}GSKZ1赋值:REF((最低价+OPEN+CLOSE+HIGH)/4,1)
GSKZ2赋值:SMA(最低价-GSKZ1的绝对值,13,1)/SMA(最低价-GSKZ1和0较大值,10,1)
GSKZ3赋值:GSKZ2的10日指数移动平均
GSKZ4赋值:33日内最低价最低值
如果最低价<=GSKZ4返回GSKZ3否则返回0
输出主力进场:IF(GSKZ5>1日前的GSKZ5,GSKZ5,0),COLORRED,NODRAW
STICKLINE(GSKZ5>1日前的GSKZ5,0,-GSKZ5,3,-1),COLORFFFF00
输出洗盘:IF(GSKZ5<1日前的GSKZ5,GSKZ5,0),COLORGREEN,NODRAW
STICKLINE(GSKZ5<1日前的GSKZ5,0,-GSKZ5,3,-1),COLORFF00FF
NMTM赋值:C-1日前的C
输出生命线:100*NMTM的5日指数移动平均,5)/EMA(EMA(NMTM的绝对值,5),5),COLORRED,LINETHICK1
输出趋势线:生命线的9日简单移动平均,COLORFFCAC5,LINETHICK1,DOTLINE
买点赋值:BARSLASTCOUNT(1日前的生命线<=生命线)=1
STICKLINE(1日前的生命线<=生命线,生命线,1日前的生命线,2,0),COLORRED
STICKLINE(1日前的生命线>生命线,生命线,1日前的生命线,2,0),COLORGREEN
输出XG:(GSKZ5<1日前的GSKZ5 AND REF(NOT(GSKZ5<1日前的GSKZ5),1)) AND (REF(生命线,1)<=生命线AND REF(NOT(REF(生命线,1)<=生命线),1)),COLORFF00FF,NODRAW
当满足条件买点时,在生命线和9之间画图标
{趋势买卖主图指标源码如下}回归斜率线A赋值:EMA(SLOPE(C,4)*20+C,42)
趋势RL赋值:(CLOSE-9日内最低价最低值)/(9日内HIGH最高值-9日内最低价最低值)*100
趋势RL的3日[1日权重]移动平均
趋势K的3日[1日权重]移动平均
趋势J赋值:3*趋势K-2*趋势D
MAHL1赋值:100*((EMA((H+L)/2,3)-LLV(EMA((H+L)/2,5),30)-(EMA(H,20)-EMA(L,20))) /(LLV(EMA((H+L)/2,5),30)-(EMA(H,20)-EMA(L,20))))
MAHL2赋值:IF(C的2日指数移动平均>回归斜率线A AND MAHL1>0,C的3日指数移动平均,LLV(EMA((H+L)/2,5),30))
MAHL3赋值:IF(C的2日指数移动平均>回归斜率线A AND MAHL1>0,LLV(EMA((H+L)/2,5),30),EMA(C,5))
输出回归斜率带:DRAWBAND(回归斜率线A,RGB(235,0,230),2日前的回归斜率线A,RGB(0,104,154))
C的6.5日[1日权重]移动平均
C的14.5日[1日权重]移动平均
C的3日[1日权重]移动平均
C的8日[1日权重]移动平均
C的3.5日[1日权重]移动平均
DRAWTEXT(支撑趋势线1上穿顶线1,H*1.08,'洗盘'),COLOR00FF00
BBI赋值:(CLOSE的3日简单移动平均+CLOSE的6日简单移动平均+CLOSE的12日简单移动平均+CLOSE的25日简单移动平均)/4
UPR赋值:BBI+3*BBI的13估算标准差,LINETHICK2
DWN赋值:BBI-3*BBI的13估算标准差
安全赋值:CLOSE的55日简单移动平均,LINETHICK2
LC赋值:1日前的CLOSE
RSI赋值:SMA(CLOSE-LC和0较大值,6,1)/SMA(CLOSE-LC的绝对值,6,1)*100
DRAWTEXT( 82上穿RSI AND CLOSE<顶线1 , HIGH*1.04,'减仓') ,COLORFF9966,LINETHICK2
A7赋值:(2*C+H+L)/4
输出使用:A7的5日简单移动平均,COLORBLUE,LINETHICK2
使用1:=A7的5日简单移动平均*1.03,LINETHICK2
使用2:=A7的5日简单移动平均*0.97,LINETHICK2
DRAWTEXT( 顶线1上穿顶线 AND 顶线1>使用,最低价 *0.92,'买进' ),COLORYEL最低价
输出GSKZ1:21日内A7最低值
输出GSKZ2:30日内A7最高值
DRAWTEXT( 顶线1上穿使用 AND 顶线1<支撑趋势线 AND 顶线1<支撑趋势线1 AND 顶线1<顶线 AND CLOSE>GSKZ1,最低价 *0.98,'见底' ),COLORYEL最低价
YCX赋值:使用>=1日前的使用
H1赋值:顶线和支撑趋势线1较大值,支撑趋势线)
L1赋值:顶线和支撑趋势线1的较小值,支撑趋势线)
DRAWTEXT(顶线1上穿支撑趋势线1 AND 顶线1>使用 ,最低价 *0.98,'全仓' ),COLORYEL最低价
SK赋值:EMA((A7-GSKZ1)/(GSKZ2-GSKZ1)*100,7)
SD赋值:E0.667*1日前的SK+0.333*SK的5日简单移动平均
M1赋值:1000*使用/支撑趋势线<=1015 AND 1000*使用/支撑趋势线>=975
M2赋值:1000*支撑趋势线1/支撑趋势线<=1020 AND 支撑趋势线1/支撑趋势线>=980
M3赋值:1000*顶线/支撑趋势线<=1015 AND 顶线/支撑趋势线>=985
DRAWTEXT(IF(COUNT(CLOSE<1日前的CLOSE,13)/13>6/10 ANDCOUNT(SK>SD,6) AND 5日前的最低价=120日内最低价最低值 AND 4日前的CLOSE>=OPEN AND3日前的CLOSE>OPEN AND 2日前的CLOSE>OPEN AND 1日前的OPEN>CLOSE ANDOPEN>1日前的CLOSE,1,0),最低价*0.94,'买进') ,COLORYEL最低价
D赋值:CLOSE的89日简单移动平均-CLOSE的10日简单移动平均/3
DRAWTEXT(IF(CLOSE成交量的5日简单移动平均/240 AND CLOSE>1日前的CLOSE*1.08AND CLOSERSV赋值:(CLOSE-25日内最低价最低值)/(25日内HIGH最高值-25日内最低价最低值)*100
RSV的3日[1日权重]移动平均
K的3日[1日权重]移动平均
J赋值:3*K-2*D1
GSKZ3赋值:(2*CLOSE+HIGH+最低价)/3
GSKZ4赋值:GSKZ3的4日指数移动平均,4),4)
E赋值:(GSKZ4-1日前的GSKZ4)/1日前的GSKZ4*100
F赋值:E的3日简单移动平均+0.03
G赋值:E的1日简单移动平均
DRAWICON(F上穿G AND J>65,HIGH*1.02,15),COLORGREEN
DRAWICON(G上穿F,最低价,9),COLORYEL最低价
DRAWTEXT(CLOSE>OPEN AND H1GSKZ1 AND 顶线1>支撑趋势线 AND J<90,最低价 *0.9,'主升' ),COLORRED
DRAWTEXT( 顶线1上穿使用 AND M1 AND M2 AND M3,最低价 *0.94,'买进' ),COLORYEL最低价
DRAWTEXT(CLOSE>OPEN AND 顶线>支撑趋势线1 AND 支撑趋势线1>支撑趋势线 AND CLOSE>CLOSE的支撑趋势线日简单移动平均 AND 使用>=使用日前的CLOSE AND 顶线1上穿使用 AND 最低价>GSKZ1 AND J<90,最低价 *0.9,'主升' ),COLORRED
DRAWTEXT(CLOSE>OPEN AND 使用>顶线 AND 顶线>支撑趋势线1 AND 支撑趋势线1>支撑趋势线 AND 顶线1上穿使用 AND 最低价>GSKZ1 AND J<90,最低价 *0.86,'回踩买进' ),COLORRED
DRAWTEXT(CLOSE>OPEN AND 顶线上穿支撑趋势线 AND 最低价>GSKZ1 AND J<90,最低价 *0.86,'回踩买进' ),COLORRED
STICKLINE(CLOSE> 1日前的CLOSE ,HIGH,最低价,0,0 ),COLORRED
STICKLINE(C1日前的C,C,O,3,0),COLORFFCC00
STICKLINE(CLOSE> 1日前的CLOSE AND C>O ,OPEN,CLOSE,3,0 ),COLOR000055
STICKLINE(CLOSE> 1日前的CLOSE AND C>O ,OPEN,CLOSE,2.7,0 ),COLOR000077
STICKLINE(CLOSE> 1日前的CLOSE AND C>O ,OPEN,CLOSE,2.1,0 ),COLOR000099
STICKLINE(CLOSE> 1日前的CLOSE ,OPEN,CLOSE,1.5,0 ),COLOR0000BB
STICKLINE(CLOSE> 1日前的CLOSE ,OPEN,CLOSE,0.9,0 ),COLOR0000DD
STICKLINE(CLOSE> 1日前的CLOSE ,OPEN,CLOSE,0.3,0 ),COLOR0000FF
STICKLINE(CLOSE= 1日前的CLOSE ,H,L,3,1 ),COLOR999999
STICKLINE(CLOSE= 1日前的CLOSE ,HIGH,最低价,0,0 ),COLORWHITE
STICKLINE(CLOSE= 1日前的CLOSE ,OPEN,CLOSE,3,0 ),COLOR555555
STICKLINE(CLOSE= 1日前的CLOSE ,OPEN,CLOSE,2.7,0 ),COLOR777777
STICKLINE(CLOSE= 1日前的CLOSE ,OPEN,CLOSE,2.1,0 ),COLOR999999
STICKLINE(CLOSE= 1日前的CLOSE ,OPEN,CLOSE,1.5,0 ),COLORBBBBBB
STICKLINE(CLOSE= 1日前的CLOSE ,OPEN,CLOSE,0.9,0 ),COLORDDDDDD
STICKLINE(CLOSE= 1日前的CLOSE ,OPEN,CLOSE,0.3,0 ),COLORFFFFFF
STICKLINE(CLOSE< 1日前的CLOSE ,HIGH,最低价,0,1 ),画青色
STICKLINE(C<1日前的C AND C>O,C,O,3,0),COLORFFCC00
STICKLINE(C<1日前的C AND CSTICKLINE(C<1日前的C AND CSTICKLINE(CLOSE< 1日前的C ,OPEN,CLOSE,2.1,0 ),COLORFF4400
STICKLINE(CLOSE< 1日前的C ,OPEN,CLOSE,1.5,0 ),COLORFF8800
STICKLINE(CLOSE< 1日前的C ,OPEN,CLOSE,0.9,0 ),COLORFFCC00
STICKLINE(J上穿D1 AND J<70,CLOSE,OPEN,3.2,0),COLORBB00FF
STICKLINE(J上穿D1 AND J<70,CLOSE,OPEN,2.7,0),COLORFF33FF
STICKLINE(J上穿D1 AND J<70,CLOSE,OPEN,2.1,0), COLORFF66FF
STICKLINE(J上穿D1 AND J<70,CLOSE,OPEN,1.5,0),COLORFF99FF
STICKLINE(J上穿D1 AND J<70,CLOSE,OPEN,0.9,0),COLORFFBBFF
STICKLINE(J上穿D1 AND J<70,CLOSE,OPEN,0.3,0),COLORFFDDFF