飞狐个人使用的MACD公式
s:12 p:26 m:9 p1:3
QZ:=ABS(o),colorgray;
DL:=IF(P1=1,1/QZ,IF(P1=2,QZ,1));
GL:=o*DL;
DIFF1:EMA(gl,s)-EMA(gl,p),coloraaff00;
DEA1:EMA(DIFF1,m),colorFF00FF;
MACD:2*(diff1-dea1),LINETHICK0;
MACDhs:=IF(MACD>0 AND MACD>=REF(MACD,1),MACD,0);
MACDhx:=IF(MACD>0 AND MACD<=REF(MACD,1),MACD,0);
MACDlx:=IF(MACD<0 AND MACD<REF(MACD,1),MACD,0);
MACDls:=IF(MACD<0 AND MACD>REF(MACD,1),MACD,0);
STICKLINE(MACDhs>0,0,MACD,9,0),Color0000BB;
STICKLINE(MACDhs>0,0,MACD,8,0),Color0000CC;
STICKLINE(MACDhs>0,0,MACD,7,0),Color0011CC;
STICKLINE(MACDhs>0,0,MACD,6,0),Color1122DD;
STICKLINE(MACDhs>0,0,MACD,5,0),Color2233DD;
STICKLINE(MACDhs>0,0,MACD,4,0),Color3344EE;
STICKLINE(MACDhs>0,0,MACD,3,0),Color4455EE;
STICKLINE(MACDhs>0,0,MACD,2,0),Color5566FF;
STICKLINE(MACDhs>0,0,MACD,1,0),Color6677FF;
STICKLINE(MACDhx>0,0,MACD,9,0),Color0077BB;
STICKLINE(MACDhx>0,0,MACD,8,0),Color0088CC;
STICKLINE(MACDhx>0,0,MACD,7,0),Color0099CC;
STICKLINE(MACDhx>0,0,MACD,6,0),Color00AADD;
STICKLINE(MACDhx>0,0,MACD,5,0),Color00BBDD;
STICKLINE(MACDhx>0,0,MACD,4,0),Color00CCEE;
STICKLINE(MACDhx>0,0,MACD,3,0),Color00DDEE;
STICKLINE(MACDhx>0,0,MACD,2,0),Color00EEFF;
STICKLINE(MACDhx>0,0,MACD,1,0),Color00FFFF;
STICKLINE(MACDlx<0,MACD,0,9,0),Color770000;
STICKLINE(MACDlx<0,MACD,0,8,0),Color881100;
STICKLINE(MACDlx<0,MACD,0,7,0),Color992200;
STICKLINE(MACDlx<0,MACD,0,6,0),ColorAA3300;
STICKLINE(MACDlx<0,MACD,0,5,0),ColorBB4400;
STICKLINE(MACDlx<0,MACD,0,4,0),ColorCC5500;
STICKLINE(MACDlx<0,MACD,0,3,0),ColorDD6600;
STICKLINE(MACDlx<0,MACD,0,2,0),ColorEE7700;
STICKLINE(MACDlx<0,MACD,0,1,0),ColorFF8800;
STICKLINE(MACDls<0,MACD,0,9,0),Color005500;
STICKLINE(MACDls<0,MACD,0,8,0),Color007700;
STICKLINE(MACDls<0,MACD,0,7,0),Color009900;
STICKLINE(MACDls<0,MACD,0,6,0),Color00AA00;
STICKLINE(MACDls<0,MACD,0,5,0),Color00BB00;
STICKLINE(MACDls<0,MACD,0,4,0),Color00CC00;
STICKLINE(MACDls<0,MACD,0,3,0),Color00DD00;
STICKLINE(MACDls<0,MACD,0,2,0),Color00EE00;
STICKLINE(MACDls<0,MACD,0,1,0),Color00FF00;
dea:dea1>0 and macd>0 and ref(macd,2)>ref(macd,1),linethick0;