MACD平滑(副图 源码)

2011-02-20 11:04:00来源:本站整理浏览:83

MACD平滑

INPUT: LONG(26,20,100),SHORT(12,5,40),M(9,2,60);

DIFF : EMA(CLOSE,SHORT) - EMA(CLOSE,LONG);
DEA  : EMA(DIFF,M);
MACD : 2*(DIFF-DEA);
partline(MACD,MACD>=ref(MACD,1),rgb(255,0,0),MACD<ref(MACD,1),rgb(0,255,0)),linethick2;

FILLRGN(DIFF,DEA,DIFF>DEA,(RGB(255,0,0)));
FILLRGN(DEA,DIFF,DEA>DIFF,(RGB(0,0,255)));

连红:LAST(MACD > 0),LINETHICK0,COLOR0030FF,PRECIS0;{天}
连绿:LAST(MACD < 0),LINETHICK0,COLOR00FF30,PRECIS0;{天};

连红最高价:if(连红=0,0,hhv(HIGH,连红)),LINETHICK0,COLOR0030FF,PRECIS2;
连红最低价:if(连红=0,0,llv(l,连红)),LINETHICK0,COLOR00ff00,PRECIS2;
连红比值:if(0,0,100*(连红最高价-连红最低价)/连红最低价),LINETHICK0,COLOR00ffFF;

连绿最高价:if(连绿=0,0,hhv(HIGH,连绿)),LINETHICK0,COLOR0030FF,PRECIS2;
连绿最低价:if(连绿=0,0,llv(l,连绿)),LINETHICK0,COLOR00ff00,PRECIS2;
连绿比值:if(0,0,100*(连绿最高价-连绿最低价)/连绿最低价),LINETHICK0,COLOR00ffFF;

{红柱图}
STICKLINE(MACD>0,0,MACD,7,0), COLOR000033;
STICKLINE(MACD>0,0,MACD,6,0), COLOR000066;
STICKLINE(MACD>0,0,MACD,5,0), COLOR000088;
STICKLINE(MACD>0,0,MACD,4,0), COLOR0000BB;
STICKLINE(MACD>0,0,MACD,2.5,0), COLOR0000EE;
STICKLINE(MACD>0,0,MACD,1,0), COLOR0033FF;
{绿柱图}
STICKLINE(MACD<0,0,MACD,7,0),COLOR003300;
STICKLINE(MACD<0,0,MACD,6,0),COLOR006600;
STICKLINE(MACD<0,0,MACD,5,0),COLOR008800;
STICKLINE(MACD<0,0,MACD,4,0),COLOR00BB00;
STICKLINE(MACD<0,0,MACD,2.5,0),COLOR00EE00;
STICKLINE(MACD<0,0,MACD,1,0),COLOR00FF00;

股票公式栏目导航

本类热门

相关公式