price alart in fast moves

 

Hi

This indicator often does not work if the price move is too fast. Is there a way to fix it?


thx


//+------------------------------------------------------------------+
//| HLine Alert.mq4 |
//+------------------------------------------------------------------+
#property copyright "raff1410@o2.pl"

#property indicator_chart_window
extern string TLineName="TrendLineFallingAlert";
extern color LineColor=Red;
extern int LineStyle=STYLE_SOLID;
extern int LineWidth=2;
extern int AlertPipRange=2;
extern string AlertWav="falling-price-alert.wav";
// extern bool EmailON=false;


//+------------------------------------------------------------------+
//| Custom indicator initialization function |
//+------------------------------------------------------------------+
int init()
{
//---- indicators
//----
return(0);
}
//+------------------------------------------------------------------+
//| Custom indicator deinitialization function |
//+------------------------------------------------------------------+
int deinit()
{
//----

//----
return(0);
}
//+------------------------------------------------------------------+
//| Custom indicator iteration function |
//+------------------------------------------------------------------+
int start()
{
double valu = Bid - (10*Point);
ObjectCreate(TLineName, OBJ_TREND, 0, Time[25], valu, Time[0], valu);
ObjectSet(TLineName, OBJPROP_STYLE, LineStyle);
ObjectSet(TLineName, OBJPROP_COLOR, LineColor);
ObjectSet(TLineName, OBJPROP_WIDTH, LineWidth);

double val=ObjectGetValueByShift(TLineName, 0);
if (Bid-AlertPipRange*Point <= val && Bid+AlertPipRange*Point >= val) PlaySound(AlertWav);
// if (EmailON) SendMail("FX Currency Falling Price Alert","FX Currency Falling Price Alert");

//----
//----
return(0);

Reason: