飞狐主图上部叠加MACD公式
{主图叠加MACD上}
DIFZ:=EMA(C,12)-EMA(C,26);
DEAZ:=EMA(DIFZ,9);
MACDZ:=5*(DIFZ-DEAZ);
N1:=SYSPARAM(3);
NN:=N1-SYSPARAM(2)+1;
HH:=HHV(C,NN);
LL:=LLV(C,NN);
最高:=HH[N1];
最低:=LL[N1];
RCC:=最高*1.05-(最高*1.05-最低*1)*0.1;//MACD放在主图上边的0轴定性
限制显示K线面积:=RANGE(BARPOS,SYSPARAM(3)-120,SYSPARAM(3)+1);//限制在120个K线范围内,可自行调节
FILLRGN(DIFZ>DEAZ AND 限制显示K线面积,DIFZ*5/2+RCC,EMA(DIFZ*5/2+RCC,9)),COLORFF0080;
FILLRGN(DIFZ<=DEAZ AND 限制显示K线面积,DIFZ*5/2+RCC,EMA(DIFZ*5/2+RCC,9)),COLORGRAY;
{以上是DIFF/DEA画色带}
STICKLINE((RCC+MACDZ)>RCC AND (RCC+MACDZ)<=REF(RCC+MACDZ,1) AND 限制显示K线面积,RCC,RCC+MACDZ,5,0),COLOR400080;
STICKLINE((RCC+MACDZ)>RCC AND (RCC+MACDZ)>REF(RCC+MACDZ,1) AND 限制显示K线面积,RCC,RCC+MACDZ,5,0),COLOR00FFFF;
STICKLINE((RCC+MACDZ)<=RCC AND (RCC+MACDZ)<=REF(RCC+MACDZ,1) AND 限制显示K线面积,RCC,RCC+MACDZ,5,0),COLOR008080;
STICKLINE((RCC+MACDZ)<=RCC AND (RCC+MACDZ)>REF(RCC+MACDZ,1) AND 限制显示K线面积,RCC,RCC+MACDZ,5,0),COLORC080FF;
{以上显示柱子}
PARTLINE(限制显示K线面积,EMA(DIFZ*5/2+RCC,9)),COLORFFFFFF,LINETHICK1,PRECISION2;
PARTLINE(限制显示K线面积,DIFZ*5/2+RCC),COLORRED,LINETHICK1,PRECISION2;
PARTLINE((DIFZ*5/2+RCC)<=REF(DIFZ*5/2+RCC,1) AND 限制显示K线面积,DIFZ*5/2+RCC),COLORFFF000,LINETHICK1,PRECISION2;
{以上是显示DIFF和DEA}
{显示K线,以免被色带盖住}
STICKLINE(C>O,H,L,0.1,1),COLORRED;
STICKLINE(C>O,C,O,8,1),COLORRED;
STICKLINE(C<=O,H,L,0.1,1),COLORCYAN;
STICKLINE(C<=O,C,O,8,1),COLORCYAN;
{均线状态}
MA5:MA(C,5);
MA10:MA(C,10);
MA20:MA(C,20);
MA30:MA(C,30);
MA60:MA(C,60);