自用oscmacd(副图)源码附图

2011-03-17 21:14:00来源:本站整理浏览:129

本指标采用艾略特osc震荡指标为基础,进行macd化,有面积底背离提示,macd红、蓝柱超过或低于两根蓝线也是重要提示


MA1:=MA((HIGH+LOW)/2,5);
MA2:=MA((HIGH+LOW)/2,35);
OSC:=MA1-MA2,LINETHICK0,COLORSTICK;

OSCE:=EMA(OSC,1);
DIF : EMA(OSCE,12) - EMA(OSCE,26);
BBDIF:=DIF-REF(DIF,1);
DEA  : EMA(DIF,9);
DRAWBAND(DIF,RGB(255,105,180),DEA,RGB(34,139,34));
BBDEA:=DEA-REF(DEA,1);
MACD : 2*(DIF-DEA), COLORSTICK;
STICKLINE(MACD<REF(MACD,1)AND MACD>0,0,MACD,2,0),COLORFFFF00;
STICKLINE(MACD<REF(MACD,1)AND MACD<0,0,MACD,2,0),COLOR00FF00;
STICKLINE(MACD>REF(MACD,1)AND MACD<0,0,MACD,2,0),COLOR0099FF;
STICKLINE(MACD>REF(MACD,1)AND MACD>0,0,MACD,2,0),COLORRED;
0,COLORFF8855,LINETHICK2;

UPO:=IF(DIF>=0,DIF,DRAWNULL);
DNO:=IF(DIF<=0,DIF,DRAWNULL);
UP:EMA(UPO,35+5/1.618),COLORFF9900,LINETHICK2;
DN:EMA(DNO,35+5/1.618),COLORFF9900,LINETHICK2;

DIFF3 := EMA(OSCE,12) - EMA(OSCE,26);
DEA3  := EMA(DIFF3,9);
MACD3 := 2*(DIFF3-DEA3), COLORSTICK;
JC := DEA3-DIFF3;
绿柱面积:=IF(MACD3<0,SUM(MACD3,BARSLAST(JC<0)),0);
红柱面积:=IF(MACD3>0,SUM(MACD3,BARSLAST(JC>0)),0);
本次最低价:=LLV(L,BARSLAST(JC<0));
本次最高价:=HHV(H,BARSLAST(JC>0));
X1:=IF (MACD3<0,BARSLAST(CROSS(DIFF3,DEA3)),0);
前次绿柱面积:=REF(绿柱面积,X1+1);
前次最低价:=REF(本次最低价,X1+1);
Y1:=IF((绿柱面积<0 AND ABS(绿柱面积)<ABS(前次绿柱面积)
AND 本次最低价<前次最低价 ),1,0);
RS1:= MACD3<0 AND REF(MACD3,1)<0 AND C<前次最低价
AND ABS(绿柱面积)<ABS(前次绿柱面积) AND ABS(MACD3)<ABS(REF(MACD3,1));
底背驰:= IF (CROSS(DIFF3,DEA3),REF(Y1,1),0);
DRAWTEXT(底背驰,0.08,'积底背'),COLOR00FFFF;
STICKLINE(底背驰,0,0.08,4,0),COLOR0000FF;
DRAWICON(底背驰,0,23),COLORYELLOW;

X2:=IF (MACD3>0,BARSLAST(CROSS(DEA3,DIFF3)),0);
前次红柱面积:=REF(红柱面积,X2+1);
前次最高价:=REF(本次最高价,X2+1);
Y2:=IF((红柱面积>0 AND 红柱面积<前次红柱面积 AND 本次最高价>前次最高价 ),1,0);
RS2:= MACD3>0 AND REF(MACD3,1)>0 AND C>前次最高价 AND ABS(红柱面积)<ABS(前次红柱面积) AND ABS(MACD3)<ABS(REF(MACD3,1));
顶背驰:= IF (CROSS(DEA3,DIFF3),REF(Y2,1),0);
DRAWICON(顶背驰,0,19),COLOR00FF00;
STICKLINE(顶背驰,0,-0.08,4,0),COLOR00FF00;
DRAWTEXT(顶背驰,-0.08,'积顶背'),COLORFF0000;

股票公式栏目导航

精品指标推荐

最新热门

本类随机推荐

相关公式