以下是通达信北沙月周日框B指标公式(无源码的请下载附件导入)
{月金叉红柱}
DRAWGBK(CURRBARSCOUNT=1, RGB(110,108,108),RGB(88,30,0),0,'',0);
DRAWTEXT_FIX(1,0.88,5,0,'财神805优化作品'),COLORRED;
均价:=AMOUNT/V/100;
ZT:=REF(C,1)*1.1-C<0.01 AND H=C;{涨停}
BA:STICKLINE(ZT,OPEN,CLOSE,0.1,0),COLORYELLOW;
N:=30;{此数值可视需要调整}
BL:=V=HHV(V,N) AND V>REF(V,1)*2;
XGA:=ZT AND BL;
TSS:=BARSLAST(XGA);
NOTEXTEE:IF(TSS<=9,DRAWLINE(XGA,均价,REF(XGA,1),REF(均价,1),1),DRAWNULL),COLORYELLOW;
DRAWNUMBER(ISLASTBAR,NOTEXTEE,NOTEXTEE),COLORYELLOW;
NOTEXT2:IF(TSS<=9,REF(C,TSS),DRAWNULL),COLORGRAY;
NOTEXT3:IF(TSS<=9,REF(L,TSS),DRAWNULL),COLORGRAY;
ED:DRAWNUMBER(BETWEEN(TSS,1,9),REF(L,TSS),TSS),COLORLIGRAY;
MA5:MA(C,5),COLORWHITE,LINETHICK1;
IF(MA5>REF(MA5,1),MA5,DRAWNULL),COLORRED,LINETHICK2;
IF(MA5<REF(MA5,1),MA5,DRAWNULL),COLORGREEN,LINETHICK2;
MA13:MA(CLOSE,13),COLORYELLOW;
MA21:MA(CLOSE,21),COLORMAGENTA;
MA34:=MA(CLOSE,34);
MA60:MA(CLOSE,60),COLORGREEN;
MA120:MA(CLOSE,120),COLORBLUE;
N8:=60;
M8:=5;
BC:=(IF(C>(H+L+C)/3,(H*0.618+L*0.382)*0.382,(H*0.382+L*0.618)*0.382)+(O*0.382+C*0.618)*0.618);
市价:=AMOUNT/(VOL*100);
MX:=IF(INDEXC=C,BC,市价);
EM6:EMA(BC,M8),COLORWHITE;
箱顶:REF(HHV(EMA(BC,M8),(N8-(N8/10+3))),1),LINETHICK2,COLORFF0080;
箱底:REF(LLV(EMA(BC,M8),(N8-(N8/10+3))),1),LINETHICK2,COLORCYAN;
MA3:MA(CLOSE,3),LINETHICK2;
N01:=10;
T01:=CONST(HHVBARS(V,10)),COLOR0000FF,LINETHICK1;
量能平台:IF(CURRBARSCOUNT<=N01+15,CONST(IF(T01=0,C,REF(C,T01))),DRAWNULL)
,COLORLIBLUE,LINETHICK4;
新量能点:IF(CURRBARSCOUNT=T01+1,量能平台,DRAWNULL),CIRCLEDOT,COLORFFFFFF,LINETHICK9;
DRAWTEXT(ISLASTBAR,量能平台,' 量能平台'),COLOR00F0F0;
HV:=HHV(V,5)=V OR V/REF(V,1)>=5;
FT:=BARSLAST(HV);
量能平台1:=IF(HV,C,REF(C,FT));
DRAWTEXT(量能平台1>REF(量能平台1,1)AND C<REF(C,1),L,'*带量跌'),COLORGREEN;
DRAWTEXT(量能平台1<REF(量能平台1,1) AND C>REF(C,1),L,'*缩量涨'),COLORYELLOW;
DRAWTEXT(量能平台1>REF(量能平台1,1) AND C>REF(C,1) AND C>MA(C,13) AND C=HHV(C,20) AND C/REF(C,1)>1.05,L,'*突破量'),COLORFFFFFF;
JC:="MACD.MACD#MONTH"<0;
TS:=BARSLAST(JC),NODRAW;
起点:=FILTERX(TS=1,BARSSINCE(C));
终点:=FILTERX(TS>=1 AND REFX(TS,1)=0,BARSSINCE(C));
天数:=BARSLAST(起点);
红柱最高价:IF(天数>=0 AND REFX(TS>=1,BARSNEXT(ISLASTBAR)),CONST(HHV(H,TS)),DRAWNULL),COLORYELLOW;
红柱最低价:IF(天数>=0 AND REFX(TS>=1,BARSNEXT(ISLASTBAR)),CONST(LLV(L,TS)),DRAWNULL),COLORYELLOW;
STICKLINE(起点,红柱最高价,红柱最低价,0,-1),COLORYELLOW;
STICKLINE(ISLASTBAR,红柱最高价,红柱最低价,0,-1),COLORYELLOW;
DRAWBAND(红柱最高价,RGB(100,70,50),红柱最低价,RGB(0,100,100));
{月死叉绿柱}
SC:="MACD.MACD#MONTH">0;
TS1:=BARSLAST(SC),NODRAW;
起点1:=FILTERX(TS1=1,BARSSINCE(C));
终点1:=FILTERX(TS1>=1 AND REFX(TS1,1)=0,BARSSINCE(C));
天数1:=BARSLAST(起点1);
绿柱最高价:IF(天数1>=0 AND REFX(TS1>=1,BARSNEXT(ISLASTBAR)),CONST(HHV(H,TS1)),DRAWNULL),COLORLIBLUE;
绿柱最低价:IF(天数1>=0 AND REFX(TS1>=1,BARSNEXT(ISLASTBAR)),CONST(LLV(L,TS1)),DRAWNULL),COLORLIBLUE;
STICKLINE(起点1,绿柱最高价,绿柱最低价,0,-1),COLORLIBLUE;
STICKLINE(ISLASTBAR,绿柱最高价,绿柱最低价,0,-1),COLORLIBLUE;
DRAWBAND(绿柱最高价,RGB(0,100,100),绿柱最低价,RGB(120,80,0));
{周金叉红柱}
ZJC:="MACD.MACD#WEEK"<0;
ZTS:=BARSLAST(ZJC),NODRAW;
Z起点:=FILTERX(ZTS=1,BARSSINCE(C));
Z终点:=FILTERX(ZTS>=1 AND REFX(ZTS,1)=0,BARSSINCE(C));
Z天数:=BARSLAST(Z起点);
Z红柱最高价:IF(Z天数>=0 AND REFX(ZTS>=1,BARSNEXT(ISLASTBAR)),CONST(HHV(H,ZTS)),DRAWNULL),COLORMAGENTA;
Z红柱最低价:IF(Z天数>=0 AND REFX(ZTS>=1,BARSNEXT(ISLASTBAR)),CONST(LLV(L,ZTS)),DRAWNULL),COLORMAGENTA;
STICKLINE(Z起点,Z红柱最高价,Z红柱最低价,0,-1),COLORMAGENTA;
STICKLINE(ISLASTBAR,Z红柱最高价,Z红柱最低价,0,-1),COLORMAGENTA;
DRAWBAND(Z红柱最高价,RGB(100,0,100),Z红柱最低价,RGB(50,150,200));
{周死叉绿柱}
ZSC:="MACD.MACD#WEEK">0;
ZTS1:=BARSLAST(ZSC),NODRAW;
Z起点1:=FILTERX(ZTS1=1,BARSSINCE(C));
Z终点1:=FILTERX(ZTS1>=1 AND REFX(ZTS1,1)=0,BARSSINCE(C));
Z天数1:=BARSLAST(Z起点1);
Z绿柱最高价:IF(Z天数1>=0 AND REFX(ZTS1>=1,BARSNEXT(ISLASTBAR)),CONST(HHV(H,ZTS1)),DRAWNULL),COLORGREEN;
Z绿柱最低价:IF(Z天数1>=0 AND REFX(ZTS1>=1,BARSNEXT(ISLASTBAR)),CONST(LLV(L,ZTS1)),DRAWNULL),COLORGREEN;
STICKLINE(Z起点1,Z绿柱最高价,Z绿柱最低价,0,-1),COLORGREEN;
STICKLINE(ISLASTBAR,Z绿柱最高价,Z绿柱最低价,0,-1),COLORGREEN;
DRAWBAND(Z绿柱最高价,RGB(50,150,200),Z绿柱最低价,RGB(100,0,100));
{日金叉红柱}
RJC:="MACD.MACD#DAY"<0;
RTS:=BARSLAST(RJC),NODRAW;
R起点:=FILTERX(RTS=1,BARSSINCE(C));
R终点:=FILTERX(RTS>=1 AND REFX(RTS,1)=0,BARSSINCE(C));
R天数:=BARSLAST(R起点);
R红柱最高价:IF(R天数>=0 AND REFX(RTS>=1,BARSNEXT(ISLASTBAR)),CONST(HHV(H,RTS)),DRAWNULL),COLORMAGENTA;
R红柱最低价:IF(R天数>=0 AND REFX(RTS>=1,BARSNEXT(ISLASTBAR)),CONST(LLV(L,RTS)),DRAWNULL),COLORMAGENTA;
STICKLINE(R起点,R红柱最高价,R红柱最低价,0,-1),COLORMAGENTA;
STICKLINE(ISLASTBAR,R红柱最高价,R红柱最低价,0,-1),COLORMAGENTA;
DRAWBAND(R红柱最高价,RGB(220,120,120),R红柱最低价,RGB(80,80,80));
{日死叉绿柱}
RSC:="MACD.MACD#DAY">0;
RTS1:=BARSLAST(RSC),NODRAW;
R起点1:=FILTERX(RTS1=1,BARSSINCE(C));
R终点1:=FILTERX(RTS1>=1 AND REFX(RTS1,1)=0,BARSSINCE(C));
R天数1:=BARSLAST(R起点1);
R绿柱最高价:IF(R天数1>=0 AND REFX(RTS1>=1,BARSNEXT(ISLASTBAR)),CONST(HHV(H,RTS1)),DRAWNULL),COLORGREEN;
R绿柱最低价:IF(R天数1>=0 AND REFX(RTS1>=1,BARSNEXT(ISLASTBAR)),CONST(LLV(L,RTS1)),DRAWNULL),COLORGREEN;
STICKLINE(R起点1,R绿柱最高价,R绿柱最低价,0,-1),COLORGREEN;
STICKLINE(ISLASTBAR,R绿柱最高价,R绿柱最低价,0,-1),COLORGREEN;
DRAWBAND(R绿柱最高价,RGB(80,80,80),R绿柱最低价,RGB(220,120,120));
DRAWKLINE(H,O,L,C);
DRAWTEXT_FIX(1,0.02,0.90,0,'财神805-正品标志'),COLOR00FFFF,LINETHICK2;
DRAWTEXT_FIX(C>0,0.00,0.10,0,STRCAT('主题投资:',EXTERNSTR(0,7))),COLORRED;
DRAWTEXT_FIX(ISLASTBAR,0.65,0.8,0,HYBLOCK),COLOR00FF00;
DRAWTEXT_FIX(ISLASTBAR,0.75,0.8,0,DYBLOCK),COLOR00FFFF;
DRAWTEXT_FIX(ISLASTBAR,0.65,0.9,0,GNBLOCK),COLORYELLOW;
{以上为显示所属板块,地域,概念等};
总股本:=STRCAT(STRCAT('总股本: ',CON2STR(TOTALCAPITAL/1000000,2)),'亿');
流通盘:=STRCAT(STRCAT(' 流通盘: ',CON2STR(CAPITAL/1000000,2)),'亿');
全流通:=STRCAT(' 全流通: ',CON2STR((CAPITAL/1000000)/(TOTALCAPITAL/1000000),2));
市值:=STRCAT(STRCAT(' 流通市值: ',CON2STR((CAPITAL/1000000)*C,2)),'亿');
上市日期:=STRCAT(' 上市天数: ',CON2STR(FINANCE(42),0));
股本市值:=STRCAT('股本市值: ',STRCAT(STRCAT(STRCAT(STRCAT(总股本,流通盘),全流通),市值),上市日期));
8066385.png
|