F10公式—《盈利能力指标》(Wind、鹏搏)
{销shou毛利率-适用于Wind、鹏搏}
INPUT:N(2,1,3);
//确定F10种类
F10:=IF(F10FIND('Wind资讯就是',1)>0,2,IF(F10FIND('鹏搏资讯',1)>0,3,0));
DRAWTEXT(SYSPARAM(2)+20=BARPOS AND F10=0,15,'本公式不适合该种F10资料。'),COLOREEFF;
IF F10=0 THEN EXIT;
//设定最新指标名称
指标名称:=IF(N=1,'净资产收益率',IF(N=2,'主营业务利润率','销shou毛利率'));
WA:=IF(F10=2,F10FIND('最新简况→',10),F10FIND('财务指标-盈利能力',10));
//Wind临时
JA:=F10FIND('【3:利润构成与盈利能力】',WA+200);
VARIABLE:SJ[8]='str',SY[8]='str';
IF WA<0 then EXIT;
LTZ:=IF(F10=3,74,70);
SJT:=F10TEXT(F10FIND(IF(F10=3,'指标名称','★最新财务指标★'),WA),70);
SJJ:=STRRIGHT(SJT,69-STRFIND(SJT,IF(F10=2,'|','│'),1)+2);
SYT:=F10TEXT(F10FIND(指标名称,WA),LTZ);
SYT:=STRRIGHT(SYT,LTZ-1-STRFIND(SYT,IF(F10=2,'|','│'),1)+2);
//DRAWTEXT(SYSPARAM(2)+20=BARPOS,25,Syt);//调试用语句
FOR j=1 TO 4 DO BEGIN
SJ[j]:=STRMID(SJJ,IF(F10=3,14*(j-1)+5,12*(j-1)+IF(j<4,5,4)),8);
SY[j]:=LTRIM(STRMID(SYT,IF(F10=3,14*(j-1)+7,IF(F10=2,12*(j-1)+3,10*(j-1))),8));
END;
//DRAWTEXT(SYSPARAM(2)+20=BARPOS,15,SJ[1]);//调试用语句
DRAWTEXT(SYSPARAM(2)=BARPOS,0,'《'+指标名称+'》'+' \n \n最新日期:'+SJ[1]),ALIGN4,COLOREEFF;
TMP:=IF(STRCMP(STRMID(SJ[1],4,2),'12')=0,0,1);
WT:=IF(STRLEN(RTRIM(SJ[4]))>4,1,0);
XSL:=IF(DATACOUNT<60,1,5);
KG:=' ';
SJT1:=LTRIM(F10TEXT(IF(F10=2,F10FIND('财务指标(单位)',JA)+14,F10FIND('指标名称',WA+700)+12),56));
SYT1:=F10TEXT(F10FIND(指标名称, IF(F10=2,JA+100,WA+700))+18,56);
//DRAWTEXT(SYSPARAM(2)+20=BARPOS,15,SYT1);//调试用语句
FOR j=5 TO 8 DO BEGIN
SJ[j]:=STRMID(SJT1,IF(F10=3,14*(j-5)+5,IF(F10=2,12*(j-5)+5,3)),8);
SY[j]:=LTRIM(STRMID(SYT1,IF(F10=3,14*(j-5)+5,IF(F10=2,12*(j-5)+5,3)),8));
END;
最新:STRTONUM(IF(TMP=1 AND F10=2 AND N=3,SY[5],SY[1])),PRECISION4,COLORFFFFFF,LINETHICK;
IF TMP=1 AND F10=2 THEN BEGIN
SJ[5]:=SJ[6]; SJ[6]:=SJ[7]; SJ[7]:=SJ[8]; //SJ[8]:=SJA[5];
SY[5]:=SY[6]; SY[6]:=SY[7]; SY[7]:=SY[8];// SY[8]:=SYA[5];
END;
IF NOT(F10=2 AND N=3) THEN BEGIN
二期:STRTONUM(SY[2]),PRECISION4,COLORFFFF,LINETHICK;
三期:STRTONUM(SY[3]),PRECISION4,COLORFF00FF,LINETHICK;
四期:STRTONUM(SY[4]),PRECISION4,COLORFF00,LINETHICK;
增长2:(最新/二期-1)*100,COLORFFFF00,LINETHICK;
END;
去年:STRTONUM(SY[5]),PRECISION4,COLOREEEEEE,LINETHICK;
前年:STRTONUM(SY[6]),PRECISION4,COLOREEEE,LINETHICK;
前二:STRTONUM(SY[7]),PRECISION4,COLOREE00EE,LINETHICK;
前三:STRTONUM(SY[8]),PRECISION4,COLOREE00,LINETHICK;
//倍增选:((一期/二期-1)*100>50 and 二期>=0.1)or((一期/STRTONUM(SY[5])-1)*100>=50 and STRTONUM(SY[5])>=0.1),LINETHICK;
EXPLAIN(1,'**'+指标名称-'(%)'+'**'),coloryellow;
IF NOT(F10=2 AND N=3) THEN BEGIN
EXPLAIN(1,'***近期***\n'+SJ[1]+':'+NUMTOSTR(STRTONUM(SY[1]),4)+STRRIGHT(' '+NUMTOSTR((最新/二期-1)*100,2)+'%',10)),colorcyan;
EXPLAIN(1,SJ[2]+':'+NUMTOSTR(STRTONUM(SY[2]),4)+STRRIGHT(' '+NUMTOSTR((二期/三期-1)*100,2)+'%',10)),colorcyan;
EXPLAIN(1,SJ[3]+':'+NUMTOSTR(STRTONUM(SY[3]),4)+STRRIGHT(' '+NUMTOSTR((三期/if(四期<>0,四期,1)-1)*100,2)+'%',10)),colorcyan;
EXPLAIN(WT,SJ[4]+':'+NUMTOSTR(STRTONUM(SY[4]),4)),colorcyan;
END;
EXPLAIN(TMP=1 AND F10=2 AND N=3,'***近期***\n'+SJ[1]+':'+NUMTOSTR(最新,2)),colorcyan;
EXPLAIN(WT,'***往年***\n'+SJ[5]+':'+NUMTOSTR(STRTONUM(SY[5]),4)+STRRIGHT(' '+NUMTOSTR((去年/前年-1)*100,2)+'%',10)),colorgreen;
EXPLAIN(WT,SJ[6]+':'+NUMTOSTR(STRTONUM(SY[6]),4)+STRRIGHT(' '+NUMTOSTR((前年/前二-1)*100,2)+'%',10)),colorgreen;
EXPLAIN(WT,SJ[7]+':'+NUMTOSTR(STRTONUM(SY[7]),4)+STRRIGHT(' '+NUMTOSTR((前二/前三-1)*100,2)+'%',10)),colorgreen;
EXPLAIN(WT,SJ[8]+':'+NUMTOSTR(STRTONUM(SY[8]),4)),colorgreen;
值2:=IF(TMP,去年,前年),LINETHICK;
值3:=IF(TMP,前年,前二),LINETHICK;
值4:=IF(TMP,前二,前三),LINETHICK;
IF DATACOUNT>20 THEN BEGIN
//画柱线
-0.05,COLOR99;
A3:=SYSPARAM(3);AG:=INTPART((SYSPARAM(3)-SYSPARAM(2))/IF(DATACOUNT>120,20,20));A5:=SYSPARAM(5);
//STICKLINE(BARPOS=A3-AG*2,0,一期,AG*4,0),colorFF,LINETHICK2;
STICKLINE(BARPOS=A3-AG*2,0,最新,AG*4,0),colorFF,LINETHICK2;
STICKLINE(BARPOS=A3-AG*5,0,值2,AG*4,0),colorFFFF,LINETHICK2;
STICKLINE(BARPOS=A3-AG*8,0,值3,AG*4,0),colorFFFF00,LINETHICK2;
STICKLINE(BARPOS=A3-AG*11,0,值4,AG*4,0),colorFF00,LINETHICK2;
//显示数值
DRAWNUMBER(BARPOS=A3-AG*1,IF(最新<0,最新/2,0),最新,3),,COLORFFD000,ALIGN,PXUP30;
DRAWNUMBER(BARPOS=A3-AG*4,IF(值2<0,值2/2,0),值2,3),COLORFFD000,ALIGN,PXUP30;
DRAWNUMBER(BARPOS=A3-AG*7,IF(值3<0,值3/2,0),值3,3),,COLORFFD000,ALIGN,PXUP30;
DRAWNUMBER(BARPOS=A3-AG*10,IF(值4<0,值4/2,0),值4,3),,COLORFFD000,ALIGN,PXUP30;
//显示时间
DRAWTEXT(BARPOS=A3-AG*3,0,SJ[1]),COLORCCEE90,ALIGN5,PXDN5;
DRAWTEXT(BARPOS=A3-AG*6,0,IF(TMP,SJ[5],SJ[6])),COLORCCEE90,ALIGN5,PXDN5;
DRAWTEXT(BARPOS=A3-AG*9,0,IF(TMP,SJ[6],SJ[7])),COLORCCEE90,ALIGN5,PXDN5;
DRAWTEXT(BARPOS=A3-AG*12,0,IF(TMP,SJ[7],SJ[8])),COLORCCEE90,ALIGN5,PXDN5;
END;
//
{参数精灵:
选择指标:Param#1(1-3)
1- 净资产收益率 2- 主营业务利润率 3- 销shou毛利率
|