飞狐特色指标MACD实战原版源码
指标功能:[B]国产软件[/B]
指标类型:简体中文
所需积分:0
推荐星级:
授权方式:共享版
公式大小:2.00 KB
更新时间:2011-01-30 19:32:00
公式简介:
飞狐特色指标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);
MACD2:=(2 * (DIFF - DEA));
DU0:=CROSS(DIFF,0);
UD0:=CROSS(0,DIFF);
TDU0:=BARSLAST(DU0);
TUD0:=BARSLAST(UD0);
DU3:=REF(DU0,1);
UD3:=REF(UD0,1);
TDU3:=BARSLAST(DU3);
TUD3:=BARSLAST(UD3);
UDGLINE:=IF((TDU3 < TUD3),REF(HHV(HIGH,2),TDU3),REF(LLV(LOW,2),TUD3));
JDU0:=(((REF(CLOSE,1) <= REF(UDGLINE,1)) AND (CLOSE > UDGLINE)) AND (TDU0 < TUD0));
JUD0:=(((REF(CLOSE,1) >= REF(UDGLINE,1)) AND (CLOSE < UDGLINE)) AND (TUD0 < TDU0));
JDU1:=(JDU0 AND (COUNT(JDU0,TDU0) = 1));
JUD1:=(JUD0 AND (COUNT(JUD0,TUD0) = 1));
JDU2:=(JDU1 AND (REF(BARSLAST(JUD1),1) < REF(BARSLAST(JDU1),1)));
JUD2:=(JUD1 AND (REF(BARSLAST(JUD1),1) > REF(BARSLAST(JDU1),1)));
JDU3:=(JDU1 AND (REF(BARSLAST(JUD1),1) > REF(BARSLAST(JDU1),1)));
JUD3:=(JUD1 AND (REF(BARSLAST(JUD1),1) < REF(BARSLAST(JDU1),1)));
BSLINE:=IF((BARSLAST(JDU2) < BARSLAST(JUD2)),IF(REF(CROSS(0,MACD2),1),LLV(LOW,2),REF(LLV(LOW,2),BARSLAST(REF(CROSS(0,MACD2),1)))),IF(REF(CROSS(MACD2,0),1),HHV(HIGH,2),REF(HHV(HIGH,2),BARSLAST(REF(CROSS(MACD2,0),1)))));
DRAWICON((JDU1 OR (BARSLAST(JDU1) < BARSLAST(JUD1))),0,10),ALIGN4;
DRAWICON((JUD1 OR (BARSLAST(JDU1) > BARSLAST(JUD1))),0,11),ALIGN5;
STICKLINE((MACD2 >= 0),0,MACD2,6,1),color0000FF;
STICKLINE((MACD2 < 0),0,MACD2,6,0),colorFFFF00;
STICKLINE(((MACD2 >= 0) AND (MACD2 < REF(MACD2,1))),0,MACD2,6,0),COLORRED;
STICKLINE(((MACD2 < 0) AND (MACD2 > REF(MACD2,1))),0,MACD2,6,1),COLORCYAN;
DIF:DIFF,LINETHICK2,colorFFFF;
DEF:DEA,colorFF00;
MACD:MACD2,LINETHICK0,colorFFFF00;
DEFUT:=BARSLAST(CROSS(MACD2,0));
DEFDT:=BARSLAST(CROSS(0,MACD2));
DEFUL:=IF((MACD2 >= 0),HHV(MACD2,(DEFUT + 1)),REF(HHV(MACD2,(DEFUT + 1)),(DEFDT + 1)));
DEFDL:=IF((MACD2 < 0),LLV(MACD2,(DEFDT + 1)),REF(LLV(MACD2,(DEFDT + 1)),(DEFUT + 1)));
DEFU2L:=REF(DEFUL,(DEFUT + 1));
DEFD2L:=REF(DEFDL,(DEFDT + 1));
DRAWICON(((((LLV(MACD2,4) > 0) AND (MACD2 < REF(MACD2,1))) AND (REF(MACD2,1) > REF(MACD2,2))) AND (REF(MACD2,2) > REF(MACD2,3))),MACD2,5),ALIGN0;
DRAWICON(((((HHV(MACD2,4) < 0) AND (MACD2 > REF(MACD2,1))) AND (REF(MACD2,1) < REF(MACD2,2))) AND (REF(MACD2,2) < REF(MACD2,3))),MACD2,4);
DRAWICON(((((JUD1 OR (BARSLAST(JDU1) > BARSLAST(JUD1))) AND (MACD2 >= 0)) AND (REF(MACD2,1) < REF(DEFU2L,1))) AND (MACD2 > DEFU2L)),MACD2,12),ALIGN0;
DRAWICON(((((JDU1 OR (BARSLAST(JDU1) < BARSLAST(JUD1))) AND (MACD2 < 0)) AND (REF(MACD2,1) > REF(DEFD2L,1))) AND (MACD2 < DEFD2L)),MACD2,12);
[url=http://www.goodgupiao.com/gupiaogongshi/11969.html][B]飞狐特色指标MACD实战原版源码[/B][/url]