通达信BS决策综合主图公式
{BS决策——(综和)主图}
DRAWGBK(O>C,RGB(360,0,10),RGB(10,0,1),0,'01',0);
CC:IF(CURRBARSCOUNT<18,CONST(REF(C,1)),DRAWNULL),COLOR000000;
止赢:1.05*CC,COLOR8000FF;
止损:0.97*CC,COLOR00F000;
V1:=ABS((2*CLOSE+HIGH+LOW)/4-MA(CLOSE,20))/MA(CLOSE,20);
V2:=(1-7/100)*(DMA(CLOSE,V1));
V3:=(1+7/100)*(DMA(CLOSE,V1));
V5:=MA((LOW+HIGH+CLOSE)/3,5);
支撑1:REFDATE(V2,DATE),DOTLINE,LINETHICK1,COLORFF0080;
阻力1:REFDATE(V3,DATE),DOTLINE,LINETHICK1,COLOR676767;
AAA:=CONST(HHV(H*0.5,90));
AA:=(REF(CLOSE,1)+REF(CLOSE,2)+OPEN)/3;
DRAWTEXT_FIX(CURRBARSCOUNT=1,0.8,0.05,1,'今日保护价'),LINETHICK2,COLOR00FFFF;
DRAWNUMBER_FIX(CURRBARSCOUNT=1,0.84,0.05,1,AA);
DRAWTEXT_FIX(CURRBARSCOUNT=1,0.86,0.05,1,'元');
VAR1:=(100 - ((90 * (HHV(HIGH,14) - CLOSE)) / (HHV(HIGH,14) - LLV(LOW,14))));
VAR2:=(100 - ((90 * (HHV(HIGH,14) - CLOSE)) / (HHV(HIGH,14) - LLV(LOW,14))));
VAR3:=(100 - MA(((100 * (HHV(HIGH,6) - CLOSE)) / (HHV(HIGH,6) - LLV(LOW,6))),34));
DIR1:=ABS(CLOSE-REF(CLOSE,5));
VIR1:=SUM(ABS(CLOSE-REF(CLOSE,1)),5);
ER1:=DIR1/VIR1;
CS1:=ER1*(0.8-2/8)+2/8;
CQ1:=CS1*CS1;
DIR2:=ABS(CLOSE-REF(CLOSE,10));
VIR2:=SUM(ABS(CLOSE-REF(CLOSE,1)),10);
ER2:=DIR2/VIR2;
CS2:=ER2*(0.8-2/24)+2/24;
CQ2:=CS2*CS2;
STICKLINE(VAR2 < MA(VAR3,6),LOW,HIGH,0,1),COLORLIBLUE;
STICKLINE(VAR2 > MA(VAR3,6),LOW,HIGH,0,1),COLORRED;
STICKLINE(((OPEN>CLOSE)AND(VAR2<MA(VAR3,6))),(CLOSE-0.03),OPEN,3.05,0),COLORLIBLUE;
STICKLINE(((OPEN<CLOSE)AND(VAR2<MA(VAR3,6))),CLOSE,OPEN,3.05,1),COLORLIBLUE;
STICKLINE(((OPEN>CLOSE)AND(VAR2>MA(VAR3,6))),OPEN,(CLOSE-0.03),3.05,0),COLORRED;
STICKLINE(((OPEN<CLOSE)AND(VAR2>MA(VAR3,6))),OPEN,CLOSE,3.05,1),COLORRED;
DRAWICON(CROSS(VAR2,MA(VAR3,6)),(LOW - (LOW*0.01)),23);
DRAWICON(CROSS(MA(VAR3,6),VAR1),(HIGH+(HIGH*0.01)),15);
PT:=REF(H,1)-REF(L,1);
CDP:=(REF(H,1)+REF(L,1)+REF(C,1)*2)/4;
AH:=CDP+PT;
AL:=CDP-PT;
NH:=CDP*2-REF(L,1);
NL:=CDP*2-REF(H,1);
强:IF(AH>REF(C,1)*1.1,REF(C,1)*1.1,AH)NODRAW;
阻:IF(NH>强,(强-CDP)*0.618+CDP,NH)NODRAW,COLORBLUE;
M:=IF(AL<REF(C,1)/1.1,REF(C,1)/1.1,AL);
撑:IF(NL<M,CDP-(CDP-M)*0.618,NL)NODRAW;
底:IF(AL<REF(C,1)/1.1,REF(C,1)/1.1,AL)NODRAW;
{股本市值}
总股本:=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(' 上市日期: ',CON2STR(HHV((BARSCOUNT(C)=0)*(DATE+19000000),0),0));}
股本市值:=STRCAT('股本市值: ',STRCAT(STRCAT(STRCAT(STRCAT(总股本,流通盘),全流通),市值),上市天数));
{业绩综合}
市盈率:=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('当前业绩: ',STRCAT(STRCAT(STRCAT(STRCAT(STRCAT(STRCAT(市盈率,市销率),市净率),净资收益率),毛利率),净利润率),主营利润率));
{风险系数}
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.00,0.12,0,股本市值),COLORGREEN;
DRAWTEXT_FIX(ISLASTBAR,0.00,0.18,0,当前业绩),COLORGREEN;
DRAWTEXT_FIX(ISLASTBAR,0.00,0.24,0,财务系数),COLORGREEN;
DRAWTEXT_FIX(1,0.18,0,0,'主营业务:')COLOR0080FF;
DRAWTEXT_FIX(1,0.25,0,0,EXTERNSTR(0,2))COLOR0080FF;
DRAWTEXT_FIX(1,0.00,0,0,'所属地区:')COLOR00FFFF;
DRAWTEXT_FIX(1,0.07,0,0,DYBLOCK)COLOR00FFFF;
DRAWTEXT_FIX(1,0.00,0.06,0,'所属行业:')COLORFF00FF;
DRAWTEXT_FIX(1,0.07,0.06,0,HYBLOCK)COLORFF00FF;
DRAWTEXT_FIX(1,0.18,0.06,0,'主题投资:')COLOR0000FF;
DRAWTEXT_FIX(1,0.25,0.06,0,EXTERNSTR(0,1))COLOR0000FF;
{融胜通道}
MA3:MA(CLOSE,3),COLOR9000F5,LINETHICK2;
MA18:MA(CLOSE,18),COLOR004284,LINETHICK2;
M10:=EMA(C,10);
融胜:=M10,COLORRED,LINETHICK1;
FF:=ABS((2*CLOSE+HIGH+LOW)/4-MA(CLOSE,20))/MA(CLOSE,20);
DD:=DMA(CLOSE,FF);
高抛:(1+14/100)*DD,DOTLINE,COLORGREEN;
压力:(1+7/100)*DD,DOTLINE,COLORFFFF00;
支撑:(1-7/100)*DD,DOTLINE,COLORBLUE;
低吸:(1-14/100)*DD,DOTLINE,COLOR4080FF;
中轨:(压力+支撑)/2,DOTLINE,COLORMAGENTA;
DRAWTEXT(CURRBARSCOUNT=1,高抛,'高抛'),COLOR00FFFF;
DRAWTEXT(CURRBARSCOUNT=1,压力,'压力'),COLOR00FFFF;
DRAWTEXT(CURRBARSCOUNT=1,中轨,'中轨'),COLOR00FFFF;
DRAWTEXT(CURRBARSCOUNT=1,支撑,'支撑'),COLOR00FFFF;
DRAWTEXT(CURRBARSCOUNT=1,低吸,'低吸'),COLOR00FFFF;
IF(MA3>=REF(MA3,1) AND MA3>支撑,MA3,DRAWNULL),COLOR00F7F7,LINETHICK4;
{黄金分割}
T:=150;TT:=3;N1:=0;
高1:=REF(HHV(H,T),TT);
低1:=REF(LLV(L,T),TT);
H1:=高1-(高1-低1)*0.191;
H2:=高1-(高1-低1)*0.382;
H3:=高1-(高1-低1)*0.5;
H4:=高1-(高1-低1)*0.618;
H5:=高1-(高1-低1)*0.809;
高:REFDATE(高1,DATE),DOTLINE,COLORRED;
一:REFDATE(H1,DATE),DOTLINE,COLORLIGRAY;
二:REFDATE(H2,DATE),DOTLINE,COLORLIGRAY;
三:REFDATE(H3,DATE),DOTLINE,COLORBROWN;
四:REFDATE(H4,DATE),DOTLINE,COLORLIGRAY;
五:REFDATE(H5,DATE),DOTLINE,COLORLIGRAY;
低:REFDATE(低1,DATE),DOTLINE,COLORGREEN;
TT3:=(CURRBARSCOUNT=5);
TT4:=(CURRBARSCOUNT=5+3);
DRAWNUMBER(TT3 AND 高,高,高),COLORYELLOW;
DRAWTEXT(TT4 AND 高,高*1.01,'顶'),COLORMAGENTA;
DRAWNUMBER(TT3 AND 一,一,一),COLORYELLOW;
DRAWTEXT(TT4 AND 一,一*1.01,'0.191'),COLORRED;
DRAWNUMBER(TT3 AND 二,二,二),COLORYELLOW;
DRAWTEXT(TT4 AND 二,二*1.01,'0.382'),COLORRED;
DRAWNUMBER(TT3 AND 三,三,三),COLORYELLOW;
DRAWTEXT(TT4 AND 三,三*1.01,'中'),COLORMAGENTA;
DRAWNUMBER(TT3 AND 四,四,四),COLORYELLOW;
DRAWTEXT(TT4 AND 四,四*1.01,'0.618'),COLORRED;
DRAWNUMBER(TT3 AND 五,五,五),COLORYELLOW;
DRAWTEXT(TT4 AND 五,五*1.01,'0.809'),COLORRED;
DRAWNUMBER(TT3 AND 低,低,低),COLORYELLOW;
DRAWTEXT(TT4 AND 低,低*1.01,'底'),COLORMAGENTA;
VR2:=(2*CLOSE+HIGH+LOW)/4;
VR3:=IF(YEAR>=2099 AND MONTH>2,0,1);
VR4:=LLV(LOW,5);
VR5:=HHV(HIGH,4);
散户:=EMA((VR2-VR4)/(VR5-VR4)*100,4)*VR3;
庄家:=EMA(0.667*REF(散户,1)+0.333*散户,2)*VR3;
LC:=REF(CLOSE,1);
RSI:=SMA(MAX(CLOSE-LC,0),6,1)/SMA(ABS(CLOSE-LC),6,1)*100;
DRAWTEXT(CROSS(84,RSI) , HIGH,'←-----逃'),COLORGREEN;
VAR3AA:=IF((CLOSE>REF(CLOSE,1)),88,0);
VAR4AA:=IF(((CLOSE)/(REF(CLOSE,1))>1.05) AND ((HIGH)/(CLOSE)<1.01) AND (VAR3AA>0),91,0);
DRAWTEXT(FILTER((VAR4AA>90),45),(LOW)*(0.93),'←---大胆搏 '),COLORYELLOW;
VAR51:=3;
VAR52:=(3)*(SMA(((CLOSE - LLV(LOW,27))/(HHV(HIGH,27) - LLV(LOW,27)))*(100),5,1)) - (2)*(SMA(SMA(((CLOSE - LLV(LOW,27))/(HHV(HIGH,27) - LLV(LOW,27)))*(100),5,1),3,1));
DRAWTEXT(CROSS(VAR52,VAR51), LOW,'←启动')COLORMAGENTA;
日:=150;昨前:=3;
高2:=REF(HHV(H,日),昨前);
顶:REFDATE(高2,DATE),COLORBLACK;
绝顶:=REFDATE(顶,DATE),NODRAW;
跑:=绝顶=H AND ((C-L)<(O-C) OR (O-L)<(C-O)),NODRAW;
STICKLINE(跑,C,O,3,0),COLOR777777;
STICKLINE(跑,C,O,2,0),COLORAAAAAA;
STICKLINE(跑,C,O,1,0),COLORCCCCCC;
STICKLINE(跑,C,O,0.1,0),COLORFFFFFF;
STICKLINE(跑,L,H,0,0),COLORFFFFFF;
DRAWTEXT(跑,C*1.06,'绝顶')COLORFFFFFF;