{0. 将MACD指标搬上主图显示}
DRAWGBK(C>0,RGB(0,50,9),RGB(0,0,0),0,'0',0);
STICKLINE(C>=O,C,O,3,0),COLOR000045;
STICKLINE(C>=O,C,O,2.5,0),COLOR000065;
STICKLINE(C>=O,C,O,2,0),COLOR000085;
STICKLINE(C>=O,C,O,1.5,0),COLOR0000A5;
STICKLINE(C>=O,C,O,1,0),COLOR0000C5;
STICKLINE(C>=O,C,O,0.5,0),COLOR0000E5;
STICKLINE(C>=O,H,L,0,0),COLOR0000F5;
STICKLINE(C<O,C,O,3,0),COLOR353500;
STICKLINE(C<O,C,O,2.5,0),COLOR454500;
STICKLINE(C<O,C,O,2,0),COLOR555500;
STICKLINE(C<O,C,O,1.5,0),COLOR656500;
STICKLINE(C<O,C,O,1,0),COLOR757500;
STICKLINE(C<O,C,O,0.5,0),COLOR858500;
STICKLINE(C<O,H,L,0,0),COLOR959500;
DDIF:EMA(CLOSE,12)-EMA(CLOSE,26),NODRAW;
DDEA:EMA(DDIF,9),NODRAW;
DMACD:(DDIF-DDEA)*2,NODRAW;
上市天数:=BARSCOUNT(C); N:=IF(上市天数<90,上市天数-1,90);
基点:=CONST(LLV(L,N)); 基:=CONST(HHV(H,N))-基点;
分:=CONST(LLV(DDIF,N)); 百:=CONST(HHV(DDIF,N))-分;
CC比:=(DDIF-分)/百; XCX:=CC比*基+基点;
DIF:=XCX; NOTEXTDDIF:DIF,COLORWHITE;
DEA:=EMA(DIF,9); NOTEXTDDEA:DEA,COLORYELLOW;
基准零线:=(0-分)/百*基+基点; NOTEXT基准零线:基准零线,POINTDOT,COLORLIRED;
MACD:=(DIF-DEA)*2;
STICKLINE(MACD>=0,基准零线,基准零线+MACD,0,0),COLORLIRED;
STICKLINE(MACD<0,基准零线,基准零线+MACD,0,0),COLORLICYAN;
{1. MACD结构量化指标:}
A1:=BARSLAST(REF(CROSS(DIF,DEA),1));
底部结构:=REF(C,A1+1)>C AND DIF>REF(DIF,A1+1) AND CROSS(DIF,DEA);
DRAWLINE(A1=0,REF(DEA,1),底部结构,REF(DEA,A1+1),0),COLORMAGENTA,LINETHICK1;
STICKLINE(底部结构,DEA,REF(DEA,A1+1),0,0),COLORMAGENTA,LINETHICK1;
DRAWTEXT(底部结构>0,REF(DEA,A1+1),'底背离'),COLORMAGENTA;
A2:=BARSLAST(REF(CROSS(DEA,DIF),1));
顶部结构:=REF(C,A2+1)<C AND REF(DIF,A2+1)>DIF AND CROSS(DEA,DIF);
DRAWLINE(A2=0,REF(DEA,1),顶部结构,REF(DEA,A2+1),0),COLORGREEN,LINETHICK1;
STICKLINE(顶部结构,DEA,REF(DEA,A2+1),0,0),COLORGREEN,LINETHICK1;
DRAWTEXT(顶部结构>0,REF(DEA,A2+1),'顶背离'),COLORGREEN;
{财务信息}
市盈率1:=DYNAINFO(39);
{净资收益率:=(FINANCE(33)/FINANCE(34)*100);}
营业收入:=FINANCE(20)/10000;
销售毛利率:=((FINANCE(20)-FINANCE(21))/FINANCE(20)*100);
净利润:=FINANCE(30)/10000;
净利润比率:=(FINANCE(30)/FINANCE(20)*100);
主营利润率1:=(FINANCE(23)/FINANCE(20)*100);
优质资产率:=((FINANCE(19)-FINANCE(22)-FINANCE(27))/FINANCE(19));{理论上越大越好但不同行业有不同标准};
现金负债比:=(FINANCE(25)/FINANCE(15));{缺长期负债或负债总额,理论上越大越好但不同行业有不同标准};
净利同增率:=FINANCE(43);
DRAWTEXT_FIX(1,0.42,0.10,1,'市盈率:'),COLORYELLOW;
DRAWTEXT_FIX(1,0.42,0.15,1,'收入 万元:'),COLORYELLOW;
DRAWTEXT_FIX(1,0.42,0.20,1,'销售毛利率:'),COLORYELLOW;
DRAWTEXT_FIX(1,0.42,0.25,1,'净利 万元:'),COLORYELLOW;
DRAWTEXT_FIX(1,0.42,0.30,1,'净利润率 :'),COLORYELLOW;
DRAWTEXT_FIX(1,0.42,0.35,1,'主营利润率:'),COLORYELLOW;
DRAWTEXT_FIX(1,0.42,0.40,1,'优质资产率:'),COLORYELLOW;
DRAWTEXT_FIX(1,0.42,0.45,1,'现金负债比:'),COLORYELLOW;
{DRAWTEXT_FIX(1,0.42,0.75,1,'净利同增率:'),COLORYELLOW;}
DRAWNUMBER_FIX(1,0.47,0.10,1,市盈率1),COLORWHITE;
DRAWNUMBER_FIX(1,0.47,0.15,1,营业收入),COLORWHITE;
DRAWNUMBER_FIX(1,0.47,0.20,1,销售毛利率),COLORWHITE;
DRAWNUMBER_FIX(1,0.47,0.25,1,净利润),COLORWHITE;
DRAWNUMBER_FIX(1,0.47,0.30,1,净利润比率),COLORWHITE;
DRAWNUMBER_FIX(1,0.47,0.35,1,主营利润率1),COLORWHITE;
DRAWNUMBER_FIX(1,0.47,0.40,1,优质资产率),COLORWHITE;
DRAWNUMBER_FIX(1,0.47,0.45,1,现金负债比),COLORWHITE;
{DRAWNUMBER_FIX(1,0.47,0.75,1,净利同增率),COLORWHITE;}
{DRAWTEXT_FIX(1,0.498,0.01,1,'财务指标:'),COLORRED;}
市净率:=CONST(DYNAINFO(7) / FINANCE(34));
{市销率:=CONST(FINANCE(1)*DYNAINFO(7)/FINANCE(20));}
营收同比增:=FINANCE(44);
每股净资产:=FINANCE(34);
每股收益季:=CONST(FINANCE(33)/(5-FINANCE(37)));
{每股收益年:=CONST(FINANCE(33));}
每股现金流:=CONST((FINANCE(25)/FINANCE(1)));
每股未分配:=CONST(FINANCE(32));
每股公积金:=CONST(FINANCE(18));
DRAWTEXT_FIX(1,0.54,0.10,1,'市净率 :'),COLORYELLOW;
DRAWTEXT_FIX(1,0.54,0.15,1,'收入同比增 :'),COLORYELLOW;
DRAWTEXT_FIX(1,0.54,0.20,1,'每股净资产:'),COLORYELLOW;
DRAWTEXT_FIX(1,0.54,0.25,1,'净利同比增:'),COLORYELLOW;
DRAWTEXT_FIX(1,0.54,0.30,1,'每股收益季:'),COLORYELLOW;
{DRAWTEXT_FIX(1,0.54,0.45,1,'每股收益年:'),COLORYELLOW;}
DRAWTEXT_FIX(1,0.54,0.35,1,'每股现金流:'),COLORYELLOW;
DRAWTEXT_FIX(1,0.54,0.40,1,'每股未分配:'),COLORYELLOW;
DRAWTEXT_FIX(1,0.54,0.45,1,'每股公积金:'),COLORYELLOW;
DRAWNUMBER_FIX(1,0.57,0.10,1,市净率),COLORWHITE;
DRAWNUMBER_FIX(1,0.57,0.15,1,营收同比增),COLORWHITE;
DRAWNUMBER_FIX(1,0.57,0.20,1,每股净资产),COLORWHITE;
DRAWNUMBER_FIX(1,0.57,0.25,1,净利同增率),COLORWHITE;
DRAWNUMBER_FIX(1,0.57,0.30,1,每股收益季),COLORWHITE;
{DRAWNUMBER_FIX(1,0.57,0.45,1,每股收益年),COLORWHITE;}
DRAWNUMBER_FIX(1,0.57,0.35,1,每股现金流),COLORWHITE;
DRAWNUMBER_FIX(1,0.57,0.40,1,每股未分配),COLORWHITE;
DRAWNUMBER_FIX(1,0.57,0.45,1,每股公积金),COLORWHITE;
CONST(C),COLORCYAN,DOTLINE;
{DRAWTEXT_FIX(ISLASTBAR,0.8,0.05,1,STRCAT(STRCAT('流通盘: ',CON2STR(流通市值,2)),'亿 总市值:'), STRCAT(STRCAT(DYBLOCK,' '),GNBLOCK))),COLORGREEN;};