WPRSI_signal(SoundAlarm)

Download script
Author: Copyright � 2004, MetaQuotes Software Corp.
WPRSI_signal(SoundAlarm)

This tool is designed to assist traders by identifying specific momentum shifts in the market using a combination of two primary technical indicators: the Williams Percent Range (WPR) and the Relative Strength Index (RSI). Its main purpose is to spot potential "turning points" where price movement might be reversing, providing visual markers and optional audible alerts to notify the user.

How the Logic Works

The script continuously monitors the market data to find two specific scenarios: a bullish signal (potential for upward movement) and a bearish signal (potential for downward movement). To ensure these signals are reliable, the tool uses a multi-layered verification process:

1. Identifying Bullish Signals (Buy Opportunities)

For a "Long" or "Buy" signal to appear, the script looks for three conditions to meet simultaneously:

  • Momentum Recovery: The Williams Percent Range must cross above the -20 level from below.
  • Strength Confirmation: The RSI must be positioned above the 50 midline, indicating positive momentum.
  • The "Clean Break" Filter: To avoid "false alarms" during choppy market movements, the script looks back at previous price candles. It ensures that the current momentum isn't just a tiny flicker; it verifies that the price has stayed consistently in a specific zone for a set number of previous bars. If it confirms a stable move, it places a blue arrow on the chart and triggers an alert.

2. Identifying Bearish Signals (Sell Opportunities)

Conversely, for a "Short" or "Sell" signal to appear, the script looks for these conditions:

  • Momentum Decline: The Williams Percent Range must cross below the -80 level from above.
  • Weakness Confirmation: The RSI must be positioned below the 50 midline, indicating negative momentum.
  • The "Clean Break" Filter: Similar to the bullish logic, the script double-checks the previous candles to ensure the downward trend is consistent and not just a momentary spike. If confirmed, it places a red arrow on the chart and triggers an alert.

Key Features for the User

  • Visual Mapping: Instead of just giving you a number, the script draws arrows directly on your price chart at the exact moment the logic is triggered, making it easy to see historical signals.
  • Alert System: The tool can be configured to play a sound and display a pop-up notification on your screen (e.g., "Start Long" or "Start Short"), allowing you to react immediately without constantly staring at the screen.
  • Customizable Sensitivity: You can adjust the period lengths for the indicators and the "filter" depth, which allows you to choose between identifying signals faster or waiting for more confirmed, slower movements.
Indicators Used
Relative strength indexLarry William percent range indicator
Miscellaneous
Implements a curve of type %1It plays sound alertsIt issuies visual alerts to the screen
17 Views
0 Downloads
0 Favorites
WPRSI_signal(SoundAlarm)
//+------------------------------------------------------------------+
//|                                       WPRSIsignal(SoundAlarm).mq4|
//|                      Copyright © 2004, MetaQuotes Software Corp. |
//|                                        http://www.metaquotes.net |
//+------------------------------------------------------------------+
#property copyright "Copyright © 2004, MetaQuotes Software Corp."
#property link "http://www.metaquotes.net"


#property indicator_chart_window
#property indicator_buffers 2
#property indicator_color1 DodgerBlue
#property indicator_color2 Red
//---- input parameters
extern int WPRSIperiod=27;
extern int filterUP     =10;
extern int filterDN     =10; 
extern bool UseSound   =false;
//---- buffers
extern string SoundFile  ="Alert.wav";
double ExtMapBuffer1[];
double ExtMapBuffer2[];
double alert;

//----


//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init()
  {
//---- indicators
   SetIndexStyle(0, DRAW_ARROW, 0, 1);
   SetIndexArrow(0, 233);
   SetIndexBuffer(0, ExtMapBuffer1);
//----
   SetIndexStyle(1, DRAW_ARROW, 0, 1);
   SetIndexArrow(1, 234);
   SetIndexBuffer(1, ExtMapBuffer2);
//---- name for DataWindow and indicator subwindow label
   IndicatorShortName("WPRSI");
   SetIndexLabel(0, "wprsiUP" + WPRSIperiod + "");
   SetIndexLabel(1, "wprsiDN" + WPRSIperiod + "");
//----
  
   return(0);
  }
//+------------------------------------------------------------------+
//| Custor indicator deinitialization function                       |
//+------------------------------------------------------------------+
int deinit()
  {
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+
int start()
  {
   int limit;
   int counted_bars=IndicatorCounted();
//---- check for possible errors
   if(counted_bars < 0)
      return(-1);
//---- last counted bar will be recounted
   if(counted_bars > 0)
      counted_bars--;
   limit=Bars - counted_bars;
//----
   for(int i=1; i < limit; i++)
     {
   
      //----
      if( (iWPR(NULL,0,WPRSIperiod,i)>-20)&&(iWPR(NULL,0,WPRSIperiod,i+1)<-20)&&(iRSI(NULL,0,WPRSIperiod,PRICE_MEDIAN,i)>50)           )
         {
         double z=0;
         for(int k=2;k<=filterUP+2;k++)
         {
         
         if(iWPR(NULL,0,WPRSIperiod,k+i)>-20){z=1;  }
         
         }
         
         if(z==0)
         {
         ExtMapBuffer1[i]=Low[i] - (High[i]-Low[i])/2;
               if(i==1&&(alert!=Time[1]))
               {
            if(UseSound){PlaySound(SoundFile);Alert("Start Long");}
            }
               alert=Time[1];

         }

         }



      //----
      if( (iWPR(NULL,0,WPRSIperiod,i+1)>-80)&&(iWPR(NULL,0,WPRSIperiod,i)<-80)&&(iRSI(NULL,0,WPRSIperiod,PRICE_MEDIAN,i)<50)           )

{
         double h=0;
         for(int c=2;c<=filterDN+2;c++)
         {
         
         if(iWPR(NULL,0,WPRSIperiod,c+i)<-80){h=1;  }
         
         }
         
         if(h==0)
         {
         
         ExtMapBuffer2[i]=High[i] +(High[i]-Low[i])/2;
               if(i==1&&(alert!=Time[1]))
               {
              if(UseSound){PlaySound(SoundFile);Alert("Start Short");}
               } 
               alert=Time[1];
         }
}         







     }
//----
   return(0);
  }
//+------------------------------------------------------------------+

Comments