飞狐博弈MACD副图指标
{参数:SHORT(短期)、LONG(长期)、M 天数,一般为12、26、9
用法:
1.DIFF、DEA均为正,DIFF向上突破DEA,买入信号。
2.DIFF、DEA均为负,DIFF向下跌破DEA,卖出信号。
3.DEA线与K线发生背离,行情反转信号。
4.分析MACD柱状线,由红变绿(正变负),卖出信号;由绿变红,买入信号。}
源码
LONG:=26;SHORT:=12;M:=9;N:=27;
DIFF: EMA(CLOSE,SHORT)-EMA(CLOSE,LONG);
DEA: EMA(DIFF,M);
MACD: 2*(DIFF-DEA), COLORSTICK;
Var2:=BARSLAST(EMA(CLOSE,N)<REF(EMA(CLOSE,N),1));
Var3:=IF(Var2>0,LLV(LLV(LOW,N),Var2),LLV(LOW,N));
Var4:=IF(Var2>0,LLV(LLV(LOW,N),Var2),LLV(LOW,N));
Var5:=(2*CLOSE+HIGH+LOW+OPEN)/5;
Var6:=EMA(EMA(EMA(Var5,4),4),4);
Var7:=(Var6-REF(Var6,1))/REF(Var6,1)*100;
Var8:=MA(Var7,2);
Var9:=MA(Var7,1);
VarA:=CROSS(Var9,Var8) AND Var9<0;
VarB:=CROSS(Var9,0);
VarC:=CROSS(Var9,Var8) AND Var9>0;
VarD:=Var3+Var3*Var2*2;
VarE:=IF(VarD<REF(VarD,1),MA(CLOSE,5),VarD);
VarF:=BARSLAST(EMA(CLOSE,N)>REF(EMA(CLOSE,N),1));
Var10:=IF(VarF>0,HHV(HHV(HIGH,N),VarF),HHV(HIGH,N));
Var11:=IF(VarF>0,HHV(HHV(HIGH,N),VarF),HHV(HIGH,N));
Var12:=(2*CLOSE+HIGH+LOW+OPEN)/5;
Var13:=EMA(EMA(EMA(Var5,4),4),4);
Var14:=(Var6-REF(Var6,1))/REF(Var6,1)*100;
Var15:=MA(Var7,2);
Var16:=MA(Var7,1);
Var17:=CROSS(Var9,Var8) AND Var9<0;
Var18:=CROSS(Var9,0);
Var19:=CROSS(Var9,Var8) AND Var9>0;
Var1A:=Var10-Var10*VarF*2/100;
Var1B:=IF(Var1A>REF(Var1A,1),MA(CLOSE,5),Var1A);
涨: IF(ACOS(VarF)>0,-0.03,0), , COLORRED;
调整: IF(ATAN(VarF)>0,0.03,0), ,COLORGREEN ;
Var1C:=(2*CLOSE+HIGH+LOW+OPEN)/5;
Var1D:=EMA(EMA(EMA(Var5,4),4),4);
Var1E:=(Var6-REF(Var6,1))/REF(Var6,1)*100;
Var1F:=MA(Var7,2);
Var20:=MA(Var7,1);
Var21:=CROSS(Var9,Var8) AND Var9<0;
Var22:=CROSS(Var9,0);
Var23:=CROSS(Var9,Var8) AND Var9>0;
跌: IF(ASIN(VarF)>0,0.03,0), , COLORCYAN;
0;
2*(DIFF-DEA);