SR_AlertSystemM

Author: Steve Fleming
SR_AlertSystemM

This automated trading tool is designed to monitor specific price boundaries—known as Support and Resistance levels—on a financial chart and notify the user immediately when the market price breaks through them. It acts as a proactive alert system, ensuring that traders do not have to watch the screen constantly to identify key structural shifts in the market.

How the System Functions

1. Automated Level Identification When the tool is first loaded onto your chart, it automatically identifies two critical price points based on the timeframe you select:

  • Resistance: The highest price reached during a specific period.
  • Support: The lowest price reached during that same period. The script then draws these levels clearly on your chart as horizontal lines, making it easy to visualize where the "ceiling" and "floor" of the current market movement are located.

2. Smart Price Monitoring The logic continuously tracks the current market price in real-time. You have the flexibility to choose how the tool defines a "breakout":

  • Live Movement: It can notify you the exact moment the price touches or crosses a line.
  • Confirmed Close: It can be set to wait until a candle has officially closed beyond the line, which helps filter out "fake-outs" where the price briefly touches a level but retreats quickly.

3. Intelligent Alert Management To ensure the tool is useful rather than overwhelming, it includes several management features:

  • Audio Notifications: When a breakout occurs (either above resistance or below support), the system plays a specific sound file to grab your attention.
  • Cool-down Period: The script includes a built-in delay logic. This prevents the alarm from "spamming" you with multiple sounds for every tiny fluctuation; once an alert is triggered, it enforces a short waiting period before it can notify you again.
  • Visual Cleanup: The tool is designed to be tidy; it automatically removes its custom lines from your chart when you turn it off or remove it, keeping your workspace clean.

Summary of Benefits

This script simplifies the monitoring of price action by automating the "watch" process. By identifying key levels and providing audible alerts during breakthroughs, it helps traders react more quickly to significant market changes without needing to manually track every price tick.

Price Data Components
Series array that contains the highest prices of each barSeries array that contains the lowest prices of each barSeries array that contains close prices for each bar
Miscellaneous
It plays sound alerts
17 Views
0 Downloads
0 Favorites
SR_AlertSystemM
//+------------------------------------------------------------------+
//|                                              #SR_AlertSystem.mq4 |
//|                                                    Steve Fleming |
//|                                         http://www.forexarea.com |
//+------------------------------------------------------------------+
#property copyright "Steve Fleming"
#property link      "http://www.forexarea.com"

#property indicator_chart_window
extern int     Timeframe       = 60; // 

extern bool    AlarmOn                 = true; // alarm on or off?
extern bool    SignalOnClose           = false; // if false we will use Bid price to signal piercing of S/R levels
extern string  ResistanceLineName      = "R_Alert"; // name of SR line that will trigger Alarm
extern string  SupportLineName         = "S_Alert"; // name of SR line that will trigger Alarm
extern string  SoundFile               = "alert2.wav"; //"mrplow.wav"; // name of sound file 
extern int     DelayBetweenAlarm       = 10; // 
extern color   SRLineClr               = DarkOrchid;  // color of SR lines
extern int     SRLineWidth             = 2;  // width of SR lines

//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init()
  {
//---- indicators
	if(ObjectFind(ResistanceLineName) != 0){
	  ObjectCreate(ResistanceLineName, OBJ_HLINE, 0, 0,iHigh(NULL,Timeframe, 0));
	  ObjectSet(ResistanceLineName, OBJPROP_COLOR, SRLineClr);
	  ObjectSet(ResistanceLineName, OBJPROP_WIDTH, SRLineWidth);
	  ObjectCreate(SupportLineName, OBJ_HLINE, 0, 0,iLow(NULL,Timeframe, 0));
	  ObjectSet(SupportLineName, OBJPROP_COLOR, SRLineClr);
	  ObjectSet(SupportLineName, OBJPROP_WIDTH, SRLineWidth);
	}
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| Custom indicator deinitialization function                       |
//+------------------------------------------------------------------+
int deinit()
  {
//----
   ObjectDelete(ResistanceLineName);
   ObjectDelete(SupportLineName);
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+
int start()
  {
//----
   if(AlarmOn){
      double PreviousClosePrice = Bid; 
      if(SignalOnClose == true){PreviousClosePrice = iClose(NULL,Timeframe, 1);}
      double ResistancePrice = ObjectGet(ResistanceLineName, OBJPROP_PRICE1);
      double SupportPrice = ObjectGet(SupportLineName, OBJPROP_PRICE1);
      if(PreviousClosePrice > ResistancePrice && ResistancePrice != 0)Alerts(1);
      if(PreviousClosePrice < SupportPrice && SupportPrice != 0)Alerts(2);
   }
//----ho ho ho!!!!
   return(0);
  }
//+------------------------------------------------------------------+

void Alerts(int Direction)
{
   static datetime AlertLastTime = 0;

   if(TimeCurrent() > AlertLastTime ) {
      AlertLastTime = TimeCurrent()+DelayBetweenAlarm;
      PlaySound(SoundFile);
   
   }
}

Comments