论坛全局菜单下方 - TICKMILL 285X70论坛全局菜单下方 - ThinkMarkets285X70论坛全局菜单下方 - 荔枝返现285X70论坛全局菜单下方 -  icmarkets285X70
  • 1
  • 2
前往
共 29 条
查看:6980回复:28
wyf51888
注册时间2004-05-26
求: ma10的穿越预警
楼主发表于:2005-09-05 08:13只看该作者倒序浏览
1楼 电梯直达
电梯直达
哪位高手帮帮我啊. 想编个指标: 显示ma10; 收盘价穿越ma10后, 报警. 这么简单的改造, 我学了一整天MQL, 最后以晕菜告终......
TK29帖子1楼右侧xm竖版广告90-240
个性签名

韬客外汇论坛TALKFOREX.COM

广告
TK30+TK31帖子一樓廣告
TK30+TK31帖子一樓廣告
wyf51888
注册时间2004-05-26
楼主发表于:2005-09-06 02:36只看该作者
2楼
奇怪: 编辑公式后, 通过了compile, 然后呢? 在MT中找不到这个公式啊??????
wyf51888
注册时间2004-05-26
楼主发表于:2005-09-06 02:36只看该作者
3楼
另外, 搞不清expert和indicator的区别
老正
注册时间2003-09-21
365热心助人奖
发表于:2005-09-06 06:30只看该作者
4楼
哪个版本的mt?" expert 智能系统 indicator 指标 我不会编写。。。只能帮你这些。。。。。
wyf51888
注册时间2004-05-26
楼主发表于:2005-09-06 06:33只看该作者
5楼
我编了个试验品. 是indicator. 实际测试, 发现公式中的ma(13)的值和真正的ma(13)差不少. 大家帮我看看. 指标如下: //+------------------------------------------------------------------+ //| Custom Moving Average.mq4 | //| Copyright ?2004, MetaQuotes Software Corp. | //| http://www.metaquotes.net/ | //+------------------------------------------------------------------+ #property copyright "Copyright ?2004, MetaQuotes Software Corp." #property link "http://www.metaquotes.net/" #property indicator_chart_window #property indicator_buffers 1 #property indicator_color1 Red //---- indicator parameters extern int MA_Period=13; extern int MA_Shift=0; extern int MA_Method=0; double MaCurrent,MaPrevious; //---- indicator buffers double ExtMapBuffer; //---- int ExtCountedBars=0; //+------------------------------------------------------------------+ //| Custom indicator initialization function | //+------------------------------------------------------------------+ int init() { int draw_begin; string short_name; //---- drawing settings SetIndexStyle(0,DRAW_LINE); SetIndexShift(0,MA_Shift); IndicatorDigits(MarketInfo(Symbol(),MODE_DIGITS)); if(MA_Period<2) MA_Period=10; draw_begin=MA_Period-1; //---- indicator short name switch(MA_Method) { case 1 : short_name="EMA("; draw_begin=0; break; case 2 : short_name="SMMA("; break; case 3 : short_name="LWMA("; break; default : MA_Method=0; short_name="SMA("; } IndicatorShortName(short_name+MA_Period+")"); SetIndexDrawBegin(0,draw_begin); //---- indicator buffers mapping SetIndexBuffer(0,ExtMapBuffer); //---- initialization done return(0); } //+------------------------------------------------------------------+ //| | //+------------------------------------------------------------------+ int start() { if(Bars<=MA_Period) return(0); ExtCountedBars=IndicatorCounted(); //---- check for possible errors if (ExtCountedBars<0) return(-1); //---- last counted bar will be recounted if (ExtCountedBars>0) ExtCountedBars--; //----data MaCurrent=iMA(NULL,0,MA_Period,0,MODE_SMA,PRICE_CLOSE,0); MaPrevious=iMA(NULL,0,MA_Period,0,MODE_SMA,PRICE_CLOSE,1); //----up cross if (Close[1]<=MaPrevious && Close[0]>MaCurrent) { Alert("Already crossed. close price at: ", Close[0],"!!!"); } //----done return(0); }
个性签名

韬客外汇论坛TALKFOREX.COM

北客
注册时间2005-01-26
发表于:2005-09-08 14:53只看该作者
6楼
选项为0的话 为sma也就是普通的ma 如果是其他 那就不是简单ma 了,楼主要分清
wyf51888
注册时间2004-05-26
楼主发表于:2005-09-09 03:08只看该作者
7楼
对啊. 这一段我看懂了. 我要的就是最简单的Simple Moving Average 北客是否会公式编程啊? 能否教教我? 感觉就是缺乏一下基本的说明, 这个编程才特别难学. 例如: symbol() , tick, ticket 到底是什么意思? indicator中, 什么命令是"画线"? 就想分析家公式中, ":"是画线, ":="则是一般赋值. .....
楚天
注册时间2005-07-29
发表于:2005-09-09 04:43只看该作者
8楼
没那么麻烦的。 送给你一套我自己编的三件套 ;) Alert_Method 设置1,2,3 分别为 穿越指定价格报警,穿越ma均线报警,macd双线交叉报警。 你应该仔细看看函数说明,在共享里有下载。MQ4不算难,但也不是一天两天就能完全掌握的。 //+------------------------------------------------------------------+ //| 2.mq4 | //| Copyright ?2005, MetaQuotes Software Corp. | //| http://www.metaquotes.net | //+------------------------------------------------------------------+ #property copyright "Copyright ?2005, MetaQuotes Software Corp." #property link "http://www.metaquotes.net" #property indicator_chart_window #property indicator_buffers 2 #property indicator_color1 Blue #property indicator_color2 Green extern int Alert_Method = 2; //可选1,2,3 extern double Alert_Price_Hi = 0; //上方穿越价格报警价格 extern double Alert_Price_Lo = 0;//下方穿越报警价格 extern int Price_Min = 0;//报价周期 extern int Price_Period = 0;//ma周期 extern int Price_Shift = 0; extern int Fast = 12; extern int Slow = 26; extern int Signal = 9; double up,down; double LastAlertTime = 0; //+------------------------------------------------------------------+ //| Custom indicator initialization function | //+------------------------------------------------------------------+ int init() { //---- indicators SetIndexStyle(0,DRAW_ARROW); SetIndexArrow(0,236); SetIndexBuffer(0,up); SetIndexEmptyValue(0,0.0); SetIndexStyle(1,DRAW_ARROW); SetIndexArrow(1,238); SetIndexBuffer(1,down); SetIndexEmptyValue(1,0.0); IndicatorDigits(2); //---- return(0); } //+------------------------------------------------------------------+ //| Custor indicator deinitialization function | //+------------------------------------------------------------------+ int deinit() { //---- //---- return(0); } //+------------------------------------------------------------------+ //| Custom indicator iteration function | //+------------------------------------------------------------------+ int start() { //---- switch (Alert_Method) { case 1 : Alert_Start1(); break; case 2 : Alert_Start2(); break; case 3 : Alert_Start3(); break; default:break; } return(0); } //+------------------------------------------------------------------+ //| Alert_start1 function for pirce Alert | //+------------------------------------------------------------------+ void Alert_Start1() { if (Close[0] > Alert_Price_Hi && Alert_Price_Hi > 0) { Alert(Symbol()," price : ",Alert_Price_Hi,); Sleep(1000); SpeechText ("Alert , Alert"); } else if (Close[0] < Alert_Price_Lo && Alert_Price_Lo > 0) { Alert(Symbol()," price : ",Alert_Price_Lo ); Sleep(1000); SpeechText ("Alert , Alert"); } } //+------------------------------------------------------------------+ //| Alert_start2 function for Averages Alert | //+------------------------------------------------------------------+ void Alert_Start2() { double Alert_Price = iMA(NULL,Price_Min,Price_Period,0,MODE_SMA,PRICE_CLOSE,Price_Shift); for (int i=Bars-1;i>=0;i--) { if (iClose(NULL,Price_Min,i+Price_Shift+1) >= iMA(NULL,Price_Min,Price_Period,0,MODE_SMA,PRICE_CLOSE,i+Price_Shift+1) && iClose(NULL,Price_Min,i+Price_Shift) < iMA(NULL,Price_Min,Price_Period+1,0,MODE_SMA,PRICE_CLOSE,i+Price_Shift)) { Alert_Price = iMA(NULL,Price_Min,Price_Period,0,MODE_SMA,PRICE_CLOSE,i+Price_Shift); down=Low; if (i == 1 && LastAlertTime!=Time[0]) { Alert(Symbol()," Price down Cross : ",Alert_Price,": M",Price_Min,"(",Price_Period,")"); LastAlertTime=Time[0]; } } else if (iClose(NULL,Price_Min,i+Price_Shift+1) <= iMA(NULL,Price_Min,Price_Period,0,MODE_SMA,PRICE_CLOSE,i+Price_Shift+1) && iClose(NULL,Price_Min,i+Price_Shift) > iMA(NULL,Price_Min,Price_Period+1,0,MODE_SMA,PRICE_CLOSE,i+Price_Shift)) { Alert_Price = iMA(NULL,Price_Min,Price_Period,0,MODE_SMA,PRICE_CLOSE,i+Price_Shift); up=High; if (i == 1 && LastAlertTime!=Time[0]) { Alert(Symbol()," Price up Cross : ",Alert_Price,": M",Price_Min,"(",Price_Period,")"); LastAlertTime=Time[0]; } } } } void Alert_Start3() { int counted_bars=IndicatorCounted(); for(int i=Bars;i>=0;i--) { if ( iMACD(NULL,0,Fast,Slow,Signal,PRICE_CLOSE,MODE_MAIN,i) > iMACD(NULL,0,Fast,Slow,Signal,PRICE_CLOSE,MODE_SIGNAL,i) && iMACD(NULL,0,Fast,Slow,Signal,PRICE_CLOSE,MODE_MAIN,i+1)iMACD(NULL,0,Fast,Slow,Signal,PRICE_CLOSE,MODE_SIGNAL,i+1) ) { if (i == 1 && LastAlertTime!=Time[0]) { Alert(Symbol(),"MACD down cross"); LastAlertTime=Time[0]; } } } } //+------------------------------------------------------------------+ 老兄 疏忽了哈 \\ 应该是 //:handshake [ 本帖最后由 老正 于 2005-9-9 19:29 编辑 ]
个性签名

韬客社区www.talkfx.co

广告
论坛谏言--外汇交易不应是你投资的全部,交易外汇也不应是你生活的全部
wyf51888
注册时间2004-05-26
楼主发表于:2005-09-09 08:06只看该作者
9楼
太感谢了. 仔细学习ing....... 读了教程. (以前没有读全). 仍然不大明白几个词在外汇中的意思: ticket number symbol tick
个性签名

韬客外汇论坛TALKFOREX.COM

fx007
注册时间2004-03-27
发表于:2005-09-09 11:15只看该作者
10楼
楚天 :你编的三件套贴在哪呀 我贴完了好象有问题,你帮看看mt44.pngmt44.png
老正
注册时间2003-09-21
365热心助人奖
发表于:2005-09-09 11:27只看该作者
11楼
。。。。。。那个老大的 / 线方向反了。。。。。。。
个性签名

遇到矛盾 先站在对方的立场上想想问题,先试着去理解别人
如何使用WinMTR查询平台连接流畅度

fx007
注册时间2004-03-27
发表于:2005-09-09 14:51只看该作者
12楼
原帖由 老正 于 2005-9-9 19:27 发表 。。。。。。那个老大的 / 线方向反了。。。。。。。
咋改呀,我不懂
楚天
注册时间2005-07-29
发表于:2005-09-12 03:45只看该作者
13楼
哈哈,那是我临时加上的,给wyf看的 [ 本帖最后由 楚天 于 2005-9-12 11:54 编辑 ]
楚天
注册时间2005-07-29
发表于:2005-09-12 03:54只看该作者
14楼
原帖由 楚天 于 2005-9-12 11:45 发表 哈哈,那是我临时加上的,给wyf看的
楚天
注册时间2005-07-29
发表于:2005-09-12 04:06只看该作者
15楼
string Symbol() 币种 Returns a text string with the name of the current financial instrument. tick不是专有变量、函数 int GetTickCount( ) 返回系统开始运行到当前时刻的毫秒时间。 The GetTickCount() function retrieves the number of milliseconds that have elapsed since the system was started. It is limited to the resolution of the system timer. ticket 也不是 int OrderTicket( ) Returns ticket number for the currently selected order. 一般做开仓单量用的 [ 本帖最后由 楚天 于 2005-9-12 12:07 编辑 ]
happy88888
注册时间2005-05-20
发表于:2005-09-22 02:45只看该作者
16楼
偶不明白,参数该如何设置,
个性签名




广告
论坛谏言--外汇交易不应是你投资的全部,交易外汇也不应是你生活的全部
步步
注册时间2005-10-09
发表于:2005-10-10 01:29只看该作者
17楼
原帖由 楚天 于 2005-9-9 12:43 发表 没那么麻烦的。 送给你一套我自己编的三件套 ;) Alert_Method 设置1,2,3 分别为 穿越指定价格报警,穿越ma均线报警,macd双线交叉报警。 你应该仔细看看函数说明,在共享里有下载。MQ4不算难,但也不 ...
请问macd时间参数如何确定呢?比如小时图,程序里在哪改阿?
wangwu
注册时间2005-05-21
发表于:2006-03-24 06:05只看该作者
18楼
这个指标怎么装上后没反映啊? 那位老兄帮帮忙啊 我想穿3天最高价的均线,咋弄啊? 谢谢了
wangwu
注册时间2005-05-21
发表于:2006-03-28 05:09只看该作者
19楼
这个三件套是指标还是智能交易系统啊? 我弄咋不行呢?
个性签名

你的头脑是牢笼会要你的命,是一种奴役   

广告
论坛谏言--外汇交易不应是你投资的全部,交易外汇也不应是你生活的全部
55555
注册时间2004-11-17
365
发表于:2006-06-27 16:31只看该作者
20楼
这个指标怎么装上后没反映啊? 那位老兄帮帮忙啊 我想穿3天最高价的均线,咋弄啊? 谢谢了
  • 1
  • 2
前往
共 29 条

本站免责声明:

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

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

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

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

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

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