HGRID分时通达信公式 主图 源码附图
H1:=MAX(DYNAINFO(3),DYNAINFO(5));
L1:=MIN(DYNAINFO(3),DYNAINFO(6));
P1:=H1-L1;
阻力:L1+P1*7/8,COLORLIGREEN;
支撑:L1+P1*0.5/8,COLORRED;
中:(支撑+阻力)/2,COLORWHITE;
现价:CLOSE,COLORWHITE,LINETHICK2;
SELL1:中+(阻力-中)*1/3,COLORYELLOW,POINTDOT;
SELL2:中+(阻力-中)*2/3,COLORYELLOW,POINTDOT;
BUY1:中-(中-支撑)*1/3,COLORYELLOW,POINTDOT;
BUY2:中-(中-支撑)*2/3,COLORYELLOW,POINTDOT;
DRAWTEXT(CURRBARSCOUNT=8,阻力+0.003,'阻力'),COLORGREEN,LINETHICK1;
DRAWTEXT(CURRBARSCOUNT=8,支撑-0.003,'支撑'),COLORLIRED,LINETHICK1;
DRAWTEXT(CURRBARSCOUNT=8,(支撑+阻力)/2,'基准'),COLORWHITE,LINETHICK1;
DAYUPSELL2:=BARSLAST(CROSS(C,SELL2));
DRAWICON(COUNT(C>阻力,DAYUPSELL2)>=1 AND CROSS(SELL2,C),SELL2,1);
DAYUPSELL1:=BARSLAST(CROSS(C,SELL1));
DRAWICON(COUNT(C>SELL2,DAYUPSELL1)>=1 AND CROSS(SELL1,C),SELL1,1);
DAYUPZHONG:=BARSLAST(CROSS(C,中));
DRAWICON(COUNT(C>SELL1,DAYUPZHONG)>=1 AND CROSS(中,C),中,1);
DAYUPBUY1:=BARSLAST(CROSS(C,BUY1));
DRAWICON(COUNT(C>中,DAYUPBUY1)>=1 AND CROSS(BUY1,C),BUY1,1);
DAYUPBUY2:=BARSLAST(CROSS(C,BUY2));
DRAWICON(COUNT(C>BUY1,DAYUPBUY2)>=1 AND CROSS(BUY2,C),BUY2,1);
DAYUPZC:=BARSLAST(CROSS(C,支撑));
DRAWICON(COUNT(C>BUY2,DAYUPZC)>=1 AND CROSS(支撑,C),支撑,1);
DAYDOWNBUY2:=BARSLAST(CROSS(BUY2,C));
DRAWICON(COUNT(C<支撑,DAYDOWNBUY2)>=1 AND CROSS(C,BUY2),BUY2,2);
DAYDOWNBUY1:=BARSLAST(CROSS(BUY1,C));
DRAWICON(COUNT(C<BUY2,DAYDOWNBUY1)>=1 AND CROSS(C,BUY1),BUY1,2);
DAYDOWNZHONG:=BARSLAST(CROSS(中,C));
DRAWICON(COUNT(C<BUY1,DAYDOWNZHONG)>=1 AND CROSS(C,中),中,2);
DAYDOWNSELL1:=BARSLAST(CROSS(SELL1,C));
DRAWICON(COUNT(C<中,DAYDOWNSELL1)>=1 AND CROSS(C,SELL1),SELL1,2);
DAYDOWNSELL2:=BARSLAST(CROSS(SELL2,C));
DRAWICON(COUNT(C<SELL1,DAYDOWNSELL2)>=1 AND CROSS(C,SELL2),SELL2,2);
DAYDOWNZL:=BARSLAST(CROSS(阻力,C));
DRAWICON(COUNT(C<SELL2,DAYDOWNZL)>=1 AND CROSS(C,阻力),阻力,2);
IF(CLOSE<=BUY2,CLOSE,DRAWNULL),COLORRED,LINETHICK3;
IF(CLOSE>=SELL2,CLOSE,DRAWNULL),COLORYELLOW,LINETHICK3;
{成交数据}
成交额:=V*C/100,NODRAW;{万元}
A2:=SUM((IF(((成交额/8>20) AND (CLOSE>(REF(CLOSE,1)))),成交额,0)),0);
A3:=SUM((IF(((成交额/8>20) AND (CLOSE<(REF(CLOSE,1)))),成交额,0)),0);
A6:=(A2+A3);
A7:=IF((ISLASTBAR),((100*A2)/A6),0);
A8:=IF((ISLASTBAR),((100*A3)/A6),0);
DD1:=1;
AAA1:=STRCAT(STRCAT('机构买',CON2STR((100*A2)/A6,0)),'%');
AAA2:=STRCAT(STRCAT('机构卖',CON2STR((100*A3)/A6,0)),'%');
AAA3:=STRCAT(STRCAT('机构总买入',CON2STR((100*(A2-A3))/A6,0)),'%');
A000:=DRAWTEXT_FIX(DD1=1,0,0.02,0,AAA1),COLORRED;
A001:=DRAWTEXT_FIX(DD1=1,0,0.13,0,AAA2),COLOR00FF00;
DRAWTEXT_FIX(DD1=1,0,0.15,0,AAA1),COLOR00FFFF;
DRAWTEXT_FIX(DD1=1,0,0.20,0,AAA2),COLOR00FFFF;
DRAWTEXT_FIX(DD1=1,0.88,1,0,AAA3),COLOR00FFFF;
现手买:=BUYVOL*DYNAINFO(7)*100/10000 COLOR0000FF,NODRAW;
现手卖:=SELLVOL*DYNAINFO(7)*100/10000 COLOR00FF00,NODRAW;
合:=ABS(现手买)+ABS(现手卖)COLOR80FFFF,NODRAW;
差:=ABS(现手买)-ABS(现手卖)COLOR80FFFF,NODRAW;
MPB1:=ABS(现手买)/合*100;
MPB2:=ABS(现手卖)/合*100;
TESTSKIP(NOT(现手买 OR 现手卖 OR 合 OR 差 OR MPB1 OR MPB2)!=0);
{绿框卖}
DRAWRECTREL(595,1000,795,940,RGB(0,128,0));
DRAWRECTREL(595,995,795,945,RGB(0,148,0));
DRAWRECTREL(595,990,795,950,RGB(0,168,0));
DRAWRECTREL(595,985,795,955,RGB(0,188,0));
DRAWRECTREL(595,980,795,960,RGB(0,208,0));
DRAWRECTREL(595,975,795,965,RGB(0,228,0));
DRAWRECTREL(595,970,795,970,RGB(0,248,0));
{红框买}
DRAWRECTREL(595,1000,595+现手买*210/合,940,RGB(128,0,0));
DRAWRECTREL(595,995,595+现手买*210/合,945,RGB(148,0,0));
DRAWRECTREL(595,990,595+现手买*210/合,950,RGB(168,0,0));
DRAWRECTREL(595,985,595+现手买*210/合,955,RGB(188,0,0));
DRAWRECTREL(595,980,595+现手买*210/合,960,RGB(208,0,0));
DRAWRECTREL(595,975,595+现手买*210/合,965,RGB(228,0,0));
DRAWRECTREL(595,970,595+现手买*210/合,970,RGB(248,0,0));
DRAWRECTREL(595+现手买*210/合,940,595+现手买*210/合,1000,RGB(128,0,0));
DRAWRECTREL(795,940,795,1000,RGB(0,0.0,10));
DRAWRECTREL(594.8,939.8,594.8,1000,RGB(0,0,10));
DRAWRECTREL(594.8,939.8,594.8,939.8,RGB(0,0,10));
DRAWRECTREL(594.8,1000,594.8,1000,RGB(0,0,10));
DRAWTEXT_FIX(1,0.54,0.89,0,STRCAT(STRCAT('',CON2STR(现手买,1)),'万')),COLOR0000FF;
DRAWTEXT_FIX(1,0.785,0.89,0,STRCAT(STRCAT('',CON2STR(现手卖,1)),'万')),COLOR00FF00;
DRAWTEXT_FIX(CURRBARSCOUNT=1 AND(差)>0,0.65,0.89,0,STRCAT(' ',STRCAT(CON2STR(差,1),'万'))) COLOR0000FF;
DRAWTEXT_FIX(CURRBARSCOUNT=1 AND(差)<0,0.65,0.89,0,STRCAT(' ',STRCAT(CON2STR(差,1),'万'))) COLOR00FF00;
DRAWTEXT_FIX(CURRBARSCOUNT=1 AND(差)=0,0.65,0.89,0,STRCAT(' ',STRCAT(CON2STR(差,1),'万'))) COLOR80FFFF;
DRAWTEXT_FIX(1,0.8,0.98,0,STRCAT(STRCAT(' ',CON2STR(MPB2,1)),'%')),COLOR00FF00;
DRAWTEXT_FIX(1,0.54,0.98,0,STRCAT(STRCAT('',CON2STR(MPB1,1)),'%')),COLOR0000FF;
市盈率:=STRCAT('市盈率: ',CON2STR(C/FINANCE(33),2));
市销率:=STRCAT(' 市销率: ',CON2STR(C/(FINANCE(20)/FINANCE(1)),2));
市净率:=STRCAT(' 市净率: ',CON2STR(C/FINANCE(34),2));
净资收益率:=STRCAT(' 净资收益率: ',CON2STR(FINANCE(33)/FINANCE(34)*100,2));
毛利率:=STRCAT(' 毛利率: ',CON2STR((FINANCE(20)-FINANCE(21))/FINANCE(20)*100,2));
净利润率:=STRCAT(' 净利润率 ',CON2STR(FINANCE(30)/FINANCE(20)*100,2));
主营利润率:=STRCAT(' 主营利润率 ',CON2STR(FINANCE(23)/FINANCE(20)*100,2));
利润同比:=STRCAT(' 利润同比: ',CON2STR(FINANCE(43),2));
收入同比:=STRCAT(' 收入同比: ',CON2STR(FINANCE(44),2));
X1:=(FINANCE(11)-FINANCE(15))/FINANCE(10)*1.2;
X2:=(FINANCE(31)+FINANCE(17))/FINANCE(10)*1.4;{盈余公积用资本公积金代替};
X3:=FINANCE(23)/FINANCE(10)*3.3;
X4:=FINANCE(19)/FINANCE(15)*0.6;{缺长期负债或负债总额}
X5:=FINANCE(20)/FINANCE(15)*0.999;
Z值:=X1+X2+X3+X4+X5;
预警:=IF(Z值<1.2,'重警',IF(Z值>=1.2 AND Z值<2.6,'轻警','无警'));
财务预警:=STRCAT('财务预警: ',STRCAT(预警,STRCAT('-Z值: ',CON2STR(Z值,3))));
优质资产率:=STRCAT(' 优质资产率: ',CON2STR((FINANCE(19)-FINANCE(22)-FINANCE(27))/FINANCE(19),2));{理论上越大越好但不同行业有不同标准};
现金负债比:=STRCAT(' 现金负债比: ',CON2STR(FINANCE(25)/FINANCE(15),3));{缺长期负债或负债总额,理论上越大越好但不同行业有不同标准};
财务系数:=STRCAT('风险系数: ',STRCAT(STRCAT(财务预警,优质资产率),现金负债比));
DRAWTEXT_FIX(ISLASTBAR,0.025,0.96,0,财务系数),COLORCYAN;
{显示日期}
D1:=YEAR AND MONTH AND DAY;
AA1:=STRCAT(CON2STR(YEAR,0),'年');
未来函数检测结果如下:
该公式包含未来函数:DYNAINFO
该公式包含未来函数:FINANCE
解密、编写股票、期货策略请联系QQ或微信同号:88652583
相关股票指标公式
原理解析:
H1赋值:MAX(DYNAINFO(3),DYNAINFO(5))
L1赋值:MIN(DYNAINFO(3),DYNAINFO(6))
P1赋值:H1-L1
输出阻力:L1+P1*7/8,COLORLIGREEN
输出支撑:L1+P1*0.5/8,画红色
输出中:(支撑+阻力)/2,画白色
输出现价:收盘价,画白色, 线宽为2
SEL输出L1:中+(阻力-中)*1/3,画黄色,POINTDOT
输出SELL2:中+(阻力-中)*2/3,画黄色,POINTDOT
输出BUY1:中-(中-支撑)*1/3,画黄色,POINTDOT
输出BUY2:中-(中-支撑)*2/3,画黄色,POINTDOT
当满足条件 到最后交易的周期=8时,在阻力+0.003和'阻力'位置书写文字
当满足条件 到最后交易的周期=8时,在支撑-0.003和'支撑'位置书写文字
DRAWTEXT( 到最后交易的周期=8,(支撑+阻力)/2,'基准'),画白色,LINETHICK1
DAYUPSELL2赋值:上次C上穿SELL2距今天数
DRAWICON(统计DAYUPSELL2日满足C>阻力的天数>=1 AND SELL2上穿C,SELL2,1)
DAYUPSELL1赋值:上次C上穿SELL1距今天数
DRAWICON(统计DAYUPSELL1日满足C>SELL2的天数>=1 AND SELL1上穿C,SELL1,1)
DAYUPZHONG赋值:上次C上穿中距今天数
DRAWICON(统计DAYUPZHONG日满足C>SELL1的天数>=1 AND 中上穿C,中,1)
DAYUPBUY1赋值:上次C上穿BUY1距今天数
DRAWICON(统计DAYUPBUY1日满足C>中的天数>=1 AND BUY1上穿C,BUY1,1)
DAYUPBUY2赋值:上次C上穿BUY2距今天数
DRAWICON(统计DAYUPBUY2日满足C>BUY1的天数>=1 AND BUY2上穿C,BUY2,1)
DAYUPZC赋值:上次C上穿支撑距今天数
DRAWICON(统计DAYUPZC日满足C>BUY2的天数>=1 AND 支撑上穿C,支撑,1)
DAYDOWNBUY2赋值:上次BUY2上穿C距今天数
DRAWICON(统计DAYDOWNBUY2日满足C<支撑的天数>=1 AND C上穿BUY2,BUY2,2)
DAYDOWNBUY1赋值:上次BUY1上穿C距今天数
DRAWICON(统计DAYDOWNBUY1日满足C=1 AND C上穿BUY1,BUY1,2)
DAYDOWNZHONG赋值:上次中上穿C距今天数
DRAWICON(统计DAYDOWNZHONG日满足C=1 AND C上穿中,中,2)
DAYDOWNSELL1赋值:上次SELL1上穿C距今天数
DRAWICON(统计DAYDOWNSELL1日满足C<中的天数>=1 AND C上穿SELL1,SELL1,2)
DAYDOWNSELL2赋值:上次SELL2上穿C距今天数
DRAWICON(统计DAYDOWNSELL2日满足C=1 AND C上穿SELL2,SELL2,2)
DAYDOWNZL赋值:上次阻力上穿C距今天数
DRAWICON(统计DAYDOWNZL日满足C=1 AND C上穿阻力,阻力,2)
如果收盘价<=BUY2返回收盘价否则返回DRAWNULL
如果收盘价>=SELL2返回收盘价否则返回DRAWNULL
{成交数据}
成交额赋值:V*C/100,NODRAW
{万元}
A2赋值:SUM((IF(((成交额/8>20) AND (收盘价>(1日前的收盘价))),成交额,0)),0)
A3赋值:SUM((IF(((成交额/8>20) AND (收盘价<(1日前的收盘价))),成交额,0)),0)
A6赋值:(A2+A3)
A7赋值:IF((ISLASTBAR),((100*A2)/A6),0)
A8赋值:IF((ISLASTBAR),((100*A3)/A6),0)
DD1赋值:1
AAA1赋值:STRCAT(STRCAT('机构买',CON2STR((100*A2)/A6,0)),'%')
AAA2赋值:STRCAT(STRCAT('机构卖',CON2STR((100*A3)/A6,0)),'%')
AAA3赋值:STRCAT(STRCAT('机构总买入',CON2STR((100*(A2-A3))/A6,0)),'%')
当满足条件DD1=1时,在横轴0纵轴0.02位置书写文字
当满足条件DD1=1时,在横轴0纵轴0.13位置书写文字
当满足条件DD1=1时,在横轴0纵轴0.15位置书写文字
当满足条件DD1=1时,在横轴0纵轴0.20位置书写文字
当满足条件DD1=1时,在横轴0.88纵轴1位置书写文字
现手买赋值:BUY成交量*现价*100/10000 COLOR0000FF,NODRAW
现手卖赋值:SELL成交量*现价*100/10000 COLOR00FF00,NODRAW
合赋值:现手买的绝对值+ABS(现手卖)COLOR80FFFF,NODRAW
差赋值:现手买的绝对值-ABS(现手卖)COLOR80FFFF,NODRAW
MPB1赋值:现手买的绝对值/合*100
MPB2赋值:现手卖的绝对值/合*100
TESTSKIP(NOT(现手买 OR 现手卖 OR 合 OR 差 OR MPB1 OR MPB2)!=0)
{绿框卖}
DRAWRECTREL(595,1000,795,940,RGB(0,128,0))
DRAWRECTREL(595,995,795,945,RGB(0,148,0))
DRAWRECTREL(595,990,795,950,RGB(0,168,0))
DRAWRECTREL(595,985,795,955,RGB(0,188,0))
DRAWRECTREL(595,980,795,960,RGB(0,208,0))
DRAWRECTREL(595,975,795,965,RGB(0,228,0))
DRAWRECTREL(595,970,795,970,RGB(0,248,0))
{红框买}
DRAWRECTREL(595,1000,595+现手买*210/合,940,RGB(128,0,0))
DRAWRECTREL(595,995,595+现手买*210/合,945,RGB(148,0,0))
DRAWRECTREL(595,990,595+现手买*210/合,950,RGB(168,0,0))
DRAWRECTREL(595,985,595+现手买*210/合,955,RGB(188,0,0))
DRAWRECTREL(595,980,595+现手买*210/合,960,RGB(208,0,0))
DRAWRECTREL(595,975,595+现手买*210/合,965,RGB(228,0,0))
DRAWRECTREL(595,970,595+现手买*210/合,970,RGB(248,0,0))
DRAWRECTREL(595+现手买*210/合,940,595+现手买*210/合,1000,RGB(128,0,0))
DRAWRECTREL(795,940,795,1000,RGB(0,0.0,10))
DRAWRECTREL(594.8,939.8,594.8,1000,RGB(0,0,10))
DRAWRECTREL(594.8,939.8,594.8,939.8,RGB(0,0,10))
DRAWRECTREL(594.8,1000,594.8,1000,RGB(0,0,10))
DRAWTEXT_FIX(1,0.54,0.89,0,STRCAT(STRCAT('',CON2STR(现手买,1)),'万')),COLOR0000FF
DRAWTEXT_FIX(1,0.785,0.89,0,STRCAT(STRCAT('',CON2STR(现手卖,1)),'万')),COLOR00FF00
DRAWTEXT_FIX( 到最后交易的周期=1 AND(差)>0,0.65,0.89,0,STRCAT(' ',STRCAT(CON2STR(差,1),'万'))) COLOR0000FF
DRAWTEXT_FIX( 到最后交易的周期=1 AND(差)<0,0.65,0.89,0,STRCAT(' ',STRCAT(CON2STR(差,1),'万'))) COLOR00FF00
DRAWTEXT_FIX( 到最后交易的周期=1 AND(差)=0,0.65,0.89,0,STRCAT(' ',STRCAT(CON2STR(差,1),'万'))) COLOR80FFFF
DRAWTEXT_FIX(1,0.8,0.98,0,STRCAT(STRCAT(' ',CON2STR(MPB2,1)),'%')),COLOR00FF00
DRAWTEXT_FIX(1,0.54,0.98,0,STRCAT(STRCAT('',CON2STR(MPB1,1)),'%')),COLOR0000FF
市盈率:=STRCAT('市盈率: ',CON2STR(C/FINANCE(33),2))
市销率:=STRCAT(' 市销率: ',CON2STR(C/(FINANCE(20)/FINANCE(1)),2))
市净率:=STRCAT(' 市净率: ',CON2STR(C/FINANCE(34),2))
净资收益率:=STRCAT(' 净资收益率: ',CON2STR(FINANCE(33)/FINANCE(34)*100,2))
毛利率:=STRCAT(' 毛利率: ',CON2STR((FINANCE(20)-FINANCE(21))/FINANCE(20)*100,2))
净利润率赋值:STRCAT(' 净利润率 ',CON2STR(FINANCE(30)/FINANCE(20)*100,2))
主营利润率赋值:STRCAT(' 主营利润率 ',CON2STR(FINANCE(23)/FINANCE(20)*100,2))
利润同比:=STRCAT(' 利润同比: ',CON2STR(FINANCE(43),2))
收入同比:=STRCAT(' 收入同比: ',CON2STR(FINANCE(44),2))
X1赋值:(FINANCE(11)-FINANCE(15))/FINANCE(10)*1.2
X2赋值:(FINANCE(31)+FINANCE(17))/FINANCE(10)*1.4
{盈余公积用资本公积金代替}
X3赋值:FINANCE(23)/FINANCE(10)*3.3
X4赋值:FINANCE(19)/FINANCE(15)*0.6
{缺长期负债或负债总额}
X5赋值:FINANCE(20)/FINANCE(15)*0.999
Z值赋值:X1+X2+X3+X4+X5
预警赋值:IF(Z值<1.2,'重警',IF(Z值>=1.2 AND Z值<2.6,'轻警','无警'))
财务预警赋值:STRCAT('财务输出预警: ',STRCAT(预警,STRCAT('-输出Z值: ',CON2STR(Z值,3))))
优质资产率:=STRCAT(' 优质资产率: ',CON2STR((FINANCE(19)-FINANCE(22)-FINANCE(27))/FINANCE(19),2))
{理论上越大越好但不同行业有不同标准}
现金负债比:=STRCAT(' 现金负债比: ',CON2STR(FINANCE(25)/FINANCE(15),3))
{缺长期负债或负债总额,理论上越大越好但不同行业有不同标准}
财务系数:=STRCAT('风险系数: ',STRCAT(STRCAT(财务预警,优质资产率),现金负债比))
当满足条件ISLASTBAR时,在横轴0.025纵轴0.96位置书写文字
{显示日期}
D1赋值:YEAR AND MONTH AND DAY
AA1赋值:STRCAT(CON2STR(YEAR,0),'年')