MACD面積公式
1、際人學長的MACD紅綠柱面積公式,用於飛狐
input:調整參數(0.1,0.0001,1000),數字位置(1,1,1000);
p:=26;s:=12;m:=9;
DIFF:EMA(c,s) – EMA(c,p);
DEA:EMA(DIFF,m);
MACD:2*(DIFF-DEA),COLORSTICK;
BV:=SUM(MACD/調整參數,0);
BA:=IF(MAX(BV,REF(BV,2))<REF(BV,1) ORMIN(BV,REF(BV,2))>REF(BV,1),1,0);
BC:=BARSLAST(BA)+1;
SMACD:=BV-REF(BV,BC);
漲面積:=FLOOR(SUM(MACD,BARSLAST(MACD<0))/調整參數),linethick0;
跌面積:=FLOOR(ABS(SUM(MACD,BARSLAST(MACD>0)))/調整參數),linethick0;
var3:=if(macd>0,HHV(abs(macd),bc)*數字位置,LLV(macd,bc)*數字位置);
var4:=(macd)/20;{圖形比例縮小1/20,可修改}
var5:=SMACD*100;
DRAWNUMBER(CROSS(0,MACD),ref(var3,1),REF(漲面積,1),0),,colorgreen;
DRAWNUMBER(CROSS(MACD,0),ref(var3,1),REF(跌面積,1),0),colorff00ff;
M1:=REF(MACD,1);
STICKLINE(macd>0 andmacd<=m1,0,macd,3,0),coloryellow;
STICKLINE(macd<0 andmacd>=m1,0,macd,3,0),colorwhite;
日線MACD:"macd.macd#day",LINETHICK0,COLORFF0099;
三十分MACD:"MACD.MACD#MIN30",colorred,linethick0;
十五分MACD:"MACD.MACD#MIN15",linethick0;
五分MACD:"MACD.MACD#MIN5",colorff00ff,linethick0;
jc := dea-diff;
綠柱面積:IF(MACD<0,SUM(MACD,BARSLAST(jc<0))/調整參數,0),linethick0,colorcyan,PRECISION0;
紅柱面積:IF(MACD>0,SUM(MACD,BARSLAST(jc>0))/調整參數,0),linethick0,colorred,PRECISION0;
AA1:=IF(MACD>0,1,-1),LINETHICK0;
AA2:=REF(AA1,1),LINETHICK0;
AA3:=AA1*AA2,LINETHICK0;
AA4:=BARSLAST(AA3<0),LINETHICK0;
AA5:=AA4+1,LINETHICK0;
當前面積:SUM(MACD,AA5)/0.10,COLORGREEN,LINETHICK0;
2、MACD紅綠柱面積公式,用於飛狐
input:調整參數(0.1,0.0001,1000),數字位置(1,1,1000);
p:=26;s:=12;m:=9;
DIFF:EMA(c,s) – EMA(c,p);
DEA:EMA(DIFF,m);
MACD:2*(DIFF-DEA),COLORSTICK;
BV:=SUM(MACD/調整參數,0);
BA:=IF(MAX(BV,REF(BV,2))<REF(BV,1) ORMIN(BV,REF(BV,2))>REF(BV,1),1,0);
BC:=BARSLAST(BA)+1;
SMACD:=BV-REF(BV,BC);
AA1:=IF(MACD>0,1,-1),LINETHICK0;
AA2:=REF(AA1,1),LINETHICK0;
AA3:=AA1*AA2,LINETHICK0;
AA4:=BARSLAST(AA3<0),LINETHICK0;
AA5:=AA4+1,LINETHICK0;
當前面積:SUM(MACD,AA5)/0.10,COLORGREEN,LINETHICK0;
{面背}
JC := DEA-DIFf;
綠柱面積:=IF(MACD<0,SUM(MACD,BARSLAST(JC<0)),0);
紅柱面積:=IF(MACD>0,SUM(MACD,BARSLAST(JC>0)),0);
本次最低價:=LLV(L,BARSLAST(JC<0));
本次最高價:=HHV(H,BARSLAST(JC>0));
X1:=IF (MACD<0,BARSLAST(CROSS(DIFf,DEA)),0);
前次綠柱面積:=REF(綠柱面積,X1+1);
前次最低價:=REF(本次最低價,X1+1);
Y1:=IF((綠柱面積<0 ANDABS(綠柱面積)<ABS(前次綠柱面積)
AND 本次最低價<前次最低價 ),1,0);
RS1:= MACD<0 AND REF(MACD,1)<0 ANDC<前次最低價
AND ABS(綠柱面積)<ABS(前次綠柱面積) ANDABS(MACD)<ABS(REF(MACD,1));
底背馳:= IF (CROSS(DIFf,DEA),REF(Y1,1),0);
STICKLINE(底背馳,0,MACD,3,1 ),COLOR00FF00;
DRAWTEXT(底背馳,0,' 底面背'),COLOR33FF33;
X2:=IF (MACD>0,BARSLAST(CROSS(DEA,DIFf)),0);
前次紅柱面積:=REF(紅柱面積,X2+1);
前次最高價:=REF(本次最高價,X2+1);
Y2:=IF((紅柱面積>0 AND 紅柱面積<前次紅柱面積 AND本次最高價>前次最高價 ),1,0);
3、上級MACD,用於飛狐
A:=SUM(C*IF(MOD(DATETOD1970(DATE),7)=0,1,0),3)*IF(DATAPERIOD=6,1,0);
DF:=SUM(C*IF(MOD(MINUTE,5)=0,1,0),5)*IF(DATAPERIOD=1,1,0)
+SUM(C*IF(MOD(MINUTE+55,30)=0,1,0),6)*IF(DATAPERIOD=2,1,0)
+SUM(C*IF(HOUR-15=0,1,0),8)*IF(DATAPERIOD=4,1,0)
+A+IF(A=0,REF(A,1),0)
+IF(REF(A,1)+A=0,REF(A,2),0)
+IF(REF(A,2)+REF(A,1)+A=0,REF(A,3),0)
+IF(REF(A,3)+REF(A,2)+REF(A,1)+A=0,REF(A,4),0)
+IF(REF(A,4)+REF(A,3)+REF(A,2)+REF(A,1)+A=0,REF(A,5),0)
+IF(REF(A,5)+REF(A,4)+REF(A,3)+REF(A,2)+REF(A,1)+A=0,REF(A,6),0);
XX:=1+4*IF(DATAPERIOD=1,1,0)
+5*IF(DATAPERIOD=2,1,0)
+7*IF(DATAPERIOD=4,1,0)
+4*IF(DATAPERIOD=6,1,0);
PDIF:EMA(DF,SHORT*XX)-EMA(DF,LONG*XX);
PDEA:EMA(PDIF,MID*XX);
PMACD:(PDIF-PDEA)*2,COLORSTICK;
4、看上級BOLL用於飛狐
A:=SUM(C*IF(MOD(DATETOD1970(DATE),7)=0,1,0),3)*IF(DATAPERIOD=6,1,0);
DF:=SUM(C*IF(MOD(MINUTE,5)=0,1,0),5)*IF(DATAPERIOD=1,1,0)
+SUM(C*IF(MOD(MINUTE+55,30)=0,1,0),6)*IF(DATAPERIOD=2,1,0)
+SUM(C*IF(HOUR-15=0,1,0),8)*IF(DATAPERIOD=4,1,0)
+A+IF(A=0,REF(A,1),0)
+IF(REF(A,1)+A=0,REF(A,2),0)
+IF(REF(A,2)+REF(A,1)+A=0,REF(A,3),0)
+IF(REF(A,3)+REF(A,2)+REF(A,1)+A=0,REF(A,4),0)
+IF(REF(A,4)+REF(A,3)+REF(A,2)+REF(A,1)+A=0,REF(A,5),0)
+IF(REF(A,5)+REF(A,4)+REF(A,3)+REF(A,2)+REF(A,1)+A=0,REF(A,6),0);
XX:=1+4*IF(DATAPERIOD=1,1,0)
+5*IF(DATAPERIOD=2,1,0)
+7*IF(DATAPERIOD=4,1,0)
+4*IF(DATAPERIOD=6,1,0);
BOLL:MA(DF,N*XX),colorwhite;
UPPER:BOLL+2*STD(DF,N*XX),COLOR000066,LINETHICK2;
LOWER:BOLL-2*STD(DF,N*XX),COLOR006600,LINETHICK2;
MA1:MA(DF,5*XX),colorcyan,LINEDOT;
MA2:MA(DF,10*XX),COLORGREEN,LINEDOT;
5、通達信MACD面積公式
{MACDMJ:MACD面積,放大比例H0,參數:SHORT=12,LONG=26,MID=9}
H0:=100;
DIF0:=EMA(CLOSE*H0,SHORT)-EMA(CLOSE*H0,LONG);
DEA0:=EMA(DIF0,MID);
MACD0:=(DIF0-DEA0)*2;
A01:=IF(MACD0>0,1,-1);
A02:=REF(A01,1);
A03:=A01*A02;
A04:=BARSLAST(A03<0);
A05:=A04+1;
MJ0:=(SUM(MACD0,0)-REF(SUM(MACD0,0),A05))/5;
DIF:DIF0;
DEA:DEA0;
MJ:MJ0;
MACD:MACD0,COLORSTICK;
6、通達信看上級MACD公式
A:=SUM(C*IF(MOD(DATETODAY(DATE),7)=0,1,0),3)*IF(PERIOD=5,1,0);
DF:=SUM(C*IF(MOD(MINUTE,5)=0,1,0),5)*IF(PERIOD=0,1,0)
+SUM(C*IF(MOD(MINUTE+55,30)=0,1,0),6)*IF(PERIOD=1,1,0)
+SUM(C*IF(HOUR-15=0,1,0),8)*IF(PERIOD=3,1,0)
+A+IF(A=0,REF(A,1),0)
+IF(REF(A,1)+A=0,REF(A,2),0)
+IF(REF(A,2)+REF(A,1)+A=0,REF(A,3),0)
+IF(REF(A,3)+REF(A,2)+REF(A,1)+A=0,REF(A,4),0)
+IF(REF(A,4)+REF(A,3)+REF(A,2)+REF(A,1)+A=0,REF(A,5),0)
+IF(REF(A,5)+REF(A,4)+REF(A,3)+REF(A,2)+REF(A,1)+A=0,REF(A,6),0);
XX:=1+4*IF(PERIOD=0,1,0)
+5*IF(PERIOD=1,1,0)
+7*IF(PERIOD=3,1,0)
+4*IF(PERIOD=5,1,0);
PDIF:EMA(DF,SHORT*XX)-EMA(DF,LONG*XX);
PDEA:EMA(PDIF,MID*XX);
PMACD:(PDIF-PDEA)*2,COLORSTICK;
7、通達信看上級BOLL公式
A:=SUM(C*IF(MOD(DATETODAY(DATE),7)=0,1,0),3)*IF(PERIOD=5,1,0);
DF:=SUM(C*IF(MOD(MINUTE,5)=0,1,0),5)*IF(PERIOD=0,1,0)
+SUM(C*IF(MOD(MINUTE+55,30)=0,1,0),6)*IF(PERIOD=1,1,0)
+SUM(C*IF(HOUR-15=0,1,0),8)*IF(PERIOD=3,1,0)
+A+IF(A=0,REF(A,1),0)
+IF(REF(A,1)+A=0,REF(A,2),0)
+IF(REF(A,2)+REF(A,1)+A=0,REF(A,3),0)
+IF(REF(A,3)+REF(A,2)+REF(A,1)+A=0,REF(A,4),0)
+IF(REF(A,4)+REF(A,3)+REF(A,2)+REF(A,1)+A=0,REF(A,5),0)
+IF(REF(A,5)+REF(A,4)+REF(A,3)+REF(A,2)+REF(A,1)+A=0,REF(A,6),0);
XX:=1+4*IF(PERIOD=0,1,0)
+5*IF(PERIOD=1,1,0)
+7*IF(PERIOD=3,1,0)
+4*IF(PERIOD=5,1,0);
BOLL:MA(DF,N*XX),COLOR666666;
UPPER:BOLL+2*STD(DF,N*XX),COLOR000066;
LOWER:BOLL-2*STD(DF,N*XX),