通达信【飞牛分时】套装 分时买卖 精准的买卖信号 源码
{飞牛分时主图源码如下}
RQ:=DATETODAY(DATE)-DATETODAY(REF(DATE,TOTALBARSCOUNT-CURRBARSCOUNT))+1;
JY:=BARSLAST((RQ-REF(RQ,1))!=WEEKDAY-REF(WEEKDAY,1) OR TOTALBARSCOUNT-CURRBARSCOUNT=0)+1;
MA1:=REF(C,JY);
MA2:=REF(MA1,JY);
MA3:=REF(MA2,JY);
MA4:=REF(MA3,JY);
MA5:=REF(MA4,JY);
MA6:=REF(MA5,JY);
MA7:=REF(MA6,JY);
MA8:=REF(MA7,JY);
MA9:=REF(MA8,JY);
H1:=MAX(DYNAINFO(3),DYNAINFO(5));
L1:=MIN(DYNAINFO(3),DYNAINFO(6));
P1:=H1-L1;
阻力:L1+P1*8/9,COLORLIRED,DOTLINE;
支撑:L1+P1*0.5/9,COLORGREEN,DOTLINE;
均线:IF(BETWEEN(C/(SUM(AMOUNT,0)/SUM(VOL*100,0)),1.05,0.95)=0,MA(C,0),(SUM(AMOUNT,0)/SUM(VOL*100,0))),COLORYELLOW,DOTLINE;
DIF:=(EMA(CLOSE,12)-EMA(CLOSE,26))+DYNAINFO(3);
DEA:=EMA(DIF,9);
MACD1:=10*(DIF-DEA);
MACD2:=EMA(MACD1,2);
XX:=SUM(AMOUNT,BARSCOUNT(CLOSE))/SUM(V*100,BARSCOUNT(CLOSE));
主力:=EXPMA(CLOSE/XX,20);
大户:=EXPMA(CLOSE/XX,60);
散户:=EXPMA(CLOSE/XX,120);
底:=1;
1.022,NODRAW;
高:=1.033;
DRAWTEXT(CROSS(主力,1.02),C*0.999,' 拉'),COLORMAGENTA;
DRAWICON(CROSS(主力,1.04),C,45);
DRAWTEXT(CROSS(主力,1.04),C*0.999,' 冲'),COLORRED;
A1:=(VOL/CLOSE)/3;
A2:=SUM((IF(((A1>40) AND (CLOSE>(REF(CLOSE,1)))),A1,0)),0);
A3:=SUM((IF(((A1>40) AND (CLOSE< (REF(CLOSE,1)))),A1,0)),0);
A4:=SUM((IF(((A1< 40) AND (CLOSE>(REF(CLOSE,1)))),A1,0)),0);
A5:=SUM((IF(((A1< 40) AND (CLOSE< (REF(CLOSE,1)))),A1,0)),0);
A6:=((A2+A3)+A4)+A5;
A7:=IF((BARSTATUS=2),((100*A2)/A6),0);
A8:=((IF((BARSTATUS=2),((100*A3)/A6),0)));
A9:=((IF((BARSTATUS=2),((100*A4)/A6),0)));
A10:=((IF((BARSTATUS=2),((100*A5)/A6),0)));
DRAWTEXT(LONGCROSS(支撑,C,2),C-0.01,' 买入'),COLOR0000FF;
DRAWICON(LONGCROSS(支撑,C,2),C-0.01,1);
STICKLINE(LONGCROSS(支撑,C,2),C,阻力,0,-1),COLORCYAN;
DRAWTEXT(LONGCROSS(C,阻力,2),C+0.01,' 卖出'),COLORGREEN;
DRAWICON(LONGCROSS(C,阻力,2),C+0.01,45);
STICKLINE(LONGCROSS(C,阻力,2),C,支撑,0,-1),COLORRED;
量价:=(VOL/CLOSE)/3;
B2:=SUM((IF(((量价>0.20) AND (CLOSE>(REF(CLOSE,1)))),量价,0)),0);
B3:=SUM((IF(((量价>0.20) AND (CLOSE< (REF(CLOSE,1)))),量价,0)),0);
B6:=B2+B3;
DD1:=1;
比:=B2/B3;
D1:=YEAR AND MONTH AND DAY;
BA1:=STRCAT(CON2STR(YEAR,0),'年');
BA2:=STRCAT(CON2STR(MONTH,0),'月');
BA3:=STRCAT(CON2STR(DAY,0),'日');
BA4:=STRCAT('星期',IF(WEEKDAY=1,'一',IF(WEEKDAY=2,'二',IF(WEEKDAY=3,'三',IF(WEEKDAY=4,'四',IF(WEEKDAY=5,'五',IF(WEEKDAY=6,'六','日')))))));
AA:=STRCAT(STRCAT(STRCAT(BA1,BA2),STRCAT(BA3,BA4)),'');
DRAWTEXT_FIX(D1,0.905,0,0,AA),COLORGRAY;
{飞牛顶底副图源码如下}
DRAWGBK(C>0, RGB(50,60,250),RGB(17,21,89),0,'11',0);
H1:=MAX(DYNAINFO(3),DYNAINFO(5));
L1:=MIN(DYNAINFO(3),DYNAINFO(6));
P1:=H1-L1;
阻力:=L1+P1*7/8,COLORGREEN;
支撑:=L1+P1*0.5/8,COLORRED;
中线:=(支撑+阻力)/2,COLORWHITE,POINTDOT;
V11:=3*SMA((C-LLV(L,55))/(HHV(H,55)-LLV(L,55))*100,5,1)-2*SMA(SMA((C-LLV(L,55))/(HHV(H,55)-LLV(L,55))*100,5,1),3,1);
趋势线:EMA(V11,3),LINETHICK2,COLORLIMAGENTA;
V12:=(趋势线-REF(趋势线,1))/REF(趋势线,1)*100;
准备买入:STICKLINE(趋势线<11,趋势线,11,5,0),COLORYELLOW;
AA:=(趋势线<11) AND FILTER((趋势线<=11),15) AND C<中线;
BB0:=REF(趋势线,1)<11 AND CROSS(趋势线,11) AND C<中线;
BB1:=REF(趋势线,1)<11 AND REF(趋势线,1)>6 AND CROSS(趋势线,11);
BB2:=REF(趋势线,1)<6 AND REF(趋势线,1)>3 AND CROSS(趋势线,6);
BB3:=REF(趋势线,1)<3 AND REF(趋势线,1)>1 AND CROSS(趋势线,3);
BB4:=REF(趋势线,1)<1 AND REF(趋势线,1)>0 AND CROSS(趋势线,1);
BB5:=REF(趋势线,1)<0 AND CROSS(趋势线,0);
BB:=BB1=1 OR BB2=1 OR BB3=1 OR BB4=1 OR BB5=1;
下单买入:STICKLINE(BB=1 AND C<中线,11,50,5,0),COLORRED;
DRAWICON(BB=1 AND C<中线,55,1);
DRAWTEXT(BB0,60,'★买'),COLORRED;
DRAWTEXT(AA,16,'准备买入'),COLORYELLOW;
准备卖出:STICKLINE(趋势线>89,趋势线,89,5,0),COLORWHITE;
CC:=(趋势线>89) AND FILTER((趋势线>89),15) AND C>中线;
DD0:=REF(趋势线,1)>89 AND CROSS(89,趋势线) AND C>中线;
DD1:=REF(趋势线,1)>89 AND REF(趋势线,1)<94 AND CROSS(89,趋势线);
DD2:=REF(趋势线,1)>94 AND REF(趋势线,1)<97 AND CROSS(94,趋势线);
DD3:=REF(趋势线,1)>97 AND REF(趋势线,1)>99 AND CROSS(97,趋势线);
DD4:=REF(趋势线,1)>99 AND REF(趋势线,1)<100 AND CROSS(99,趋势线);
DD5:=REF(趋势线,1)>100 AND CROSS(100,趋势线);
DD:=DD1=1 OR DD2=1 OR DD3=1 OR DD4=1 OR DD5=1;
下单卖出:STICKLINE(DD=1 AND C>中线,89,50,5,0),COLORGREEN;
DRAWICON(DD=1 AND C>中线,45,2);
DRAWTEXT(DD0,40,'★卖'),COLORGREEN;
DRAWTEXT (CC,84,'准备卖出'),COLORWHITE;
顶:89,COLORGREEN;
底:11,COLORRED;
中:50,POINTDOT,COLORWHITE;
DRAWTEXT(ISLASTBAR,顶,'顶'),COLORGREEN;
DRAWTEXT(ISLASTBAR,底,'底'),COLORRED;
DRAWTEXT(ISLASTBAR,中,'中'),COLORWHITE;
{飞牛趋势副图源码如下}
VAR1:=LLV(LOW,100);
VAR2:=HHV(HIGH,250);
飞牛趋势:EMA((CLOSE-VAR1)/(VAR2-VAR1)*4,4);
金底:0.3,LINETHICK2,COLORRED;
金顶:3.5,LINETHICK2,COLORGREEN;
牛熊分界:2,COLORWHITE,POINTDOT;
DRAWTEXT(CROSS(飞牛趋势,金底),0.80,'B'), COLORRED;
DRAWTEXT(CROSS(飞牛趋势,金顶),3.8,'S'), COLORGREEN;
未来函数检测结果如下:
该公式包含未来函数:DYNAINFO
解密、编写股票、期货策略请联系QQ或微信同号:88652583
相关股票指标公式
原理解析:
{飞牛分时主图源码如下}RQ赋值:DATETODAY(DATE)-DATETODAY(TOTALBARSCOUNT- 到最后交易的周期日前的DATE)+1
JY赋值:上次(RQ-1日前的RQ距今天数!=WEEKDAY-1日前的WEEKDAY OR TOTALBARSCOUNT- 到最后交易的周期=0)+1
MA1赋值:JY日前的C
MA2赋值:JY日前的MA1
MA3赋值:JY日前的MA2
MA4赋值:JY日前的MA3
MA5赋值:JY日前的MA4
MA6赋值:JY日前的MA5
MA7赋值:JY日前的MA6
MA8赋值:JY日前的MA7
MA9赋值:JY日前的MA8
H1赋值:MAX(DYNAINFO(3),DYNAINFO(5))
L1赋值:MIN(DYNAINFO(3),DYNAINFO(6))
P1赋值:H1-L1
输出阻力:L1+P1*8/9,COLORLIRED,DOTLINE
输出支撑:L1+P1*0.5/9,画绿色,DOTLINE
输出均线:IF(BETWEEN(C/(0的成交额日累和/0的成交量*100日累和),1.05,0.95)=0,C的0日简单移动平均,(0的成交额日累和/0的成交量*100日累和)),画黄色,DOTLINE
DIF赋值:(收盘价的12日指数移动平均-收盘价的26日指数移动平均)+DYNAINFO(3)
DEA赋值:DIF的9日指数移动平均
MACD1赋值:10*(DIF-DEA)
MACD2赋值:MACD1的2日指数移动平均
XX赋值:SUM(成交额,收盘价的有效数据周期数)/SUM(V*100,收盘价的有效数据周期数)
主力赋值:收盘价/XX的20日指数移动平均
大户赋值:收盘价/XX的60日指数移动平均
散户赋值:收盘价/XX的120日指数移动平均
底赋值:1
1.022,NODRAW
高赋值:1.033
DRAWTEXT(主力上穿1.02,C*0.999,' 拉'),画洋红色
DRAWICON(主力上穿1.04,C,45)
DRAWTEXT(主力上穿1.04,C*0.999,' 冲'),画红色
A1赋值:(成交量/收盘价)/3
A2赋值:SUM((IF(((A1>40) AND (收盘价>(1日前的收盘价))),A1,0)),0)
A3赋值:SUM((IF(((A1>40) AND (收盘价< (1日前的收盘价))),A1,0)),0)
A4赋值:SUM((IF(((A1< 40) AND (收盘价>(1日前的收盘价))),A1,0)),0)
A5赋值:SUM((IF(((A1< 40) AND (收盘价< (1日前的收盘价))),A1,0)),0)
A6赋值:((A2+A3)+A4)+A5
A7赋值:IF((BARSTATUS=2),((100*A2)/A6),0)
A8赋值:((IF((BARSTATUS=2),((100*A3)/A6),0)))
A9赋值:((IF((BARSTATUS=2),((100*A4)/A6),0)))
A10:=((IF((BARSTATUS=2),((100*A5)/A6),0)))
DRAWTEXT(LONGCROSS(支撑,C,2),C-0.01,' 买入'),COLOR0000FF
DRAWICON(LONGCROSS(支撑,C,2),C-0.01,1)
STICKLINE(LONGCROSS(支撑,C,2),C,阻力,0,-1),画青色
DRAWTEXT(LONGCROSS(C,阻力,2),C+0.01,' 卖出'),画绿色
DRAWICON(LONGCROSS(C,阻力,2),C+0.01,45)
STICKLINE(LONGCROSS(C,阻力,2),C,支撑,0,-1),画红色
量价赋值:(成交量/收盘价)/3
B2赋值:SUM((IF(((量价>0.20) AND (收盘价>(1日前的收盘价))),量价,0)),0)
B3赋值:SUM((IF(((量价>0.20) AND (收盘价< (1日前的收盘价))),量价,0)),0)
B6赋值:B2+B3
DD1赋值:1
比赋值:B2/B3
D1赋值:YEAR AND MONTH AND DAY
BA1赋值:STRCAT(CON2STR(YEAR,0),'年')
BA2赋值:STRCAT(CON2STR(MONTH,0),'月')
BA3赋值:STRCAT(CON2STR(DAY,0),'日')
BA4赋值:STRCAT('星期',IF(WEEKDAY=1,'一',IF(WEEKDAY=2,'二',IF(WEEKDAY=3,'三',IF(WEEKDAY=4,'四',IF(WEEKDAY=5,'五',IF(WEEKDAY=6,'六','日')))))))
AA赋值:STRCAT(STRCAT(STRCAT(BA1,BA2),STRCAT(BA3,BA4)),'')
当满足条件D1时,在横轴0.905纵轴0位置书写文字
{飞牛顶底副图源码如下} 填充背景(C>0, RGB(50,60,250),RGB(17,21,89),0,'11',0)
H1赋值:MAX(DYNAINFO(3),DYNAINFO(5))
L1赋值:MIN(DYNAINFO(3),DYNAINFO(6))
P1赋值:H1-L1
阻力赋值:L1+P1*7/8,画绿色
支撑赋值:L1+P1*0.5/8,画红色
中线赋值:(支撑+阻力)/2,画白色,POINTDOT
V11赋值:3*SMA((C-55日内L最低值)/(55日内H最高值-55日内L最低值)*100,5,1)-2*SMA(SMA((C-55日内L最低值)/(55日内H最高值-55日内L最低值)*100,5,1),3,1)
输出趋势线:V11的3日指数移动平均, 线宽为2,COLORLIMAGENTA
V12赋值:(趋势线-1日前的趋势线)/1日前的趋势线*100
当满足条件趋势线<11时,在趋势线和11之间画柱状线
AA赋值:(趋势线<11) AND FILTER((趋势线<=11),15) AND C<中线
BB0赋值:1日前的趋势线<11 AND 趋势线上穿11 AND C<中线
BB1赋值:1日前的趋势线<11 AND 1日前的趋势线>6 AND 趋势线上穿11
BB2赋值:1日前的趋势线<6 AND 1日前的趋势线>3 AND 趋势线上穿6
BB3赋值:1日前的趋势线<3 AND 1日前的趋势线>1 AND 趋势线上穿3
BB4赋值:1日前的趋势线<1 AND 1日前的趋势线>0 AND 趋势线上穿1
BB5赋值:1日前的趋势线<0 AND 趋势线上穿0
BB赋值:BB1=1 OR BB2=1 OR BB3=1 OR BB4=1 OR BB5=1
当满足条件BB=1 AND C<中线时,在11和50之间画柱状线
当满足条件BB=1 AND C<中线时,在55和1之间画图标
当满足条件BB0时,在60和'★买'位置书写文字
当满足条件AA时,在16和'准备买入'位置书写文字
当满足条件趋势线>89时,在趋势线和89之间画柱状线
CC赋值:(趋势线>89) AND FILTER((趋势线>89),15) AND C>中线
DD0赋值:1日前的趋势线>89 AND 89上穿趋势线 AND C>中线
DD1赋值:1日前的趋势线>89 AND 1日前的趋势线<94 AND 89上穿趋势线
DD2赋值:1日前的趋势线>94 AND 1日前的趋势线<97 AND 94上穿趋势线
DD3赋值:1日前的趋势线>97 AND 1日前的趋势线>99 AND 97上穿趋势线
DD4赋值:1日前的趋势线>99 AND 1日前的趋势线<100 AND 99上穿趋势线
DD5赋值:1日前的趋势线>100 AND 100上穿趋势线
DD赋值:DD1=1 OR DD2=1 OR DD3=1 OR DD4=1 OR DD5=1
当满足条件DD=1 AND C>中线时,在89和50之间画柱状线
当满足条件DD=1 AND C>中线时,在45和2之间画图标
当满足条件DD0时,在40和'★卖'位置书写文字
DRAWTEXT (CC,84,'准备卖出'),画白色
输出顶:89,画绿色
输出底:11,画红色
输出中:50,POINTDOT,画白色
当满足条件ISLASTBAR时,在顶和'顶'位置书写文字
当满足条件ISLASTBAR时,在底和'底'位置书写文字
当满足条件ISLASTBAR时,在中和'中'位置书写文字
{飞牛趋势副图源码如下}VAR1赋值:100日内最低价最低值
VAR2赋值:250日内最高价最高值
输出飞牛趋势:EMA((收盘价-VAR1)/(VAR2-VAR1)*4,4)
金输出底:0.3, 线宽为2,画红色
金输出顶:3.5, 线宽为2,画绿色
输出牛熊分界:2,画白色,POINTDOT
DRAWTEXT(飞牛趋势上穿金底,0.80,'B'), 画红色
DRAWTEXT(飞牛趋势上穿金顶,3.8,'S'), 画绿色