股票论坛

 找回密码
 免费注册
搜索
热搜: 活动 交友 discuz
查看: 3506|回复: 6
打印 上一主题 下一主题

请老师帮助。写个MACD的 DIF与DEA金叉时的选股公式,不胜感谢!

[复制链接]

县令

Rank: 2

听众
1
跳转到指定楼层
楼主
发表于 2016-1-1 11:08 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
10爱心果
源码如下:

X_1:=IF(DATE<1191130,1,0);
DIF:IF(X_1=1,MACD.DIF,0),LINETHICK2;
DEA:IF(X_1=1,MACD.DEA,0);
DRAWTEXT_FIX(X_1=0,0,0.01,0,27),COLORMAGENTA;
MACD:(DIF-DEA)*2,COLORSTICK;
DRAWICON(REF(DIF,1)>REF(DIF,2) AND DIF<REF(DIF,1) AND DIF>0 AND DIF>DEA,DIF*1.1,2),COLORGREEN;
DRAWICON(CROSS(DEA,DIF) AND DIF>0,DIF,37),COLORGREEN;
DRAWICON(REF(DIF,1)<REF(DIF,2) AND DIF>REF(DIF,1) AND DIF<0 AND DIF<DEA,DIF*1.1,1),COLORRED;
DRAWICON(CROSS(DIF,DEA) AND DIF<0,DIF,36),COLORRED;
X_2:=BARSLAST(REF(MACD,1)<0 AND MACD>0);
X_3:=LLVBARS(MACD,X_2+20);
X_4:=IF(X_3>X_2,REF(MACD,X_3),0);
X_5:=MACD<0 AND MACD>X_4 AND LOW=LLV(LOW,X_2+20) AND X_4<0;
X_6:=REF(X_5,1)=1 AND MACD>REF(MACD,1) AND REF(DIF,X_3)<0 AND MACD<0;
低背:DRAWLINE(X_4=X_3,MACD,X_6,MACD,0),COLORRED,LINETHICK2;
DRAWICON(X_6,MACD*1.2,26);
X_7:=HHVBARS(MACD,X_2+20);
X_8:=IF(X_7>X_2,REF(MACD,X_7),0);
X_9:=MACD>0 AND MACD<X_8 AND HIGH=HHV(HIGH,X_2+20) AND X_8>0;
X_10:=REF(X_9,1)=1 AND MACD>REF(MACD,1) AND REF(DIF,X_7)>0;
顶背:DRAWLINE(X_8=X_7,MACD,X_10,MACD,0),COLORGREEN,LINETHICK2;
DRAWICON(X_10,MACD*1.2,15);
X_11:=CLOSE/MA(CLOSE,40)*100<78;
X_12:=CLOSE/MA(CLOSE,60)*100<74;
X_13:=HIGH>LOW*1.051;
X_14:=X_13 AND COUNT(X_13,5)>1;
X_15:=IF(X_14 AND (X_11 OR X_12),2,0);
X_16:=CLOSE/REF(CLOSE,25)<=1.1;
X_17:=SMA(MAX(CLOSE-REF(CLOSE,2),0),7,1)/SMA(ABS(CLOSE-REF(CLOSE,2)),7,1)*100<15;
X_18:=(CLOSE-LLV(LOW,8))/(HHV(HIGH,8)-LLV(LOW,8))*100;
X_19:=SMA(X_18,2,1);
X_20:=SMA(X_19,2,1);
X_21:=IF(X_19>REF(X_19,1) AND REF(X_19,1)<REF(X_19,2) AND X_19<23,1.5,0);
抄底:X_16 AND X_15 AND X_17 AND X_21 AND X_1=1,COLORWHITE;
X_22:=100-100*(HHV(HIGH,5*8)-CLOSE)/(HHV(HIGH,5*8)-LLV(LOW,5*8));
X_23:=MA(CLOSE,5);
X_24:=IF(CLOSE>SAR(10,2,20),1,0);
X_25:=IF(CLOSE<SAR(10,2,20),(-1),0);
X_26:=ATAN((X_23/REF(X_23,1)-1)*100)*180/3.1416;
X_27:=IF(X_26>30,1,0);
X_28:=IF(X_26<(-30),(-1),0);
X_29:=X_24+X_27+X_25+X_28;
IF(X_29<(-1) OR X_22<25.01,DIF,DRAWNULL),COLORGREEN,LINETHICK2;
IF(X_22>74.989998 OR X_29>0,DIF,DRAWNULL),COLORRED,LINETHICK2;

爵★★★

Rank: 21Rank: 21Rank: 21Rank: 21Rank: 21Rank: 21

听众
5
沙发
发表于 2016-1-2 15:00 | 只看该作者
通达信未通过
回复

使用道具 举报

县令

Rank: 2

听众
1
板凳
 楼主| 发表于 2016-1-2 16:52 | 只看该作者
我这里使用正常啊朝阳老师
回复

使用道具 举报

县令

Rank: 2

听众
1
地板
 楼主| 发表于 2016-1-2 16:54 | 只看该作者
老师请看

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有帐号?免费注册

x
回复

使用道具 举报

县令

Rank: 2

听众
1
5#
 楼主| 发表于 2016-1-2 23:20 | 只看该作者
重发一遍源码,请老师再试一下

X_1:=IF(DATE<1191130,1,0);
DIF:IF(X_1=1,MACD.DIF,0),LINETHICK2;
DEA:IF(X_1=1,MACD.DEA,0);
DRAWTEXT_FIX(X_1=0,0,0.01,0,27),COLORMAGENTA;
MACD:(DIF-DEA)*2,COLORSTICK;
DRAWICON(REF(DIF,1)>REF(DIF,2) AND DIF<REF(DIF,1) AND DIF>0 AND DIF>DEA,DIF*1.1,2),COLORGREEN;
DRAWICON(CROSS(DEA,DIF) AND DIF>0,DIF,37),COLORGREEN;
DRAWICON(REF(DIF,1)<REF(DIF,2) AND DIF>REF(DIF,1) AND DIF<0 AND DIF<DEA,DIF*1.1,1),COLORRED;
DRAWICON(CROSS(DIF,DEA) AND DIF<0,DIF,36),COLORRED;
X_2:=BARSLAST(REF(MACD,1)<0 AND MACD>0);
X_3:=LLVBARS(MACD,X_2+20);
X_4:=IF(X_3>X_2,REF(MACD,X_3),0);
X_5:=MACD<0 AND MACD>X_4 AND LOW=LLV(LOW,X_2+20) AND X_4<0;
X_6:=REF(X_5,1)=1 AND MACD>REF(MACD,1) AND REF(DIF,X_3)<0 AND MACD<0;
低背:DRAWLINE(X_4=X_3,MACD,X_6,MACD,0),COLORRED,LINETHICK2;
DRAWICON(X_6,MACD*1.2,26);
X_7:=HHVBARS(MACD,X_2+20);
X_8:=IF(X_7>X_2,REF(MACD,X_7),0);
X_9:=MACD>0 AND MACD<X_8 AND HIGH=HHV(HIGH,X_2+20) AND X_8>0;
X_10:=REF(X_9,1)=1 AND MACD>REF(MACD,1) AND REF(DIF,X_7)>0;
顶背:DRAWLINE(X_8=X_7,MACD,X_10,MACD,0),COLORGREEN,LINETHICK2;
DRAWICON(X_10,MACD*1.2,15);
X_11:=CLOSE/MA(CLOSE,40)*100<78;
X_12:=CLOSE/MA(CLOSE,60)*100<74;
X_13:=HIGH>LOW*1.051;
X_14:=X_13 AND COUNT(X_13,5)>1;
X_15:=IF(X_14 AND (X_11 OR X_12),2,0);
X_16:=CLOSE/REF(CLOSE,25)<=1.1;
X_17:=SMA(MAX(CLOSE-REF(CLOSE,2),0),7,1)/SMA(ABS(CLOSE-REF(CLOSE,2)),7,1)*100<15;
X_18:=(CLOSE-LLV(LOW,8))/(HHV(HIGH,8)-LLV(LOW,8))*100;
X_19:=SMA(X_18,2,1);
X_20:=SMA(X_19,2,1);
X_21:=IF(X_19>REF(X_19,1) AND REF(X_19,1)<REF(X_19,2) AND X_19<23,1.5,0);
抄底:X_16 AND X_15 AND X_17 AND X_21 AND X_1=1,COLORWHITE;
X_22:=100-100*(HHV(HIGH,5*8)-CLOSE)/(HHV(HIGH,5*8)-LLV(LOW,5*8));
X_23:=MA(CLOSE,5);
X_24:=IF(CLOSE>SAR(10,2,20),1,0);
X_25:=IF(CLOSE<SAR(10,2,20),(-1),0);
X_26:=ATAN((X_23/REF(X_23,1)-1)*100)*180/3.1416;
X_27:=IF(X_26>30,1,0);
X_28:=IF(X_26<(-30),(-1),0);
X_29:=X_24+X_27+X_25+X_28;
IF(X_29<(-1) OR X_22<25.01,DIF,DRAWNULL),COLORGREEN,LINETHICK2;
IF(X_22>74.989998 OR X_29>0,DIF,DRAWNULL),COLORRED,LINETHICK2;
回复

使用道具 举报

爵★★★

Rank: 21Rank: 21Rank: 21Rank: 21Rank: 21Rank: 21

听众
5
6#
发表于 2016-1-4 22:06 | 只看该作者
X_1:=IF(DATE<1191130,1,0);
DIF:=IF(X_1=1,MACD.DIF,0);
DEA:=IF(X_1=1,MACD.DEA,0);
MACD:=(DIF-DEA)*2;
XG:CROSS(MACD,0);
回复

使用道具 举报

指标研习组

Rank: 11Rank: 11Rank: 11Rank: 11

听众
1
7#
发表于 2016-1-20 22:18 | 只看该作者
我的更高效,专门选MACD强势股源码:
{MACD强势区域金叉}
A:="macd.diff#day">0;
b:="macd.dea#day">0;
macd金叉:=cross(a,b)
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 免费注册

本版积分规则

QQ|站点首页|手机版|小黑屋|帮助中心|桂ICP备14001964号

GMT+8, 2024-11-24 06:42 , Processed in 0.145764 second(s), 19 queries .

Powered by Discuz! X3.2

© 2001-2013 Comsenz Inc.

快速回复 返回顶部 返回列表