ATM_Pure_RSI_Alert

Download script
Author: Copyright � 2004, MetaQuotes Software Corp.
ATM_Pure_RSI_Alert

This technical tool is designed to monitor market momentum and provide real-time notifications when price action reaches specific "extreme" levels. It uses a mathematical calculation known as the Relative Strength Index (RSI) to identify whether a market is currently overextended in either an upward or downward direction.

Core Functionality

The script functions by tracking the RSI value against two user-defined thresholds:

  • Overbought Level: A high threshold indicating that the market may be temporarily "overheated" or overvalued, potentially signaling a future price correction or sell opportunity.
  • Oversold Level: A low threshold indicating that the market may be "oversold" or undervalued, potentially signaling a future price bounce or buy opportunity.

Notification Logic

The primary purpose of this tool is to alert the trader the exact moment the RSI crosses these thresholds. To ensure the experience is user-friendly and not overwhelming, the script includes several intelligent filtering features:

1. Real-Time Detection The tool constantly monitors the live price feed (ticks). As soon as the indicator moves from a neutral zone into either the overbought or oversold territory, it triggers a notification.

2. Customizable Alerts Users can choose how they wish to receive these notifications via three distinct methods:

  • Visual Alerts: A text pop-up window appears on the trading platform showing the specific time and the symbol name (e.g., "ATM DC Sell Setting Up").
  • Audio Alerts: The system can play a custom sound file (such as a .wav file) to notify the trader without showing a text box.
  • Silent Monitoring: Users can also choose to have the indicator run in the background with no audible or visual interruptions.

3. Frequency Management To prevent "alert fatigue," the script includes a sophisticated counting system:

  • Limit per Bar: You can set a maximum number of alerts allowed during a single price bar (candle). This prevents the system from sending too many notifications if the price flickers rapidly at a boundary.
  • Automatic Reset: The alert counter intelligently resets once the RSI moves back into a "neutral" zone (between the overbought and oversold levels), ensuring that the tool is always ready to notify you of the next significant market shift.

Visual Representation

In addition to alerts, the script creates a dedicated window on your trading platform. It draws three lines:

  • The main RSI line, which shows the current momentum.
  • A horizontal line for the Overbought threshold.
  • A horizontal line for the Oversold threshold.

This allows you to visually confirm why an alert was triggered and see how close the market is to reaching those critical levels.

Indicators Used
Relative strength index
Miscellaneous
Implements a curve of type %1It issuies visual alerts to the screenIt plays sound alerts
11 Views
0 Downloads
0 Favorites
ATM_Pure_RSI_Alert
//+------------------------------------------------------------------+
//|                                         ATM_Pure_RSI_Alertv3.mq4 |
//|                      Copyright © 2004, MetaQuotes Software Corp. |
//|                                       http://www.metaquotes.net/ |
//|  V2 DME 4/29/09  added Sound and Sound File option
//|                  restricted alert or sound playing to one bar duration
//|                  
//|                  Alerts or Sounds once per Tick for one bar when RSI passes into overbought or oversold.
//|  v3 DME 5/4/09   added user option to restrict quantity of alers during one bar.
//|                  Note that if RSI tick by tick goes into oversold and back to non oversold and then
//|                  back into oversold the alert counter gets reset each time so you will hear more alerts
//|                 Show Alert will show text in alert text window and play default standard alert sound
//|                 Play sound will allow user to set a custom wav file however the text alert will not show.
//+------------------------------------------------------------------+
#property copyright "Copyright © 2004, MetaQuotes Software Corp."
#property link      "http://www.metaquotes.net/"

#property indicator_separate_window
#property indicator_minimum 13
#property indicator_maximum 87
#property indicator_buffers 3
#property indicator_color1 DimGray
#property indicator_color2 Black
#property indicator_color3 Black
#property indicator_width1 1
#property indicator_width2 1
#property indicator_width3 1
#property indicator_style1 STYLE_SOLID
#property indicator_style2 STYLE_SOLID
#property indicator_style3 STYLE_SOLID
//---- input parameters
extern int RSIPeriod        = 13;    // 13
extern int ApplyTo          =  0;    //  0
extern int OverBought       = 81;    // 81
extern int OverSold         = 19;    // 19
extern bool Show_Alert      =  TRUE;
extern bool Play_Sound      =  FALSE;
extern string SoundFilename = "alert2.wav";
extern int AlertMaxPerBar   = 8;

int AlertCount;
  
//---- buffers
double RSIBuffer[];
double RSIOBBuffer[];
double RSIOSBuffer[];


//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init()
  {
   string short_name;
  
//---- indicator lines
   SetIndexStyle(0,DRAW_LINE);
   SetIndexBuffer(0,RSIBuffer);
   SetIndexStyle(1,DRAW_LINE);
   SetIndexBuffer(1,RSIOBBuffer);
   SetIndexStyle(2,DRAW_LINE);
   SetIndexBuffer(2,RSIOSBuffer);
//---- name for DataWindow and indicator subwindow label
   short_name="RSI-Alert("+RSIPeriod+")";
   IndicatorShortName(short_name);
   SetIndexLabel(0,short_name);
   SetIndexLabel(1,"OverBought");
   SetIndexLabel(2,"OverSold");
//----
   SetIndexDrawBegin(0,RSIPeriod);
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| Relative Strength Index                                          |
//+------------------------------------------------------------------+
int start()
  {
  
   int    i,counted_bars=IndicatorCounted();
//----
   if(Bars<=RSIPeriod) return(0);
//----
   i=Bars-RSIPeriod-1;
   if(counted_bars>=RSIPeriod) i=Bars-counted_bars-1;
   while(i>=0)
   {
      RSIBuffer[i]=iRSI(NULL,0,RSIPeriod,ApplyTo,i);
      RSIOBBuffer[i]=OverBought;
      RSIOSBuffer[i]=OverSold;
      i--;
   }
   
   if(Show_Alert || Play_Sound)
   {
          
      if(RSIBuffer[1]<OverBought && RSIBuffer[0]>=OverBought && 
         AlertCount < AlertMaxPerBar)
      {   
        if(Show_Alert)   Alert(TimeHour(TimeCurrent()),":",TimeMinute(TimeCurrent()),":",Seconds(),"  ",
                                                Symbol()," ATM DC Sell Setting Up");
        if(Play_Sound)   PlaySound(SoundFilename);
        AlertCount ++;
      }  
         
      else if(RSIBuffer[1]>OverSold && RSIBuffer[0]<=OverSold &&
              AlertCount < AlertMaxPerBar)
      {    
        if(Show_Alert)   Alert(TimeHour(TimeCurrent()),":",TimeMinute(TimeCurrent()),":",Seconds(),"  ",
                                             Symbol()," ATM DC Buy Setting Up");
        if(Play_Sound)   PlaySound(SoundFilename);
        AlertCount ++;
      } 
      else if( RSIBuffer[0]<OverBought &&  RSIBuffer[0]>OverSold)    AlertCount = 0;
        
   }
//----
   return(0);
  }
//+------------------------------------------------------------------+

Comments