联系方式 Contact

云指标公式网

淘宝:zb-mart.taobao.com

电话:18020657357

微信:18020657357

Q Q:396950280

点击这里给我发消息

网址:www.yzhibiao.com

搜索 Search

精品指标-股票直方图(指标 副图 大智慧 贴图)

2015-11-12 10:18:21点击:

近期心情不错,特发表我精心制作的原创指标:直方图,附送指标及其源码。
你是不是很想知道你持有的股票趋势,量价关系,大盘走势,股票与大盘、板块的走势强弱对比?好了,股票直方图让你一目了然!
直方图分两部分,左半部分体现出股票及大盘指数的量价关系,红色柱体代表了平均价格,绿色柱体代表了平均成交量,如果红色柱体节节高,则表示股票呈上升趋势。如果红色柱体上升,绿色柱体也上升,则说明价升量增,股票的趋势可以维持;如果红色柱体上升,绿色柱体下降,则说明量价背离,此种情况要看主力的持仓情况(看换手率,如股价上升,换手率低,说明主力持仓较多,也可查看前十大股东的情况),如果主力持仓重,则股票的走势取决于主力的意愿,否则说明量能衰竭,股价将反转。直方图的右半部分显示了股票涨幅与指数涨幅的对比,紫色柱体为股票的涨幅,蓝色柱体为指数的涨幅,从中可以窥见股票的走势是否强于大盘和板块。
 

代码 := STKLABEL;
SCC:=IF(STRCMP( STRLEFT(代码 ,1),'6' )=0,"SH000001$CLOSE",IF(STRCMP( STRLEFT(代码 ,1),'3' )=0,"399006$CLOSE",IF(STRCMP( STRLEFT(代码 ,3),'002' )=0,"399005$CLOSE","SZ399001$CLOSE")));{市场指数}
SCV:=IF(STRCMP( STRLEFT(代码 ,1),'6' )=0,"SH000001$VOL",IF(STRCMP( STRLEFT(代码 ,1),'3' )=0,"399006$VOL",IF(STRCMP( STRLEFT(代码 ,3),'002' )=0,"399005$VOL","SZ399001$VOL")));{市场成交量}
JJC:="998003$close";{平均价格指数}
{HYC-行业板块指数}
if INBLOCK('工程建筑') then HYC:="991002$close";
if INBLOCK('电力')  then HYC:="991003$close";
if INBLOCK('计算机') then HYC:="991004$close";
if INBLOCK('电子信息') then HYC:="991006$close";
if INBLOCK('房地产') then HYC:="991007$close";
if INBLOCK('纺织服装') then HYC:="991008$close";
if INBLOCK('钢铁') then HYC:="991009$close";
if INBLOCK('供水供气') then HYC:="991010$close";
if INBLOCK('化工化纤')  then HYC:="991011$close";
if INBLOCK('电器') then HYC:="991014$close";
if INBLOCK('交通设施') then HYC:="991016$close";
if INBLOCK('银行类') then HYC:="991017$close";
if INBLOCK('旅游酒店') then HYC:="991018$close";
if INBLOCK('煤炭石油') then HYC:="991019$close";
if INBLOCK('酿酒食品') then HYC:="991020$close";
if INBLOCK('农林牧渔') then HYC:="991021$close";
if INBLOCK('商业连锁') then HYC:="991023$close";
if INBLOCK('建材') then HYC:="991024$close";
if INBLOCK('其他行业') then HYC:="991025$close";
if INBLOCK('交通工具') then HYC:="991026$close";
if INBLOCK('机械')  then HYC:="991027$close";
if INBLOCK('医药')  then HYC:="991028$close";
if INBLOCK('外贸')  then HYC:="991031$close";
if INBLOCK('教育传媒')  then HYC:="991032$close";
if INBLOCK('仪电仪表')  then HYC:="991033$close";
if INBLOCK('有色金属')  then HYC:="991034$close";
if INBLOCK('造纸印刷') then HYC:="991035$close";
if INBLOCK('券商') then HYC:="991036$close";
if INBLOCK('通信')  then HYC:="991135$close";
if INBLOCK('运输物流') then HYC:="991136$close";
if INBLOCK('保险') then HYC:="991255$close";
if INBLOCK('非银金融') then HYC:="991256$close";

{求平均值}
MA5:=MA(CLOSE,5);
MA20:=MA(CLOSE,20);
MA60:=MA(CLOSE,60);
MAM:=MAX(MA5,MA20,MA60);
MAK5:=MA5/MAM;
MAK20:=MA20/MAM;
MAK60:=MA60/MAM;
MAV5:=MA(VOL,5);
MAV20:=MA(VOL,20);
MAV60:=MA(VOL,60);
MAVM:=MAX(MAV5,MAV20,MAV60);
MAVK5:=MAV5/MAVM;
MAVK20:=MAV20/MAVM;
MAVK60:=MAV60/MAVM;
SCC5:=MA(SCC,5);
SCC20:=MA(SCC,20);
SCC60:=MA(SCC,60);
SCCM:=MAX(SCC5,SCC20,SCC60);
SCCK5:=SCC5/SCCM;
SCCK20:=S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RIP(RGB(0,80,30),RGB(0,0,0),0));
IF BARSTATUS=2 THEN DRAWRECTREL(0 ,0,999 ,999 ,RGB(0,0,0) ),colorred;
IF BARSTATUS=2 THEN DRAWRECTREL(20 ,100,40 ,200 ,RGB(255,0,0) ),color0000ff;
IF BARSTATUS=2 THEN DRAWTEXTREL(20 ,300 ,'价格' ),colorffffff;
IF BARSTATUS=2 THEN DRAWRECTREL(20 ,600,40 ,700 ,RGB(0,255,0) ),color00ff00;
IF BARSTATUS=2 THEN DRAWTEXTREL(20 ,800 ,'成交量' ),colorffffff;
IF BARSTATUS=2 THEN DRAWTEXTREL(70 ,100 ,'股' ),colorffff00;DRAWTEXTREL(70 ,200 ,'票' ),colorffff00;
IF BARSTATUS=2 THEN DRAWRECTREL(0+100 ,500-400*MAK60,15+100 ,420 ,RGB(255,0,0) ),color0000ff;
IF BARSTATUS=2 THEN DRAWTEXTREL(0+100 ,420-400*MAK60 ,'60日' ),colorffffff;
IF BARSTATUS=2 THEN DRAWRECTREL(30+100 ,500-400*MAK20,45+100 ,420 ,RGB(255,0,0) ),color0000ff;
IF BARSTATUS=2 THEN DRAWTEXTREL(30+100 ,420-400*MAK20 ,'20日' ),colorffffff;
IF BARSTATUS=2 THEN DRAWRECTREL(60+100 ,500-400*MAK5,75+100 ,420 ,RGB(255,0,0) ),color0000ff;
IF BARSTATUS=2 THEN DRAWTEXTREL(60+100 ,420-400*MAK5 ,'5日' ),colorffffff;
IF BARSTATUS=2 THEN DRAWRECTREL(90 ,400,185 ,420 ,RGB(0,0,255) ),coloraa0000;
IF BARSTATUS=2 THEN DRAWRECTREL(0+100 ,1000-400*MAVK60,15+100 ,920 ,RGB(0,255,0) ),color00ff00;
IF BARSTATUS=2 THEN DRAWTEXTREL(0+100 ,920-400*MAVK60 ,'60日' ),colorffffff;
IF BARSTATUS=2 THEN DRAWRECTREL(30+100 ,1000-400*MAVK20,45+100 ,920 ,RGB(0,255,0) ),color00ff00;
IF BARSTATUS=2 THEN DRAWTEXTREL(30+100 ,920-400*MAVK20 ,'20日' ),colorffffff;
IF BARSTATUS=2 THEN DRAWRECTREL(60+100 ,1000-400*MAVK5,75+100 ,920 ,RGB(0,255,0) ),color00ff00;
IF BARSTATUS=2 THEN DRAWTEXTREL(60+100 ,920-400*MAVK5 ,'5日' ),colorffffff;
IF BARSTATUS=2 THEN DRAWRECTREL(90 ,900,185 ,920 ,RGB(0,0,255) ),colorff0000;
IF BARSTATUS=2 THEN DRAWTEXTREL(220 ,100 ,'大' ),colorffff00;DRAWTEXTREL(220 ,200 ,'盘' ),colorffff00;DRAWTEXTREL(220 ,300 ,'指' ),colorffff00;DRAWTEXTREL(220 ,400 ,'数' ),colorffff00;
IF BARSTATUS=2 THEN DRAWRECTREL(0+250 ,500-400*SCCK60,15+250 ,420 ,RGB(255,0,0) ),color0000ff;
IF BARSTATUS=2 THEN DRAWTEXTREL(0+250 ,420-400*SCCK60 ,'60日' ),colorffffff;
IF BARSTATUS=2 THEN DRAWRECTREL(30+250 ,500-400*SCCK20,45+250 ,420 ,RGB(255,0,0) ),color0000ff;
IF BARSTATUS=2 THEN DRAWTEXTREL(30+250 ,420-400*SCCK20 ,'20日' ),colorffffff;
IF BARSTATUS=2 THEN DRAWRECTREL(60+250 ,500-400*SCCK5,75+250 ,420 ,RGB(255,0,0) ),color0000ff;
IF BARSTATUS=2 THEN DRAWTEXTREL(60+250 ,420-400*SCCK5 ,'5日' ),colorffffff;
IF BARSTATUS=2 THEN DRAWRECTREL(240 ,400,335 ,420 ,RGB(0,0,255) ),coloraa0000;
IF BARSTATUS=2 THEN DRAWRECTREL(0+250 ,1000-400*SCVK60,15+250 ,920 ,RGB(0,255,0) ),color00ff00;
IF BARSTATUS=2 THEN DRAWTEXTREL(0+250 ,920-400*SCVK60 ,'60日' ),colorffffff;
IF BARSTATUS=2 THEN DRAWRECTREL(30+250 ,1000-400*SCVK20,45+250 ,920 ,RGB(0,255,0) ),color00ff00;
IF BARSTATUS=2 THEN DRAWTEXTREL(30+250 ,920-400*SCVK20 ,'20日' ),colorffffff;
IF BARSTATUS=2 THEN DRAWRECTREL(60+250 ,1000-400*SCVK5,75+250 ,920 ,RGB(0,255,0) ),color00ff00;
IF BARSTATUS=2 THEN DRAWTEXTREL(60+250 ,920-400*SCVK5 ,'5日' ),colorffffff;
IF BARSTATUS=2 THEN DRAWRECTREL(240 ,900,335 ,920 ,RGB(0,0,255) ),colorff0000;
IF BARSTATUS=2 THEN DRAWRECTREL(355 ,0,356 ,999 ,RGB(255,255,255) ),colorred;{分割线}
IF BARSTATUS=2 THEN DRAWRECTREL(370 ,100,390 ,200 ,RGB(255,0,255) ),colorff00ff;
IF BARSTATUS=2 THEN DRAWTEXTREL(370 ,300 ,'股票' ),colorffffff;
IF BARSTATUS=2 THEN DRAWRECTREL(370 ,600,390 ,700 ,RGB(0,255,255) ),colorffff00;
IF BARSTATUS=2 THEN DRAWTEXTREL(370 ,800 ,'指数' ),colorffffff;
IF BARSTATUS=2 THEN DRAWRECTREL(420 ,700-ZSK5*600,435 ,700 ,RGB(255,0,255) ),colorff00ff;
IF BARSTATUS=2 THEN DRAWRECTREL(440 ,700-SZK5*600,455 ,700 ,RGB(0,255,255) ),colorffff00;
IF BARSTATUS=2 THEN DRAWTEXTREL(420 ,730 ,'5日' ),colorffffff;
IF BARSTATUS=2 THEN DRAWRECTREL(420+60 ,700-ZSK20*600,435+60 ,700 ,RGB(255,0,255) ),colorff00ff;
IF BARSTATUS=2 THEN DRAWRECTREL(440+60 ,700-SZK20*600,455+60 ,700 ,RGB(0,255,255) ),colorffff00;
IF BARSTATUS=2 THEN DRAWTEXTREL(420+60 ,730 ,'20日' ),colorffffff;
IF BARSTATUS=2 THEN DRAWRECTREL(420+120 ,700-ZSK60*600,435+120 ,700 ,RGB(255,0,255) ),colorff00ff;
IF BARSTATUS=2 THEN DRAWRECTREL(440+120 ,700-SZK60*600,455+120 ,700 ,RGB(0,255,255) ),colorffff00;
IF BARSTATUS=2 THEN DRAWTEXTREL(420+120 ,730 ,'60日' ),colorffffff;
IF BARSTATUS=2 THEN DRAWRECTREL(410 ,700,585 ,720 ,RGB(0,0,255) ),colorff0000;
IF BARSTATUS=2 THEN DRAWTEXTREL(440 ,850 ,'股票与大盘指数的涨幅对比' ),color00ffff;
IF BARSTATUS=2 THEN DRAWRECTREL(620 ,700-ZJK5*600,635 ,700 ,RGB(255,0,255) ),colorff00ff;
IF BARSTATUS=2 THEN DRAWRECTREL(640 ,700-JZK5*600,655 ,700 ,RGB(0,255,255) ),colorffff00;
IF BARSTATUS=2 THEN DRAWTEXTREL(620 ,730 ,'5日' ),colorffffff;
IF BARSTATUS=2 THEN DRAWRECTREL(620+60 ,700-ZJK20*600,635+60 ,700 ,RGB(255,0,255) ),colorff00ff;
IF BARSTATUS=2 THEN DRAWRECTREL(640+60 ,700-JZK20*600,655+60 ,700 ,RGB(0,255,255) ),colorffff00;
IF BARSTATUS=2 THEN DRAWTEXTREL(620+60 ,730 ,'20日' ),colorffffff;
IF BARSTATUS=2 THEN DRAWRECTREL(620+120 ,700-ZJK60*600,635+120 ,700 ,RGB(255,0,255) ),colorff00ff;
IF BARSTATUS=2 THEN DRAWRECTREL(640+120 ,700-JZK60*600,655+120 ,700 ,RGB(0,255,255) ),colorffff00;
IF BARSTATUS=2 THEN DRAWTEXTREL(620+120 ,730 ,'60日' ),colorffffff;
IF BARSTATUS=2 THEN DRAWRECTREL(610 ,700,785 ,720 ,RGB(0,0,255) ),colorff0000;
IF BARSTATUS=2 THEN DRAWTEXTREL(630 ,850 ,'股票与平均价格指数的涨幅对比' ),color00ffff;
IF BARSTATUS=2 THEN DRAWRECTREL(820 ,700-ZHK5*600,835 ,700 ,RGB(255,0,255) ),colorff00ff;
IF BARSTATUS=2 THEN DRAWRECTREL(840 ,700-HZK5*600,855 ,700 ,RGB(0,255,255) ),colorffff00;
IF BARSTATUS=2 THEN DRAWTEXTREL(820 ,730 ,'5日' ),colorffffff;
IF BARSTATUS=2 THEN DRAWRECTREL(820+60 ,700-ZHK20*600,835+60 ,700 ,RGB(255,0,255) ),colorff00ff;
IF BARSTATUS=2 THEN DRAWRECTREL(840+60 ,700-HZK20*600,855+60 ,700 ,RGB(0,255,255) ),colorffff00;
IF BARSTATUS=2 THEN DRAWTEXTREL(820+60 ,730 ,'20日' ),colorffffff;
IF BARSTATUS=2 THEN DRAWRECTREL(820+120 ,700-ZHK60*600,835+120 ,700 ,RGB(255,0,255) ),colorff00ff;
IF BARSTATUS=2 THEN DRAWRECTREL(840+120 ,700-HZK60*600,855+120 ,700 ,RGB(0,255,255) ),colorffff00;
IF BARSTATUS=2 THEN DRAWTEXTREL(820+120 ,730 ,'60日' ),colorffffff;
IF BARSTATUS=2 THEN DRAWRECTREL(810 ,700,985 ,720 ,RGB(0,0,255) ),colorff0000;
IF BARSTATUS=2 THEN DRAWTEXTREL(840 ,850 ,'股票与板块指数的涨幅对比' ),color00ffff;