乘风破浪2008朋友作的《如何将MACD真实地显示在主图》的确有新意。这个公式我再从前的本论坛里也看过。不过它是把零线安排为当日的开盘价。公式和朋友的基本一个样。
下面我把它的图片也贴上来。欢迎各位朋友对比一下看看是那种好用,就用那种好了。
C/C++ Code复制内容到剪贴板
- 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;
- 限制显示K线面积:=RANGE(BARPOS,SYSPARAM(3)-120,SYSPARAM(3)+1);
- 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);
C/C++ Code复制内容到剪贴板
- 二方案,将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;
- 限制显示K线面积:=RANGE(BARPOS,SYSPARAM(3)-120,SYSPARAM(3)+1);
- 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);