五行量化 通达信副图/选股/预警指标 源码 贴图 无未来

2019-08-22 09:04:00来源:本站整理浏览:625

五行量化 通达信副图/选股/预警指标 源码 贴图 无未来

该选股公式是针对理想路弹力的五行量化副图指标编写的选股预警公式,首先感谢原创副图作者;选股思路:是昨日全是绿柱,今日红柱要大于等于4根;我使用的是免费通达信软件。该指标发出信号后要参照其他指标同时关注板块的强弱优选。

五行量化 通达信副图/选股/预警指标 源码 贴图 无未来

五行量化 通达信副图/选股/预警指标 源码 贴图 无未来

五行量化 通达信副图/选股/预警指标 源码 贴图 无未来

五行量化 通达信副图/选股/预警指标 源码 贴图 无未来

五行量化 通达信副图/选股/预警指标 源码 贴图 无未来

五行量化 通达信副图/选股/预警指标 源码 贴图 无未来


{量化筹码模型}
日线锁定:=IFF(PERIOD>=4,1,DRAWNULL);
CMN:=20;

TRENDA:=WINNER(C)*100;
CMQS1:=WMA(TRENDA,8);
CMQS2:=WMA(TRENDA,13);
CMQS3:=WMA(TRENDA,21);
CMQS4:=WMA(TRENDA,34);
CMQS5:=WMA(TRENDA,55);

{01~05}
CM01:=CMQS1>REF(CMQS1,1);
CM02:=CMQS2>REF(CMQS2,1);
CM03:=CMQS3>REF(CMQS3,1);
CM04:=CMQS4>REF(CMQS4,1);
CM05:=CMQS5>REF(CMQS5,1);

{06~10}
CM06:=TRENDA>CMQS1;
CM07:=TRENDA>CMQS2;
CM08:=TRENDA>CMQS3;
CM09:=TRENDA>CMQS4;
CM10:=TRENDA>CMQS5;

{11~14}
CM11:=CMQS1>CMQS2;
CM12:=CMQS1>CMQS3;
CM13:=CMQS1>CMQS4;
CM14:=CMQS1>CMQS5;
{15~17}
CM15:=CMQS2>CMQS3;
CM16:=CMQS2>CMQS4;
CM17:=CMQS2>CMQS5;

{18~19}
CM18:=CMQS3>CMQS4;
CM19:=CMQS3>CMQS5;

{20}
CM20:=CMQS4>CMQS5;

量化筹码:=IFF(C>0 AND 日线锁定,EMA(((CM01+CM02+CM03+CM04+CM05+CM06+CM07+CM08+CM09+CM10+
CM11+CM12+CM13+CM14+CM15+CM16+CM17+CM18+CM19+CM20)*(100/CMN)),2),DRAWNULL);

XG1:=量化筹码>=REF(量化筹码,1) AND REF(量化筹码,1)<REF(量化筹码,2);


{2量化量能模型}

方向成交量:=IFF(CLOSE>=OPEN,VOL,VOL*(-1));
LHLNMID:=(3*CLOSE+OPEN+HIGH+LOW)/6;
LHLN短线:=WMA(LHLNMID,5);
LHLN中线:=WMA(LHLNMID,10);
LHLN多头:=LHLN短线>LHLN中线;

P01:=SUM(方向成交量,1)>0;
P02:=SUM(方向成交量,2)>0;
P03:=SUM(方向成交量,3)>0;
P04:=SUM(方向成交量,4)>0;
P05:=SUM(方向成交量,5)>0;

SUM11:=SUM(方向成交量,11);
SUM12:=SUM(方向成交量,12);
SUM13:=SUM(方向成交量,13);
SUM14:=SUM(方向成交量,14);
SUM15:=SUM(方向成交量,15);
SUM16:=SUM(方向成交量,16);
SUM17:=SUM(方向成交量,17);
SUM18:=SUM(方向成交量,18);
SUM19:=SUM(方向成交量,19);
SUM20:=SUM(方向成交量,20);

P11:=SUM11>0 AND SUM11>REF(SUM11,1);
P12:=SUM12>0 AND SUM12>REF(SUM12,1);
P13:=SUM13>0 AND SUM13>REF(SUM13,1);
P14:=SUM14>0 AND SUM14>REF(SUM14,1);
P15:=SUM15>0 AND SUM15>REF(SUM15,1);
P16:=SUM16>0 AND SUM16>REF(SUM16,1);
P17:=SUM17>0 AND SUM17>REF(SUM17,1);
P18:=SUM18>0 AND SUM18>REF(SUM18,1);
P19:=SUM19>0 AND SUM19>REF(SUM19,1);
P20:=SUM20>0 AND SUM20>REF(SUM20,1);

MAZJ05:=MA(方向成交量,5);
MAZJ10:=MA(方向成交量,10);
MAZJ15:=MA(方向成交量,15);
MAZJ20:=MA(方向成交量,20);
MA01:=MAZJ05>MAZJ10;
MA02:=MAZJ05>MAZJ15;
MA03:=MAZJ05>MAZJ20;
MA04:=MAZJ10>MAZJ15;
MA05:=MAZJ10>MAZJ20;
MA06:=MAZJ15>MAZJ20;

基准线1:=EMA(EMA(EMA(EMA(IFF(方向成交量>=0,方向成交量,0),20),2),2),2);
基准线6:=基准线1*6;{WWW.GPXIAZAI.COM}
ZJDL10:=IFF(方向成交量>基准线6,10,IFF(方向成交量<=基准线6 AND 方向成交量>0,10*方向成交量/基准线6,0));
 

{长中短线}
短线总量:=SUM(方向成交量,3);
短线总量10:=EMA(短线总量,10);
短线总量60:=EMA(短线总量,60);
短线总量20:=EMA(短线总量,20);
短线总量30:=EMA(短线总量,30);
CZD01:=短线总量>短线总量10;
CZD02:=短线总量20>短线总量30;
CZD03:=短线总量10>短线总量60;
{长中短线}

总权:=53;
量化量能X:=IFF(日线锁定 AND C>0,EMA(EMA(100*(P01*2+P02*2+P03*5+P04*2+P05*2+P11*1+P12*1+P13*1+P14*1+P15*1+P16*1+P17*1+P18*1+P19*1+P20*1+
MA01*2+MA02*2+MA03*1+MA04*1+MA05*1+MA06*1+ZJDL10+CZD01*5+CZD02*4+CZD03*3)/总权,2),2),DRAWNULL);
量化量能XX:=IFF(LHLN多头,量化量能X*1.2,量化量能X);
量化量能:=WMA(IFF(量化量能XX>=100,100,量化量能XX),3);
XG2:=量化量能>=REF(量化量能,1) AND REF(量化量能,1)<REF(量化量能,2);


{全局控制}
{全局控制}
数量:=23;

{01}
DMADIF:=MA(C,10)-MA(C,50);
DMAAMA:=MA(DMADIF,10);
DMAX:=DMADIF>DMAAMA;
P001:=DMAX;

{02}
DMITR:=EXPMEMA(MAX(MAX(H-L,ABS(H-REF(C,1))),ABS(REF(C,1)-L)),14);
DMIHD:=H-REF(H,1);
DMILD:=REF(L,1)-L;
DMIDMP:=EXPMEMA(IFF(DMIHD>0 AND DMIHD>DMILD,DMIHD,0),14);
DMIDMM:=EXPMEMA(IFF(DMILD>0 AND DMILD>DMIHD,DMILD,0),14);
DMIPDI:=DMIDMP*100/DMITR;
DMIMDI:=DMIDMM*100/DMITR;
DMIX:=DMIPDI>DMIMDI;
P002:=DMIX;

{03}
DPODPO:=C-REF(MA(C,20),20/2+1);
DPOMADPO:=MA(DPODPO,6);
DPOX:=DPODPO>DPOMADPO;
P003:=DPOX;

{04}
EMVVOLUME:=MA(V,14)/V;
EMVMID:=100*(H+L-REF(H+L,1))/(H+L);
EMVEMV:=MA(EMVMID*EMVVOLUME*(H-L)/MA(H-L,14),14);
EMVMAEMV:=MA(EMVEMV,9);
EMVX:=EMVEMV>EMVMAEMV;
P004:=EMVX;

{05}
MACDDIF:=EMA(C,12)-EMA(C,26);
MACDDEA:=EMA(MACDDIF,9);
MACDX:=MACDDIF>MACDDEA;
P005:=MACDX;

{06}
TRIXTR:=EMA(EMA(EMA(C,12),12),12);
TRIXTRIX:=(TRIXTR-REF(TRIXTR,1))/REF(TRIXTR,1)*100;
TRIXMATRIX:=MA(TRIXTRIX,9);
TRIXX:=TRIXTRIX>TRIXMATRIX;
P006:=TRIXX;

{08}
WVADWVAD:=SUM((C-O)/(H-L)*V,24)/10000;
WVADMAWVAD:=MA(WVADWVAD,6);
WVADX:=WVADWVAD>WVADMAWVAD;
P008:=WVADX;

{09}
JSJS:=100*(C-REF(C,5))/(5*REF(C,5));
JSMAJS1:=MA(JSJS,5);
JSX:=JSJS>JSMAJS1;
P009:=JSX;

{10}
CYEMAL:=MA(C,5);
CYEMAS:=MA(MA(C,20),5);
CYECYEL:=(CYEMAL-REF(CYEMAL,1))/REF(CYEMAL,1)*100;
CYECYES:=(CYEMAS-REF(CYEMAS,1))/REF(CYEMAS,1)*100;
CYEX:=CYECYEL>CYECYES;
P010:=CYEX;

{11}
JLHBVAR1:=(C-LLV(L,60))/(HHV(H,60)-LLV(L,60))*80;
JLHBB:=SMA(JLHBVAR1,7,1);
JLHBVAR2:=SMA(JLHBB,5,1);
JLHBX:=JLHBB>JLHBVAR2;
P011:=JLHBX;

{12}
CYCJJJ:=IFF(DYNAINFO(8)>0.01,0.01*DYNAINFO(10)/DYNAINFO(8),DYNAINFO(3));
CYCDDD:=(DYNAINFO(5)<0.01 || DYNAINFO(6)<0.01);
CYCJJJT:=IFF(CYCDDD,1,(CYCJJJ<(DYNAINFO(5)+0.01) && CYCJJJ>(DYNAINFO(6)-0.01)));
CYCCYC1:=IFF(CYCJJJT,0.01*EXPMA(AMOUNT,5)/EXPMA(VOL,5),EMA((HIGH+LOW+CLOSE)/3,5));
CYCCYC2:=IFF(CYCJJJT,0.01*EXPMA(AMOUNT,13)/EXPMA(VOL,13),EMA((HIGH+LOW+CLOSE)/3,13));
CYCX:=CYCCYC1>CYCCYC2;
P012:=CYCX;

{13}
BBIBBI:=(MA(C,3)+MA(C,6)+MA(C,12)+MA(C,24))/4;
BBIX:=C>BBIBBI;
P013:=BBIX;

{14}
DDITR:=MAX(ABS(H-REF(H,1)),ABS(L-REF(L,1)));
DDIDMZ:=IFF((H+L)<=(REF(H,1)+REF(L,1)),0,MAX(ABS(H-REF(H,1)),ABS(L-REF(L,1))));
DDIDMF:=IFF((H+L)>=(REF(H,1)+REF(L,1)),0,MAX(ABS(H-REF(H,1)),ABS(L-REF(L,1))));
DDIDIZ:=SUM(DDIDMZ,13)/(SUM(DDIDMZ,13)+SUM(DDIDMF,13));
DDIDIF:=SUM(DDIDMF,13)/(SUM(DDIDMF,13)+SUM(DDIDMZ,13));
DDIDDI:=DDIDIZ-DDIDIF;
DDIADDI:=SMA(DDIDDI,30,10);
DDIAD:=MA(DDIADDI,5);
DDIX:=DDIADDI>DDIAD;
P014:=DDIX;

{15}
FSLSWL:=(EXPMA(C,5)*7+EXPMA(C,10)*3)/10;
FSLSWS:=DMA(EMA(C,12),MAX(1,100*(SUM(V,5)/(3*CAPITAL))));
FSLX:=FSLSWL>FSLSWS;
P015:=FSLX;

{16}
MAMA1:=MA(C,5);
MAMA2:=MA(C,10);
MAXX:=MAMA1>MAMA2;
P016:=MAXX;

{17}
EXPEMA1:=EXPMA(C,12);
EXPEMA2:=EXPMA(C,17);
EXPMAX:=EXPEMA1>EXPEMA2 AND EXPEMA1>REF(EXPEMA1,1) AND EXPEMA2>REF(EXPEMA2,1);
P017:=EXPMAX;

{18}
PBX1:=(EXPMA(C,4)+MA(C,4*2)+MA(C,4*4))/3;
PBX2:=(EXPMA(C,6)+MA(C,6*2)+MA(C,6*4))/3;
PBXX:=PBX1>PBX2 AND PBX1>REF(PBX1,1) AND PBX2>REF(PBX2,1);
P018:=PBXX;

{19}
SARX:=C>SAR(4,2,20);
P019:=SARX;

{20}
QLTB:=IFF(H>REF(C,1),H-REF(C,1)+C-L,C-L);
QLTS:=IFF(REF(C,1)>LOW,REF(C,1)-L+H-C,H-C);
QLVOL_:=(QLTB-QLTS)*V/(QLTB+QLTS)/100;
QLVOL_0:=DMA(QLVOL_,0.1);
QLVOL_1:=DMA(QLVOL_,0.05);
QLRES1:=QLVOL_0-QLVOL_1;
QLLON:=SUM(QLRES1,0);
QLLONG:=QLLON;
QLMA1:=MA(QLLON,10);
LONQLX:=QLLONG>REF(QLLONG,1) AND QLMA1>REF(QLMA1,1) AND QLLONG>QLMA1;
P020:=LONQLX;

{21}
QLSTB:=IFF(H>REF(C,1),H-REF(C,1)+C-L,C-L);
QLSTS:=IFF(REF(C,1)>L,REF(C,1)-L+H-C,H-C);
QLSVOL_:=(QLSTB-QLSTS)*V/(QLSTB+QLSTS)/100;
QLSVOL_0:=DMA(QLSVOL_,0.1);
QLSVOL_1:=DMA(QLSVOL_,0.05);
QLSSHORT:=QLSVOL_0-QLSVOL_1;
QLSMA1:=MA(QLSSHORT,10);
SHORTQLX:=QLSSHORT>QLSMA1;
P021:=SHORTQLX;

{22}
AMVAMV0:=V*(O+C)/2;
AMVAMV1:=SUM(AMVAMV0,5)/SUM(V,5);
AMVAMV2:=SUM(AMVAMV0,13)/SUM(V,13);
AMVX:=AMVAMV1>AMVAMV2;
P022:=AMVX;

{23}
MTMMTM:=C-REF(C,12);
MTMMAMTM:=MA(MTMMTM,6);
MTMX:=MTMMTM>MTMMAMTM;
P023:=MTMX;

{24}
ZJTJVAR1:=EMA(EMA(C,9),9);
ZJTJ控盘:=(ZJTJVAR1-REF(ZJTJVAR1,1))/REF(ZJTJVAR1,1)*1000;
YZKPX:=ZJTJ控盘>REF(ZJTJ控盘,1) AND ZJTJ控盘>0;
P024:=YZKPX;


{已去掉第七项}
量化趋势:=IFF(C>0 AND 日线锁定,(P001+P002+P003+P004+P005+P006+P008+P009+P010+P011+P012+
P013+P014+P015+P016+P017+P018+P019+P020+P021+P022+P023+P024)*(100/数量),DRAWNULL);{读取这个量化数据即可}
XG3:=量化趋势>=REF(量化趋势,1) AND REF(量化趋势,1)<REF(量化趋势,2);

{量化指标模型}
ZBSLPG:=22;

{01.四海腾龙}
LTSHPG:=100-100*(HHV(H,40)-C)/(HHV(H,40)-LLV(L,40));
ZB01:=LTSHPG>=50;

{02.MACD}
DIFPG:=EMA(C,12)-EMA(C,26);
DEAPG:=EMA(DIFPG,9);
ZB02:=DIFPG>DEAPG;

{03~05.趋势顶底}
APG:=MA((-100)*(HHV(H,34)-C)/(HHV(H,34)-LLV(L,34)),19);
BPG:=(-100)*(HHV(H,14)-C)/(HHV(H,14)-LLV(L,14));
CPG:=EMA((-100)*(HHV(H,34)-C)/(HHV(H,34)-LLV(L,34)),4);
QSDDLONG:=APG+100;
QSDDSHORT:=BPG+100;
QSDDMID:=CPG+100;
ZB03:=QSDDSHORT>QSDDMID;
ZB04:=QSDDSHORT>QSDDLONG;
ZB05:=QSDDMID>QSDDLONG;

{06.KDJ}
RSVPG:=(C-LLV(L,9))/(HHV(H,9)-LLV(L,9))*100;
KPG:=SMA(RSVPG,3,1);
DPG:=SMA(KPG,3,1);
ZB06:=KPG>DPG;

{07~09.RSI}
LCPG:=REF(CLOSE,1);
RPG1:=SMA(MAX(C-LCPG,0),6,1)/SMA(ABS(C-LCPG),6,1)*100;
RPG2:=SMA(MAX(C-LCPG,0),12,1)/SMA(ABS(C-LCPG),12,1)*100;
RPG3:=SMA(MAX(C-LCPG,0),24,1)/SMA(ABS(C-LCPG),24,1)*100;
ZB07:=RPG1>RPG2;
ZB08:=RPG1>RPG3;
ZB09:=RPG2>RPG3;

{10~12.MA}
ZB10:=MA(C,5)>MA(C,10);
ZB11:=MA(C,5)>MA(C,20);
ZB12:=MA(C,10)>MA(C,20);

{13.主力进出}
MAVPG:=(C*2+H+L)/4;
SKPG:=EMA(MAVPG,13)-EMA(MAVPG,34);
SDPG:=EMA(SKPG,5);
ZB13:=(2*(SKPG-SDPG))>((-2)*(SKPG-SDPG));

{14~16.多空线}
MIDPGX:=(3*C+O+L+H)/6;
DKXPG1:=WMA(MIDPGX,5);
DKXPG2:=WMA(MIDPGX,10);
DKXPG3:=WMA(MIDPGX,20);
ZB14:=DKXPG1>REF(DKXPG1,1);
ZB15:=DKXPG2>REF(DKXPG2,1);
ZB16:=DKXPG3>REF(DKXPG3,1);

{17.G08}
G08PG:=EMA(C,34);
ZB17:=G08PG>REF(G08PG,1);

{18.B08}
B08PG:=(C-LLV(L,60))/(HHV(H,60)-LLV(L,60))*80;
BPG1:=SMA(B08PG,7,1);
BPG2:=SMA(BPG1,3,1);
ZB18:=BPG1>BPG2;

{19.BBI}
BBIPG:=(MA(C,3)+MA(C,6)+MA(C,12)+MA(C,24))/4;
ZB19:=C>BBIPG;

{20~21.速率表}
MIDSLB:=(3*C+L+O+H)/6;
E1:=EMA(10000*(WMA(MIDSLB,30)-REF(WMA(MIDSLB,30),1))/REF(WMA(MIDSLB,30),1),10);
E2:=EMA(E1,2);
E3:=EMA(E2,2);
E4:=EMA(E3,2);
E5:=EMA(E4,2);
E6:=EMA(E5,2);
E7:=EMA(E6,2);
ZB20:=E2>E3 AND E3>E4 AND E4>E5 AND E5>E6 AND E6>E7;
ZB21:=E2>REF(E2,1) AND E3>REF(E3,1) AND E4>REF(E4,1) AND E5>REF(E5,1) AND E6>REF(E6,1) AND E7>REF(E7,1);

{22.趋势向量}{WWW.GPXIAZAI.COM}
TRPG1:=MAX(MAX((H-L),ABS(H-REF(C,1))),ABS(REF(C,1)-L));
ATRPG1:=EMA(TRPG1,14);
HDPG:=H-REF(H,1);
LDPG:=REF(L,1)-L;
PDMPG:=EMA(IFF(HDPG>0 AND HDPG>LDPG,HDPG,0),14);
MDMPG:=EMA(IFF(LDPG>0 AND LDPG>HDPG,LDPG,0),14);
PDIPG:=PDMPG/ATRPG1;
MDIPG:=MDMPG/ATRPG1;
XLPG:=(PDIPG-MDIPG)/(PDIPG+MDIPG);
ZB22:=XLPG>0;

量化指标:=IFF(日线锁定 AND C>0,(ZB01+ZB02+ZB03+ZB04+ZB05+ZB06+ZB07+ZB08+ZB09+ZB10+
ZB11+ZB12+ZB13+ZB14+ZB15+ZB16+ZB17+ZB18+ZB19+ZB20+ZB21+ZB22)*(100/ZBSLPG),DRAWNULL),;
XG4:=量化指标>=REF(量化指标,1) AND REF(量化指标,1)<REF(量化指标,2);

日期锁定:=DATE>=1100104;
CN1:=HHV(V,5);{5日最高量}
CN2:=O>C;
CN02:=C>O;
CN03:=C=O;
CN04:=((SUM(V,5)/CN1));
CN05:=IF(CN04>0.3,1,0);{大资金}
N:=10;M:=60;
资金锁定:=IF(CN04>0.3,1,0);
主力流入:=IF(CN02 AND CN05,V,0);
主力流出:=IF(CN2 AND CN05,V,0);
主力净买:=IFF(1,(主力流入-主力流出)/10000,DRAWNULL);

P0011:=SUM(主力净买,1)>0;
P0021:=SUM(主力净买,2)>0;
P0031:=SUM(主力净买,3)>0;
P0041:=SUM(主力净买,4)>0;
P0051:=SUM(主力净买,5)>0;
 



SUM111:=SUM(主力净买,11);
SUM121:=SUM(主力净买,12);
SUM131:=SUM(主力净买,13);
SUM141:=SUM(主力净买,14);
SUM151:=SUM(主力净买,15);
SUM161:=SUM(主力净买,16);
SUM171:=SUM(主力净买,17);
SUM181:=SUM(主力净买,18);
SUM191:=SUM(主力净买,19);
SUM201:=SUM(主力净买,20);
P111:=SUM11>0 AND SUM111>REF(SUM111,1);
P121:=SUM12>0 AND SUM121>REF(SUM121,1);
P131:=SUM13>0 AND SUM131>REF(SUM131,1);
P141:=SUM14>0 AND SUM141>REF(SUM141,1);
P151:=SUM15>0 AND SUM151>REF(SUM151,1);
P161:=SUM16>0 AND SUM161>REF(SUM161,1);
P171:=SUM17>0 AND SUM171>REF(SUM171,1);
P181:=SUM18>0 AND SUM181>REF(SUM181,1);
P191:=SUM19>0 AND SUM191>REF(SUM191,1);
P201:=SUM20>0 AND SUM201>REF(SUM201,1);
 


MAZJ051:=MA(主力净买,5);
MAZJ101:=MA(主力净买,10);
MAZJ151:=MA(主力净买,15);
MAZJ201:=MA(主力净买,20);
MA011:=MAZJ051>MAZJ101;
MA021:=MAZJ051>MAZJ151;
MA031:=MAZJ051>MAZJ201;
MA041:=MAZJ101>MAZJ151;
MA051:=MAZJ101>MAZJ201;
MA061:=MAZJ151>MAZJ201;

基准线11:=EMA(EMA(EMA(EMA(IFF(主力净买>=0,主力净买,0),20),2),2),2);
基准线61:=基准线11*6;
ZJDL101:=IFF(主力净买>基准线6,10,IFF(主力净买<=基准线6 AND 主力净买>0,10*主力净买/基准线6,0));
 

{长中短线}
短线资金:=SUM(主力净买,3);
短线资金10:=EMA(短线资金,10);
短线资金60:=EMA(短线资金,60);
短线资金20:=EMA(短线资金,20);
短线资金30:=EMA(短线资金,30);
CZD011:=短线资金>短线资金10;
CZD021:=短线资金20>短线资金30;
CZD031:=短线资金10>短线资金60;
 

总权1:=53;
量化资金:=IFF(日线锁定 AND 日期锁定 AND 资金锁定 AND C>0,EMA(EMA(100*(P0011*2+P0021*2+P0031*5+P0041*2+P0051*2+P111*1+P121*1+P131*1+P141*1+P151*1+P161*1+P171*1+P181*1+P191*1+P201*1+
MA011*2+MA021*2+MA031*1+MA041*1+MA051*1+MA061*1+ZJDL10+CZD01*5+CZD02*4+CZD03*3)/总权,2),2),DRAWNULL);

XG5:=量化资金>=REF(量化资金,1) AND REF(量化资金,1)<REF(量化资金,1);
五行量化选股:XG1+XG2+XG3+XG4+XG5>=4;


 

股票公式栏目导航

精品指标推荐

最新热门

本类随机推荐

相关公式