下了个均线交叉带箭头声音报警的指标,可以调均线类型的,本应是不错的东西,但这个声音报警经常响,没交叉都会响,麻烦哪位高手可以改一下本来是提醒作用,现在不停的响,像背景音乐一样,都不知道是谁在响了。
//+------------------------------------------------------------------+
//| 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);
} |