macd主图指标源码公式
夹心MACD副图源码源码
原理解析:
SHORT赋值:12
LONG赋值:26
M赋值:9
输出DIFF : 收盘价的SHORT日指数移动平均 - 收盘价的LONG日指数移动平均
输出DEA : DIFF的M日指数移动平均
输出平滑异同平均 : 2*(DIFF-DEA), COLORSTICK
当满足条件DEA>1日前的DEA时,在-0.03和0.03位置之间画柱状线,宽度为20,501不为0则画空心柱.,画红色
VAR1赋值:53日内DEA的最高值
VAR2赋值:55日内DEA的最低值
VAR3赋值:DEA-(DIFF-DEA)
输出UP:如果DIFF>VAR1ANDDEA=VAR1,返回10日内VAR1的最低值和VAR3的较大值,否则返回VAR1,COLOR33FF33,线宽为2
输出DN:如果DIFF180000 AND (CXH=1 OR CXH=6))
DRAWTEXTREL(10 ,10 ,'指标公式')
源码:
SHORT:=12;
LONG:=26;
M:=9;
DIFF : EMA(CLOSE,SHORT) - EMA(CLOSE,LONG);
DEA : EMA(DIFF,M);
MACD : 2*(DIFF-DEA), COLORSTICK;
STICKLINE(DEA>REF(DEA,1),-0.03,0.03,20,501),COLORRED;
VAR1:=HHV(DEA,53);
VAR2:=LLV(DEA,55);
VAR3:=DEA-(DIFF-DEA);
UP:IF(DIFF>VAR1 AND DEA=VAR1,MAX(LLV(VAR1,10),VAR3),VAR1),COLOR33FF33,LINETHICK2;
DN:IF(DIFF180000 and (CXH=1 OR CXH=6));
DRAWTEXTREL(10 ,10 ,'指标公式');