求助求助\~~~~
求助求助\~~~~大家好,本人学习外汇交易不旧,最近迷上MT4编写指标,相信大家对均线交易系统了如指掌了,以前一直是用招商银行的外汇软件看盘,设置均线交易系统,最近小弟模仿别人写的均线交易系统在MT4使用,发现大致的设置参数跟之前招商的一样,但是两个软件给出的信号位置却有不同,以下是小弟写的均线系统:
//+------------------------------------------------------------------+
//| Copyright ?2008, [email protected]
//| http://www.alpari.cn
| //+------------------------------------------------------------------+ #property copyright "[email protected]
" #property link "www.alpari.cn
" #property indicator_chart_window #property indicator_buffers 2 #property indicator_color1 Blue #property indicator_color2 Red //---- buffers double buy,sell; extern int fast=5; extern int slow=10; double LastAlertTime=0; //+------------------------------------------------------------------+ //| Custom indicator initialization function | //+------------------------------------------------------------------+ int init() { //---- indicators SetIndexStyle(0,DRAW_ARROW); SetIndexArrow(0,233); SetIndexBuffer(0,buy); SetIndexEmptyValue(0,0.0); SetIndexStyle(1,DRAW_ARROW); SetIndexArrow(1,234); SetIndexBuffer(1,sell); SetIndexEmptyValue(1,0.0); //---- return(0); } //+------------------------------------------------------------------+ //| Custor indicator deinitialization function | //+------------------------------------------------------------------+ int deinit() { //---- //---- return(0); } //+------------------------------------------------------------------+ //| Custom indicator iteration function | //+------------------------------------------------------------------+ int start() { //---- for (int i=Bars-1;i>=0;i--) { if ( ( iMA(NULL,0,fast,0,MODE_EMA,PRICE_CLOSE,i)iMA(NULL,0,slow,0,MODE_EMA,PRICE_CLOSE,i+1)
)
)
{
sell=High+2*Point;
if (i==1 && LastAlertTime!=Time[0])
{
Alert("Negative Cross");
LastAlertTime=Time[0];
}
}
if
(
(
iMA(NULL,0,fast,0,MODE_EMA,PRICE_CLOSE,i)>iMA(NULL,0,slow,0,MODE_EMA,PRICE_CLOSE,i)
&& iMA(NULL,0,fast,0,MODE_EMA,PRICE_CLOSE,i+1)2.GIF1.GIF
//| http://www.alpari.cn
| //+------------------------------------------------------------------+ #property copyright "[email protected]
" #property link "www.alpari.cn
" #property indicator_chart_window #property indicator_buffers 2 #property indicator_color1 Blue #property indicator_color2 Red //---- buffers double buy,sell; extern int fast=5; extern int slow=10; double LastAlertTime=0; //+------------------------------------------------------------------+ //| Custom indicator initialization function | //+------------------------------------------------------------------+ int init() { //---- indicators SetIndexStyle(0,DRAW_ARROW); SetIndexArrow(0,233); SetIndexBuffer(0,buy); SetIndexEmptyValue(0,0.0); SetIndexStyle(1,DRAW_ARROW); SetIndexArrow(1,234); SetIndexBuffer(1,sell); SetIndexEmptyValue(1,0.0); //---- return(0); } //+------------------------------------------------------------------+ //| Custor indicator deinitialization function | //+------------------------------------------------------------------+ int deinit() { //---- //---- return(0); } //+------------------------------------------------------------------+ //| Custom indicator iteration function | //+------------------------------------------------------------------+ int start() { //---- for (int i=Bars-1;i>=0;i--) { if ( ( iMA(NULL,0,fast,0,MODE_EMA,PRICE_CLOSE,i)
发表于:2008-06-16 15:47只看该作者
2楼
这是因为所采用的均线模式不同所引起的SMA.gifEMA.gif
3楼
哦,谢谢啊!那我把公式里的EMA换成SMA就OK了吗?我试了一下还是不行哦,究竟还要改哪里?
韬客社区www.talkfx.co
4楼
哦,搞好了谢谢踏浪大哥啊!!
还有个问题请教,请问如何搞成有声音提示呢?
韬客社区www.talkfx.co
发表于:2008-06-17 09:57只看该作者
5楼
用 Alert() 或 PlaySound()函数就有声音提示了