So I downloaded this indicator called "Spreader" that allows you to set an alert for when the the spread widens past your desired threshold. Problem is, the indicator continues to alert repeatedly after the spread widens. I know a bit of programming from my days in college. I modified the code to include a boolean and an "else" statement, and I thought this should've gotten it to stop alerting, but that hasn't been the case. Here is the code. The custom code I added is in blue.
QuoteDislikedextern int Normal_Spread = 30;
extern bool Play_Sound = true;
extern bool Stop_Alerting = false;
//+------------------------------------------------------------------+
//| Custom indicator initialization function |
//+------------------------------------------------------------------+
int init()
{
//---- indicators
//----
return(0);
}
//+------------------------------------------------------------------+
//| Custom indicator deinitialization function |
//+------------------------------------------------------------------+
int deinit()
{
//----
//----
return(0);
}
//+------------------------------------------------------------------+
//| Custom indicator iteration function |
//+------------------------------------------------------------------+
int start()
{
int counted_bars=IndicatorCounted();
//----
int spread = MarketInfo(Symbol(),MODE_SPREAD);
if(spread > Normal_Spread && Stop_Alerting == false) {
if (Play_Sound = true) PlaySound("alert.wav");
Alert("Larger Spread on "+Symbol()+" "+Hour()+":"+Minute()+":"+Seconds()+" spread "+spread);
Stop_Alerting = true;
}
else Stop_Alerting = false;
//----
return(0);
}