主图叠加MACD(如何将MACD/KDJ等副图放在主图)
已经较少登录论坛,偶有同学短信要求做指标或写选股,简单或方便的我会帮助,复杂点的自己也懒了很多,不能回复者见谅!其实很多都是论坛已经发过很多次或解决得很好的问题,只要用心查查就能发现。如何将副图放主图,
============
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);
二方案,将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:=最低*0.95-(最高*1.05-最低*0.95)*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);
|