论坛全局菜单下方 - TICKMILL 285X70论坛全局菜单下方 - ThinkMarkets285X70论坛全局菜单下方 - 荔枝返现285X70论坛全局菜单下方 -  icmarkets285X70
查看:4228回复:10
风精灵
注册时间2005-08-21
求助,请帮忙在这条均线上加上报警
楼主发表于:2008-02-19 06:52只看该作者倒序浏览
1楼 电梯直达
电梯直达
这是一条变色均线,希望各位大哥帮忙加个k现触碰到能报警,并加个标记指示,谢谢!MA_Color.mq4
TK29帖子1楼右侧xm竖版广告90-240
个性签名

请点击这里

广告
TK30+TK31帖子一樓廣告
TK30+TK31帖子一樓廣告
fx007
注册时间2004-03-27
发表于:2008-02-19 15:39只看该作者
2楼
是那均线SMA吗 帖张图吧
风精灵
注册时间2005-08-21
楼主发表于:2008-02-20 16:05只看该作者
3楼
不知道是不是sma均线,我只是觉得这条线可以用得上,就是这条白蓝色的线,感觉不错 [ 本帖最后由 风精灵 于 2008-2-21 00:06 编辑 ]2.jpg2.jpg
个性签名

请点击这里

fx007
注册时间2004-03-27
发表于:2008-02-21 04:34只看该作者
4楼
我看了一下,指标好象是WMA, 我抱歉,我只有SMA的穿越报警,是别人的指标,当然你稍加修改是可以满足你的要求的 其实我觉得如果真的有效就不用等到穿越再作单
fx007
注册时间2004-03-27
发表于:2008-02-21 04:37只看该作者
5楼
//+------------------------------------------------------------------+ //| jump_over_ma.mq4 Ver. 1.1 | //| 偶然帅 | //| [email protected] | //| Feb. 24, 2007 | //| 价格上收于均线上方时发出声音报警信号。下收于均线下方也一样。 | //| Feb. 26, 2007 在图表中显示信号。并提供均线周期等用户可修改的选 | //| 项。升级到1.1版。 | //+------------------------------------------------------------------+ #property copyright "偶然帅" #property indicator_chart_window #property indicator_buffers 2 #property indicator_color1 Blue // 信号的颜色;底为蓝色,顶为红色 #property indicator_color2 Red extern int ma_period = 20; // 均线周期,默认值为20 bar均线 extern bool pop_up_alert = 0; // 弹出窗口报警,默认为关 extern bool sound_alert = 1; // 声音报警,默认为开 //---- buffers double ExtMapBuffer1; // 显示信号用的缓冲区 double ExtMapBuffer2; //+------------------------------------------------------------------+ //| 箭头初始化代码 | //+------------------------------------------------------------------+ int init(){ SetIndexStyle(0,DRAW_ARROW,EMPTY,1); // 信号都用五角星表示 SetIndexBuffer(0,ExtMapBuffer1); SetIndexArrow(0,171); SetIndexStyle(1,DRAW_ARROW,EMPTY,1); SetIndexBuffer(1,ExtMapBuffer2); SetIndexArrow(1,171); return(0); } //+------------------------------------------------------------------+ //| 信号反初始化代码 | //+------------------------------------------------------------------+ int deinit(){ return(0); } //+------------------------------------------------------------------+ //| 计算显示信号的条件 | //+------------------------------------------------------------------+ int start(){ int i, shift; double pos, pos_adjust, ma, prv_ma; pos_adjust = 100*Point; // 根据不同的时间框架确定信号显示的位置。主要是为了美观 if(Period()==1) pos_adjust = 1*Point; if(Period()==5) pos_adjust = 2*Point; if(Period()==15) pos_adjust = 6*Point; if(Period()==30) pos_adjust = 7*Point; if(Period()==60) pos_adjust = 9*Point; if(Period()==240) pos_adjust = 14*Point; if(Period()==1440) pos_adjust = 35*Point; shift=Bars; for(i=shift-2;i>=0;i--){ // 从缓冲区中左起第二个bar开始显示,一直显示到右起第一个bar。 // 右起第一个bar的信号出现后,可能会消失;右起第二个bar以前的信号不变 ExtMapBuffer1=0; ExtMapBuffer2=0; // 使用SMA均线 ma = iMA( NULL, 0, ma_period, 0, MODE_SMA, PRICE_CLOSE, i); prv_ma = iMA( NULL, 0, ma_period, 0, MODE_SMA, PRICE_CLOSE, i+1); if(Close>ma && Close[i+1]prv_ma){ ExtMapBuffer2 = High + pos_adjust; // 做空信号 if(i==0 && pop_up_alert) Alert(Symbol(), ": 价格下收于均线"); if(i==0 && sound_alert) PlaySound("wait"); } } // end of for(i=0 return(0); } //+------------------------------------------------------------------+
个性签名

韬客社区www.talkfx.co

广告
论坛谏言--外汇交易不应是你投资的全部,交易外汇也不应是你生活的全部
风精灵
注册时间2005-08-21
楼主发表于:2008-03-04 05:28只看该作者
6楼
谢谢007的帮忙,可是这个不合用,谢谢,继续等
fx007
注册时间2004-03-27
发表于:2008-03-04 10:22只看该作者
7楼
原帖由 风精灵 于 2008-3-4 13:28 发表 http://www.talkforex.com/images/common/back.gif 谢谢007的帮忙,可是这个不合用,谢谢,继续等
你把代码中的SMA改为WMA应该可以吧
秃鹫
注册时间2007-05-25
发表于:2008-03-04 12:17只看该作者
8楼
对源码作了适当修改,以提高程序可读性,并增加了报警语句,就是语句最后面这一段 if(mark!=1 && iClose(NULL,0,0)>ExtMapBuffer[0]) {Alert(Symbol(),"位于变色线上方"); mark=1;} if(mark!=2 && iClose(NULL,0,0)[email protected]>, ?? ??????? ForexMagazine #104 //| [email protected] //| Revised by IgorAD,[email protected] | //| //| Personalized by iGoR for the Trend Slope Trading method (T_S_T) //| Link: http://www.strategybuilderfx.com/forums/showthread.php?t=16507 //| contact: [email protected] //+------------------------------------------------------------------+ #property copyright "MT4 release WizardSerg <[email protected]>, ?? ??????? ForexMagazine #104" #property link "[email protected]" #property indicator_chart_window #property indicator_buffers 2 #property indicator_color1 Lime #property indicator_color2 Red extern int period=15; extern int method=3; // MODE_SMA extern int price=0; // PRICE_CLOSE double Uptrend; //上行数组 double nptrend; //下行数组 double ExtMapBuffer; int mark=0; int init() { IndicatorBuffers(3); SetIndexBuffer(0, Uptrend); SetIndexBuffer(1, nptrend); SetIndexBuffer(2, ExtMapBuffer); ArraySetAsSeries(ExtMapBuffer, true); SetIndexStyle(0,DRAW_LINE,STYLE_SOLID,2); SetIndexStyle(1,DRAW_LINE,STYLE_SOLID,2); IndicatorShortName("MegaTrend("+period+")"); return(0); } double WMA(int x, int p) { return(iMA(NULL, 0, p, 0, method, price, x)); } int start() { int counted_bars = IndicatorCounted(); if(counted_bars < 0) return(-1); int x = 0; int p = MathSqrt(period); int e = Bars - counted_bars + period + 1; double vect, trend; if(e > Bars) e = Bars; ArrayResize(vect, e); ArraySetAsSeries(vect, true); ArrayResize(trend, e); ArraySetAsSeries(trend, true); for(x = 0; x < e; x++) { vect[x] = 2*WMA(x, period/2) - WMA(x, period); } for(x = 0; x < e-period; x++) ExtMapBuffer[x] = iMAOnArray(vect, 0, p, 0, method, x); for(x = e-period; x >= 0; x--) { if (ExtMapBuffer[x]> ExtMapBuffer[x+1]) //指标线上行 { Uptrend[x] = ExtMapBuffer[x]; Uptrend[x+1]=ExtMapBuffer[x+1]; nptrend[x] = EMPTY_VALUE; //下行线赋空值 } else if(ExtMapBuffer[x]< ExtMapBuffer[x+1]) //指标线下行 { nptrend[x] = ExtMapBuffer[x]; nptrend[x+1]=ExtMapBuffer[x+1]; Uptrend[x] = EMPTY_VALUE; //上行线赋空值 } } if(mark!=1 && iClose(NULL,0,0)>ExtMapBuffer[0]) {Alert(Symbol(),"位于变色线上方"); mark=1;} if(mark!=2 && iClose(NULL,0,0)
风精灵
注册时间2005-08-21
楼主发表于:2008-03-04 15:45只看该作者
9楼
实在非常非常感谢 秃鹫 老师 您的帮忙,谢谢,千万个谢谢!,我改动了一下报警方式,不敢独享,大家试用一下吧,好用的。 //+------------------------------------------------------------------+ //| MegaTrend HMA.mq4 //| Copyright ?2006 WizardSerg <[email protected]>, ?? ??????? ForexMagazine #104 //| [email protected] //| Revised by IgorAD,[email protected] | //| //| Personalized by iGoR for the Trend Slope Trading method (T_S_T) //| Link: http://www.strategybuilderfx.com/forums/showthread.php?t=16507 //| contact: [email protected] //+------------------------------------------------------------------+ #property copyright "MT4 release WizardSerg <[email protected]>, ?? ??????? ForexMagazine #104" #property link "[email protected]" #property indicator_chart_window #property indicator_buffers 2 #property indicator_color1 Lime #property indicator_color2 Red extern int period=15; extern int method=3; // MODE_SMA extern int price=0; // PRICE_CLOSE extern bool VoiceAlert = false; extern bool email = false; double Uptrend; //上行数组 double nptrend; //下行数组 double ExtMapBuffer; int alert; int init() { IndicatorBuffers(3); SetIndexBuffer(0, Uptrend); SetIndexBuffer(1, nptrend); SetIndexBuffer(2, ExtMapBuffer); ArraySetAsSeries(ExtMapBuffer, true); SetIndexStyle(0,DRAW_LINE,STYLE_SOLID,2); SetIndexStyle(1,DRAW_LINE,STYLE_SOLID,2); IndicatorShortName("MegaTrend("+period+")"); return(0); } double WMA(int x, int p) { return(iMA(NULL, 0, p, 0, method, price, x)); } int start() { int counted_bars = IndicatorCounted(); if(counted_bars < 0) return(-1); int x = 0; int p = MathSqrt(period); int e = Bars - counted_bars + period + 1; double vect, trend; if(e > Bars) e = Bars; ArrayResize(vect, e); ArraySetAsSeries(vect, true); ArrayResize(trend, e); ArraySetAsSeries(trend, true); for(x = 0; x < e; x++) { vect[x] = 2*WMA(x, period/2) - WMA(x, period); } for(x = 0; x < e-period; x++) ExtMapBuffer[x] = iMAOnArray(vect, 0, p, 0, method, x); for(x = e-period; x >= 0; x--) { if (ExtMapBuffer[x]> ExtMapBuffer[x+1]) //指标线上行 { Uptrend[x] = ExtMapBuffer[x]; Uptrend[x+1]=ExtMapBuffer[x+1]; nptrend[x] = EMPTY_VALUE; //下行线赋空值 } else if(ExtMapBuffer[x]< ExtMapBuffer[x+1]) //指标线下行 { nptrend[x] = ExtMapBuffer[x]; nptrend[x+1]=ExtMapBuffer[x+1]; Uptrend[x] = EMPTY_VALUE; //上行线赋空值 } } if(alert!=1 && Close[0]>ExtMapBuffer[0] && Close[0]ExtMapBuffer[0]-10*Point && Close[1]>ExtMapBuffer[0]) { if (VoiceAlert==true) {Alert(Symbol()+Period(),"下穿变色均线"); alert=2;} if (email==true) {SendMail(Symbol()+Period()+"****现价 :"+Close[0],"下穿变色均线"+"风精灵 , 祝你好运!");alert=2; } } return(0); } //+------------------------------------------------------------------+ [ 本帖最后由 风精灵 于 2008-3-4 23:49 编辑 ]
adk990
注册时间2006-03-08
发表于:2009-03-26 16:41只看该作者
10楼
没有钱了,灌个水
xnova
注册时间2007-01-27
发表于:2009-04-25 16:17只看该作者
11楼
能不能改成均线交叉报警?

本站免责声明:

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

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

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

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

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

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