论坛全局菜单下方 - TICKMILL 285X70论坛全局菜单下方 - ThinkMarkets285X70论坛全局菜单下方 - 荔枝返现285X70论坛全局菜单下方 -  icmarkets285X70
查看:1428回复:0
江恩恩
注册时间2009-11-10
[MT4指标]一个指标报警的问题,请高手给予指教!
楼主发表于:2010-01-06 14:00只看该作者倒序浏览
1楼 电梯直达
电梯直达
想给这个指标增加报警功能,但是在两线粘连的情况下无法正常报警,出现多空同时报警且不能发出声音的情况,请高手给予修改并指教。 要求在两线交叉后的第二根K线时发出报警声音,如果可能的话控制报警次数为5次并发送1次邮件报警。 #property copyright "Copyright ?2006, Hu." #property link "" #property indicator_separate_window #property indicator_buffers 6 #property indicator_color1 Red #property indicator_color2 Green #property indicator_color3 Blue #property indicator_color4 Salmon #property indicator_color5 Yellow #property indicator_color6 White #property indicator_level1 0 #property indicator_level2 10000 extern bool bTrend = FALSE; double g_ibuf_80; double g_ibuf_84; double g_ibuf_88; double g_ibuf_92; double g_ibuf_96; double g_ibuf_10000; extern int EMA_Period1 = 9; extern int EMA_Period2 = 3; extern int EMA_Period3 = 30; extern int EMA_Period4 = 5; extern int SMA_Period1 = 34; extern int SMA_Period2 = 89; extern int LH_Period1 = 34; extern int LH_Period2 = 89; extern int LH_Period3 = 250; extern bool alert_folkupb = FALSE; extern bool alert_folkdwb = FALSE; int gi_114 = 0; int gi_118 = 0; int init() { SetIndexStyle(0, DRAW_LINE); SetIndexBuffer(0, g_ibuf_80); SetIndexLabel(0, "BDC"); SetIndexStyle(1, DRAW_LINE); SetIndexBuffer(1, g_ibuf_84); SetIndexLabel(1, "BDD"); SetIndexStyle(2, DRAW_LINE); SetIndexBuffer(2, g_ibuf_88); SetIndexLabel(2, "BDE"); SetIndexStyle(3, DRAW_LINE); SetIndexBuffer(3, g_ibuf_92); SetIndexLabel(3, "BDF"); SetIndexStyle(4, DRAW_LINE); SetIndexBuffer(4, g_ibuf_96); SetIndexLabel(4, "中期趋势"); SetIndexStyle(5, DRAW_LINE); SetIndexBuffer(5, g_ibuf_10000); SetIndexLabel(5, "长期趋势"); IndicatorShortName("BDQS BDC: BDD: BDE: BDF:" + "中期趋势:kw" + "长期趋势:km" + "风险区:80," + "安全区:20"); return (0); } int deinit() { return (0); } int start() { int l_count_12; double ld_20; double l_low_28; double l_high_36; double ld_92; double ld_10000; double ld_unused_108; int li_0 = IndicatorCounted(); if (li_0 < 0) return (-1); if (li_0 > 0) li_0--; int li_4 = Bars - li_0; double ld_116 = 2.0 / (EMA_Period1 + 1); double ld_124 = 2.0 / (EMA_Period2 + 1); double ld_132 = 2.0 / (EMA_Period3 + 1); double ld_140 = 2.0 / (EMA_Period4 + 1); for (int li_8 = li_4; li_8 >= 0; li_8--) { ld_10000 = 0; ld_unused_108 = 0; ld_20 = (2.0 * Close[li_8] + High[li_8] + Low[li_8]) / 4.0; l_low_28 = Low[iLowest(NULL, 0, MODE_LOW, LH_Period1, li_8)]; l_high_36 = High[iHighest(NULL, 0, MODE_HIGH, LH_Period1, li_8)]; if (l_high_36 - l_low_28 == 0.0) ld_92 = 0; else ld_92 = 10000.0 * ((ld_20 - l_low_28) / (l_high_36 - l_low_28)); if (li_8 == Bars - 2) { ld_20 = (2.0 * (Close[li_8 + 1]) + (High[li_8 + 1]) + (Low[li_8 + 1])) / 4.0; l_low_28 = Low[li_8 + 1]; l_high_36 = High[li_8 + 1]; if (l_high_36 - l_low_28 == 0.0) ld_92 = 0; else ld_92 = 10000.0 * ((ld_20 - l_low_28) / (l_high_36 - l_low_28)); g_ibuf_80[li_8] = ld_92; g_ibuf_88[li_8] = ld_92; g_ibuf_84[li_8] = g_ibuf_80[li_8]; g_ibuf_92[li_8] = ld_92; } else { g_ibuf_80[li_8] = ld_92 * ld_116 + (g_ibuf_80[li_8 + 1]) * (1 - ld_116); g_ibuf_88[li_8] = ld_92 * ld_132 + (g_ibuf_88[li_8 + 1]) * (1 - ld_132); ld_92 = 0.667 * (g_ibuf_80[li_8 + 1]) + 0.333 * g_ibuf_80[li_8]; g_ibuf_84[li_8] = ld_92 * ld_124 + (g_ibuf_84[li_8 + 1]) * (1 - ld_124); g_ibuf_92[li_8] = g_ibuf_88[li_8] * ld_140 + (g_ibuf_92[li_8 + 1]) * (1 - ld_140); } if (bTrend == TRUE) { ld_20 = Close[li_8]; l_low_28 = Low[iLowest(NULL, 0, MODE_LOW, LH_Period2, li_8)]; l_high_36 = High[iHighest(NULL, 0, MODE_HIGH, LH_Period2, li_8)]; if (l_high_36 - l_low_28 == 0.0) ld_92 = 0; else ld_92 = 10000.0 * ((ld_20 - l_low_28) / (l_high_36 - l_low_28)); if (li_8 >= Bars - SMA_Period1) { l_count_12 = 0; for (int li_16 = li_8; l_count_12 < SMA_Period1; li_16++) { ld_20 = Close[li_16]; l_low_28 = Low[iLowest(NULL, 0, MODE_LOW, LH_Period2, li_16)]; l_high_36 = High[iHighest(NULL, 0, MODE_HIGH, LH_Period2, li_16)]; if (l_high_36 - l_low_28 == 0.0) ld_92 = 0; else ld_92 = 10000.0 * ((ld_20 - l_low_28) / (l_high_36 - l_low_28)); ld_10000 += ld_92; g_ibuf_96[li_16] = 0; l_count_12++; } } else ld_10000 = (g_ibuf_96[li_8 + 1]) * (SMA_Period1 - 1) + ld_92; g_ibuf_96[li_8] = ld_10000 / SMA_Period1; ld_20 = Close[li_8]; l_low_28 = Low[iLowest(NULL, 0, MODE_LOW, LH_Period3, li_8)]; l_high_36 = High[iHighest(NULL, 0, MODE_HIGH, LH_Period3, li_8)]; if (l_high_36 - l_low_28 == 0.0) ld_92 = 0; else ld_92 = 10000.0 * ((ld_20 - l_low_28) / (l_high_36 - l_low_28)); if (li_8 >= Bars - SMA_Period2) { l_count_12 = 0; for (li_16 = li_8; l_count_12 < SMA_Period2; li_16++) { ld_20 = Close[li_16]; l_low_28 = Low[iLowest(NULL, 0, MODE_LOW, LH_Period3, li_16)]; l_high_36 = High[iHighest(NULL, 0, MODE_HIGH, LH_Period3, li_16)]; if (l_high_36 - l_low_28 == 0.0) ld_92 = 0; else ld_92 = 10000.0 * ((ld_20 - l_low_28) / (l_high_36 - l_low_28)); ld_10000 += ld_92; g_ibuf_10000[li_16] = 0; l_count_12++; } } else ld_10000 = (g_ibuf_10000[li_8 + 1]) * (SMA_Period2 - 1) + ld_92; g_ibuf_10000[li_8] = ld_10000 / SMA_Period2; } if (g_ibuf_80[li_8+3] < g_ibuf_84[li_8+3] && g_ibuf_80[li_8+2] > g_ibuf_84[li_8+2] && g_ibuf_80[li_8+1] > g_ibuf_84[li_8+1] && gi_114 != 1 && alert_folkdwb == TRUE) { Alert("[" + Symbol() + "][" + Period() + "分钟]zt:BDQ发生金叉!"); gi_114 = 1; } if (g_ibuf_80[li_8+3] > g_ibuf_84[li_8+3] && g_ibuf_80[li_8+2] < g_ibuf_84[li_8+2] && g_ibuf_80[li_8+1] < g_ibuf_84[li_8+1] && gi_114 != 2 && alert_folkupb == TRUE ) { Alert("[" + Symbol() + "][" + Period() + "分钟]zt:BDQ发生死叉!"); gi_114 = 2; } } return (0); } [ 本帖最后由 江恩恩 于 2010-1-6 22:18 编辑 ]QQ截图未命名.jpgQQ截图未命名.jpg
TK29帖子1楼右侧xm竖版广告90-240
个性签名

韬客社区www.talkfx.co

广告
TK30+TK31帖子一樓廣告
TK30+TK31帖子一樓廣告

本站免责声明:

1、本站所有广告及宣传信息均与韬客无关,如需投资请依法自行决定是否投资、斟酌资金安全及交易亏损风险;

2、韬客是独立的、仅为投资者提供交流的平台,网友发布信息不代表韬客的观点与意思表示,所有因网友发布的信息而造成的任何法律后果、风险与责任,均与韬客无关;

3、金融交易存在极高法律风险,未必适合所有投资者,请不要轻信任何高额投资收益的诱导而贸然投资;投资保证金交易导致的损失可能超过您投入的资金和预期。请您考虑自身的投资经验及风险承担能力,进行合法、理性投资;

4、所有投资者的交易帐户应仅限本人使用,不应交由第三方操作,对于任何接受第三方喊单、操盘、理财等操作的投资和交易,由此导致的任何风险、亏损及责任由投资者个人自行承担;

5、韬客不隶属于任何券商平台,亦不受任何第三方控制,韬客不邀约客户投资任何保证金交易,不接触亦不涉及投资者的任何资金及账户信息,不代理任何交易操盘行为,不向客户推荐任何券商平台,亦不存在其他任何推荐行为。投资者应自行选择券商平台,券商平台的任何行为均与韬客无关。投资者注册及使用韬客即表示其接受和认可上述声明,并自行承担法律风险。

版权所有:韬客外汇论坛 www.talkfx.com 联络我们:[email protected]