飞狐MACD力道指标公式

[复制链接]
查看150 | 回复0 | 2021-8-21 12:43:40 | 显示全部楼层 |阅读模式

input : M(9),LONG(26),SHORT(12);
DIFF : EMA(CLOSE,SHORT) - EMA(CLOSE,LONG);
DEA : EMA(DIFF,M);
MACD : 2*(DIFF-DEA), COLORSTICK;
MACD2:=MACD;
STICKLINE(MACD2<=ref(MACD2,1)and MACD2>0,0,MACD2,2,0 ),COLOR00AAFF;
STICKLINE(MACD2<=ref(MACD2,1)and MACD2>0,0,MACD2,1.8,0 ),COLOR00BBFF;
STICKLINE(MACD2<=ref(MACD2,1)and MACD2>0,0,MACD2,1.3,0 ),COLOR00CCFF;
STICKLINE(MACD2<=ref(MACD2,1)and MACD2>0,0,MACD2,1.2,0 ),COLOR00DDFF;
STICKLINE(MACD2<=ref(MACD2,1)and MACD2>0,0,MACD2,1,0 ),COLOR00EEFF;
STICKLINE(MACD2<=ref(MACD2,1)and MACD2>0,0,MACD2,0.5,0 ),COLOR00FFFF;
STICKLINE(MACD2>ref(MACD2,1)and MACD2>0,0,MACD2,5,0 ),COLOR0000AA;
STICKLINE(MACD2>ref(MACD2,1)and MACD2>0,0,MACD2,4 ,0 ),COLOR0011BB;
STICKLINE(MACD2>ref(MACD2,1)and MACD2>0,0,MACD2,3,0 ),COLOr0022CC;
STICKLINE(MACD2>ref(MACD2,1)and MACD2>0,0,MACD2,2,0 ),COLOR0033DD;
STICKLINE(MACD2>ref(MACD2,1)and MACD2>0,0,MACD2,1,0 ),COLOR0044EE;
STICKLINE(MACD2>ref(MACD2,1)and MACD2>0,0,MACD2,0.5 ,0 ),COLOR0055FF;
STICKLINE(MACD2>ref(MACD2,1)and MACD2<=0,0,MACD2,5,0 ),COLORAA00BB;
STICKLINE(MACD2>ref(MACD2,1)and MACD2<=0,0,MACD2,4 ,0 ),COLORBB11BB;
STICKLINE(MACD2>ref(MACD2,1)and MACD2<=0,0,MACD2,3,0 ),COLORCC22BB;
STICKLINE(MACD2>ref(MACD2,1)and MACD2<=0,0,MACD2,2,0 ),COLORDD33BB;
STICKLINE(MACD2>ref(MACD2,1)and MACD2<=0,0,MACD2,1 ,0 ),COLOREE44BB;
STICKLINE(MACD2>ref(MACD2,1)and MACD2<=0,0,MACD2,0.5,0 ),COLORFF55BB;
STICKLINE(MACD2<=ref(MACD2,1)and MACD2<=0,0,MACD2,2,0 ),COLORFF7700;
STICKLINE(MACD2<=ref(MACD2,1)and MACD2<=0,0,MACD2,1.5 ,0 ),COLORFF8811;
STICKLINE(MACD2<=ref(MACD2,1)and MACD2<=0,0,MACD2,1.2,0 ),COLORFFAA22;
STICKLINE(MACD2<=ref(MACD2,1)and MACD2<=0,0,MACD2,1.0 ,0 ),COLORFFBB33;
STICKLINE(MACD2<=ref(MACD2,1)and MACD2<=0,0,MACD2,0.8 ,0 ),COLORFFDD44;
STICKLINE(MACD2<=ref(MACD2,1)and MACD2<=0,0,MACD2,0.5 ,0 ),COLORFFFF55;
二线:C>Ref(C,1) and Cross(C,Ma(C,5)) and Cross(C,Ma (C,10)) OR Cross(C,Ma(C,20)) and Cross(C,Ma (C,10)),colorgreen;
三线:C>Ref(C,1) and Cross(C,Ma(C,5)) and Cross(C,Ma (C,10)) and Cross(C,Ma(C,20)),colorgreen;
四线:C>Ref(C,1) and Cross(C,Ma(C,5)) and Cross(C,Ma (C,10)) and Cross(C,Ma(C,20)) and Cross(C,Ma(C,30)),coloryellow;
五线:C>Ref(C,1) and Cross(C,Ma(C,5)) and Cross(C,Ma (C,10)) and Cross(C,Ma(C,20)) and Cross(C,Ma(C,30)) and Cross(C,Ma(C,40)),colorred;
六线:C>O and Cross(C,Ma(C,5)) and Cross(C,Ma(C,10)) and Cross(C,Ma(C,20)) and Cross(C,Ma(C,30))and Cross(C,Ma(C,40)) and Cross(C,Ma(C,60)) and slope(Ma(C,60),2)>0,colorffff00;
A:=IF(Cross(C,Ma(C,5)),1,0);
B:=IF(Cross(C,Ma(C,10)),1,0);
C1:=IF(Cross(C,Ma(C,20)),1,0);
D:=IF(Cross(C,Ma(C,30)),1,0);
E:=IF(Cross(C,Ma(C,40)),1,0);
F:=IF(Cross(C,Ma(C,50)),1,0);
G:=IF(Cross(C,Ma(C,60)),1,0);
H1:=IF(Cross(C,Ma(C,90)),1,0);
I:=IF(Cross(C,Ma(C,100)),1,0);
L1:=IF(Cross(C,Ma(C,120)),1,0);
o1:=IF(Cross(C,Ma(C,150)),1,0);
P:=IF(Cross(C,Ma(C,180)),1,0);
Q:=IF(Cross(C,Ma(C,200)),1,0);
R:=IF(Cross(C,Ma(C,250)),1,0);
S:=IF(Cross(C,Ma(C,70)),1,0);
T:=IF(Cross(C,Ma(C,80)),1,0);
S:a+b+c1+d+e+f+G+H1+I+L1+o1+P+Q+R+S+T,linethick0;
STICKLINE(S<>0,DIFF,DEA,3,0),colorFF;
A1:=S;
{www.gupang.com 股旁网_飞狐股票指标公式}
B1:=('上穿过:' + NUMTOSTR(A1[SYSPARAM(1)],2));{定义出B1价格=光标位置的A2值保留小数点后两位}
DRAWTEXT((BARPOS = SYSPARAM(1)) ,macd*1.01,B1),colorFFFF,SHIFT2;{在A1处写出B1价格} ;
EXPLAINEX(BARPOS = SYSPARAM(1) ,'上穿过:',A1,2,0),COLOR5290FF;
drawicon(s,MACD,10);
A2:=IF(Cross(Ma(C,5),C),1,0);
B2:=IF(Cross(Ma(C,10),C),1,0);
C2:=IF(Cross(Ma(C,20),C),1,0);
D2:=IF(Cross(Ma(C,30),C),1,0);
E2:=IF(Cross(Ma(C,40),C),1,0);
F2:=IF(Cross(Ma(C,50),C),1,0);
G2:=IF(Cross(Ma(C,60),C),1,0);
H2:=IF(Cross(Ma(C,90),C),1,0);
I2:=IF(Cross(Ma(C,100),C),1,0);
L2:=IF(Cross(Ma(C,120),C),1,0);
T2:=IF(Cross(C,Ma(C,150)),1,0);
O2:=IF(Cross(Ma(C,180),C),1,0);
P2:=IF(Cross(Ma(C,200),C),1,0);
Q2:=IF(Cross(Ma(C,250),C),1,0);
R2:=IF(Cross(Ma(C,70),C),1,0);
S2:=IF(Cross(Ma(C,80),C),1,0);
S1:a2+b2+c2+d2+e2+f2+G2+H2+I2+L2+P2+Q2+R2+S2+t2,linethick0;
STICKLINE(S1<>0,DIFF,DEA,3,0),colorFF00;
A1:=S1;
B1:=('下穿过:' + NUMTOSTR(A1[SYSPARAM(1)],2));{定义出B1价格=光标位置的A2值保留小数点后两位}
EXPLAINEX(BARPOS = SYSPARAM(1) ,'下穿过:',A1,2,0),COLOR5290FF;
DRAWTEXT((BARPOS = SYSPARAM(1)) ,0-macd*1.5,B1),colorFFFF00,SHIFT2;{在A1处写出B1价格}
drawicon(s1,0,11);

202108211209.jpg

202108211209.jpg

 

回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则