23评论

0收藏

请教均线交叉报警问题

avatar www_17il_com | 8973 人阅读 | 23 人评论 | 2011-11-18

下了个均线交叉带箭头声音报警的指标,可以调均线类型的,本应是不错的东西,但这个声音报警经常响,没交叉都会响,麻烦哪位高手可以改一下本来是提醒作用,现在不停的响,像背景音乐一样,都不知道是谁在响了。
  //+------------------------------------------------------------------+
  //|                                         EMA-Crossover_Signal.mq4 |
  //|         Copyright ?2005, Jason Robinson (jnrtrading)            |
  //|                   http://www.jnrtading.co.uk                     |
  //+------------------------------------------------------------------+
  
  /*
    +------------------------------------------------------------------+
    | Allows you to enter two ema periods and it will then show you at |
    | Which point they crossed over. It is more usful on the shorter   |
    | periods that get obscured by the bars / candlesticks and when    |
    | the zoom level is out. Also allows you then to remove the emas   |
    | from the chart. (emas are initially set at 5 and 6)              |
    +------------------------------------------------------------------+
  */   
  #property copyright \"Copyright ?2005, Jason Robinson (jnrtrading)\"
  #property link      \"http://www.jnrtrading.co.uk\"
  
  #property indicator_chart_window
  #property indicator_buffers 2
  #property indicator_color1 LawnGreen
  #property indicator_color2 Red
  
  double CrossUp[];
  double CrossDown[];
  extern int FasterMode =  1; //0=sma, 1=ema, 2=smma, 3=lwma
  extern int FasterMA =    5;
  extern int SlowerMode =  1; //0=sma, 1=ema, 2=smma, 3=lwma
  extern int SlowerMA =    6;
  extern bool VoiceAlert = true;
  //+------------------------------------------------------------------+
  //| Custom indicator initialization function                         |
  //+------------------------------------------------------------------+
  int init()
    {
  //---- indicators
     SetIndexStyle(0, DRAW_ARROW, EMPTY);
     SetIndexArrow(0, 233);
     SetIndexBuffer(0, CrossUp);
     SetIndexStyle(1, DRAW_ARROW, EMPTY);
     SetIndexArrow(1, 234);
     SetIndexBuffer(1, CrossDown);
  //----
     return(0);
    }
  //+------------------------------------------------------------------+
  //| Custom indicator deinitialization function                       |
  //+------------------------------------------------------------------+
  int deinit()
    {
  //----
  
  //----
     return(0);
    }
  //+------------------------------------------------------------------+
  //| Custom indicator iteration function                              |
  //+------------------------------------------------------------------+
  int start() {
     int limit, i, counter;
     double fasterMAnow, slowerMAnow, fasterMAprevious, slowerMAprevious, fasterMAafter, slowerMAafter;
     double Range, AvgRange;
     int counted_bars=IndicatorCounted();
  //---- check for possible errors
     if(counted_bars0) counted_bars--;
  
     limit=Bars-counted_bars;
     
     for(i = 0; i  slowerMAafter))
        {
        
           CrossUp = Low - Range*0.5;
           if (VoiceAlert==true){
              Alert(\"Moving Average has crossed up\");
           }
        }
        else if ((fasterMAnow < slowerMAnow) && (fasterMAprevious > slowerMAprevious) && (fasterMAafter < slowerMAafter)) {
           CrossDown = High + Range*0.5;
           if (VoiceAlert==true){
              Alert(\"Moving Average has crossed down\");
           }
        }
     }
     return(0);
  }
""
还没有人打赏,支持一下

评论|共 23 个

istzq

发表于 2012-11-21 23:00:23 | 显示全部楼层

我该不会是最后一个顶的吧  

妖怪

发表于 2012-11-21 23:00:23 | 显示全部楼层

顶的就是你  

xmuwqh

发表于 2012-11-22 00:05:51 | 显示全部楼层

嘿嘿  

where

发表于 2012-11-22 00:05:51 | 显示全部楼层

厉害!强~~~~没的说了!  

信和赢汇1

发表于 2012-11-22 00:05:51 | 显示全部楼层

围观来了哦  

l26709020

发表于 2012-11-22 00:05:51 | 显示全部楼层

貌似我真的很笨????哎  

路盲

发表于 2012-11-22 00:05:51 | 显示全部楼层

今天再看下  

hvbib

发表于 2012-11-22 00:05:51 | 显示全部楼层

先看看怎么样!  

lramr

发表于 2012-11-22 00:05:51 | 显示全部楼层

我有个群,大家一起来讨论EA.  

123下一页
您需要登录后才可以回帖 登录 | 注册 微信登录

EA之家评论守则