RSIOMA_v3_alertsD

Download script
Author: Copyright � 2007, MetaQuotes Software Corp.
RSIOMA_v3_alertsD

Overview of the RSIOMA Indicator

The RSIOMA is a sophisticated technical analysis tool designed to help traders identify momentum, trend reversals, and potential entry or exit points by combining multiple layers of smoothed data. Unlike a standard Relative Strength Index (RSI), which can often be volatile and "noisy," this script applies several levels of mathematical smoothing to create a cleaner, more reliable visual of the market's strength.

Core Logic and Data Processing

The indicator operates through a multi-step calculation process:

  1. Primary Smoothing: The script begins by taking price data (such as closing prices) and applying a Moving Average. This filters out minor price fluctuations to establish a baseline.
  2. Momentum Calculation: It then calculates an RSI value based on that smoothed moving average rather than the raw price. This "RSI on Array" approach helps identify the underlying strength of the trend while reducing false signals.
  3. Secondary Smoothing (MaRsioma): To further refine the data, the script calculates a second Moving Average specifically for the RSI values generated in the previous step. This creates a "Signal Line" that tracks the momentum of the momentum.

Visual Signals and Trend Identification

The indicator provides several visual cues to help traders interpret market behavior:

  • Trend Tracking: It monitors whether the momentum is moving above or below the midline (50).
  • Overbought & Oversold Zones: The script tracks specific thresholds (like 20, 30, 70, and 80). When price action crosses into these zones, it identifies potential exhaustion points where the market might be overextended.
  • Crossovers: One of the primary uses of this script is identifying "Crosses." When the smoothed RSI line crosses above or below its Moving Average (the Signal Line), it signifies a shift in momentum.
  • Directional Arrows: The tool automatically plots visual symbols (arrows) on the chart to highlight these specific crossover moments, providing immediate confirmation of a potential trend change.

Automated Notifications

Beyond visual analysis, the script is equipped with an integrated alert system. It can monitor the market in real-time and notify the user through several methods:

  • Sound Alerts: Plays an audible warning when specific crossovers occur (e.g., crossing the Signal Line or entering a trend threshold).
  • On-Screen Pop-ups: Displays a text box alert providing details about the current price and the type of crossover detected.
  • Email Notifications: If configured, the script can send an automated email to the user whenever a significant momentum shift is identified.

Summary for Traders

By layering smoothing techniques over RSI data, this indicator aims to provide a clearer picture of market "flow." It distinguishes between temporary price spikes and genuine shifts in momentum, allowing traders to stay informed about trend changes through visual markers and real-time alerts.

Indicators Used
Moving average indicatorRelative strength indexMoving average indicator
Miscellaneous
Implements a curve of type %1It plays sound alerts
16 Views
0 Downloads
0 Favorites
RSIOMA_v3_alertsD
//+--------------------------------------------------------------------------------+
//|      RSIOMA_v3   by   Mladen  &  fxbs       Kalenzo                  fxtsd.com |
//|  Hornet(RSIOnArray)   2007, FxTSD.com       MetaQuotes Software Corp.          |
//|  Hist & Levels 20/80;30/70   CrossSig       web: http://www.fxservice.eu       |
//|  Rsioma/MaRsioma X sig ()    +alertsD       email: bartlomiej.gorski@gmail.com |
//+--------------------------------------------------------------------------------+

#property copyright "Copyright © 2007, MetaQuotes Software Corp."
#property link      "http://www.metaquotes.net/ Kalenzo|bartlomiej.gorski@gmail.com "

#property indicator_separate_window
#property indicator_buffers   8
#property indicator_minimum -20
#property indicator_maximum 110
#property indicator_color1     Blue
#property indicator_color2     Red
#property indicator_color3     Green
#property indicator_color4     Magenta
#property indicator_color5     DodgerBlue
#property indicator_color6     BlueViolet
#property indicator_color7     Aqua   //DeepSkyBlue
#property indicator_color8     DeepPink   //Crimson
//
#property indicator_width1  2   
#property indicator_width4  2
#property indicator_width5  2
#property indicator_width7  1
#property indicator_width8  1
//
#property indicator_level1 100
#property indicator_level2 80   //76.4
#property indicator_level3 70   //61.8
#property indicator_level4 50
#property indicator_level5 30   //38.2
#property indicator_level6 20   //23.6
#property indicator_levelcolor DarkSlateGray
//------------------------------------------

//---- input parameters

extern int    RSIOMA          = 14;
extern int    RSIOMA_MODE     = MODE_EMA;
extern int    RSIOMA_PRICE    = PRICE_CLOSE;
extern int    Ma_RSIOMA       = 21;
extern int    Ma_RSIOMA_MODE  = MODE_EMA;

extern double SellTrigger_OBLevel         = 80.00;
extern double BuyTrigger_OSLevel          = 20.00;
extern color  SellTriggerLevelColor    = DodgerBlue;
extern color  BuyTriggerLevelColor     = Magenta;

extern double MainTrend_OBLevel        = 70.00;
extern double MainTrend_OSLevel        = 30.00;
extern color  MainTrend_OBLevelColor   = Green;
extern color  MainTrend_OSLevelColor   = Red;
extern double MajorTrend          = 50;
extern color  marsiomaXupSigColor = Aqua;       //DeepSkyBlue
extern color  marsiomaXdnSigColor = DeepPink;   //Crimson

extern int    BarsToCount         = 1500;

extern bool SoundAlerts                = false;     //Alerts 
extern int  SoundAlertsDelay_Bars      = 0;     
extern bool BoxAlerts                  = true;     
extern bool EmailAlerts                = false; 
extern int  AlertsDelay_Bars           = 1;     

extern bool RSIOMA_MaRsiomaCross          = true; 
extern bool RSIOMA_TriggerLevelCross      = true; 
extern bool RSIOMA_MainTrendLevelCross    = false; 

extern string AlertsSoundFile          = "alert2.wav";

   datetime TimeStamp, TimeStamp1, TimeStamp2; 
   datetime TimeStampS, TimeStampS1, TimeStampS2; 

//---- buffers
//
//
//    "indexes"
//

double MABuffer1[];
double RSIBuffer1[];

//
//
//    indexes
//
//

double RSIBuffer[];
double bdn[];
double bup[];
double sdn[];
double sup[];
double marsioma[];
double marsiomaXupSig[];
double marsiomaXdnSig[];

//
//
//
//
//

int      correction;
datetime lastBarTime;
string   short_name;



//+------------------------------------------------------------------+

int init()
{
   short_name = StringConcatenate("RSIOMA [",RSIOMA,"] (",Ma_RSIOMA,")");   
   IndicatorShortName(short_name);
   
   //
   //
   //
   //
   //
   
   SetIndexBuffer(0,RSIBuffer);
   SetIndexBuffer(2,bup);
   SetIndexBuffer(1,bdn);
   SetIndexBuffer(3,sdn);//Magneta
   SetIndexBuffer(4,sup);//DodgerBlue
   SetIndexBuffer(5,marsioma);
   SetIndexBuffer(6,marsiomaXupSig);
   SetIndexBuffer(7,marsiomaXdnSig);

      SetIndexStyle(2,DRAW_HISTOGRAM);
      SetIndexStyle(1,DRAW_HISTOGRAM);
      SetIndexStyle(3,DRAW_HISTOGRAM);
      SetIndexStyle(4,DRAW_HISTOGRAM);
      SetIndexStyle(6,DRAW_ARROW);
      SetIndexStyle(7,DRAW_ARROW);
         SetIndexArrow(6,159);
         SetIndexArrow(7,159);
  
   SetIndexLabel(0,"Rsioma("+RSIOMA+")");
   SetIndexLabel(5,"MaRsioma("+Ma_RSIOMA+")");
   SetIndexLabel(1,"TrendDn");
   SetIndexLabel(2,"TrendUp");
   SetIndexLabel(6,"UpXsig");
   SetIndexLabel(7,"DnXsig");
 
 
   //
   //
   //    additional buffer(s)
   //
   //


      correction  = RSIOMA+RSIOMA+Ma_RSIOMA;
      BarsToCount = MathMin(Bars,MathMax(BarsToCount,300));
          ArrayResize( MABuffer1 ,BarsToCount+correction);
          ArrayResize( RSIBuffer1,BarsToCount+correction);
          ArraySetAsSeries(MABuffer1 ,true);
          ArraySetAsSeries(RSIBuffer1,true);
                 lastBarTime = EMPTY_VALUE;

      //
      //
      //
      //
      //
   
   return(0);
}


//+------------------------------------------------------------------+


int start()
{
   static bool init=false;
   int    counted_bars=IndicatorCounted();
   int    limit,i=0;

   //
   //
   //
   //
   //

   if(!init) {
       init=true;
         drawLine(BuyTrigger_OSLevel,"BuyTrigger", BuyTriggerLevelColor);
         drawLine(SellTrigger_OBLevel,"SellTrigger", SellTriggerLevelColor);
         drawLine(MainTrend_OBLevel,"MainTrendLong", MainTrend_OBLevelColor);
         drawLine(MainTrend_OSLevel,"MainTrendShort",MainTrend_OSLevelColor);
      }         
      
   //
   //
   //
   //
   //
               
   if(counted_bars<0) return(-1);
   if(lastBarTime != Time[0]) {
      lastBarTime  = Time[0];
                  counted_bars = 0;
      }         
      if(counted_bars>0) counted_bars--;
              limit=Bars-counted_bars;
              limit=MathMin(limit,BarsToCount+correction);
   
   //
   //
   //
   //
   //
   
      for(i=limit;i>=0;i--) 
   MABuffer1[i]  = iMA(Symbol(),0,RSIOMA,0,RSIOMA_MODE,RSIOMA_PRICE,i);
      for(i=limit;i>=0;i--) 
   RSIBuffer1[i] = iRSIOnArray(MABuffer1,0,RSIOMA,i);
      for(i=limit;i>=0;i--)
      {
   RSIBuffer[i]= RSIBuffer1[i];
   marsioma[i] = iMAOnArray(RSIBuffer1,0,Ma_RSIOMA,0,Ma_RSIOMA_MODE,i); 
         
         //
         //
         //
         //
         //
         

            bup[i] = EMPTY_VALUE; bdn[i] = EMPTY_VALUE;
            sup[i] = EMPTY_VALUE; sdn[i] = EMPTY_VALUE;
            
               if(RSIBuffer[i] > 50)                     bup[i] =   6;
               if(RSIBuffer[i] < 50)                     bdn[i] =  -6;      
               if(RSIBuffer[i] > MainTrend_OBLevel)      bup[i] =  12;
               if(RSIBuffer[i] < MainTrend_OSLevel)      bdn[i] = -12;
            
               if(RSIBuffer[i]<20 && RSIBuffer[i]>RSIBuffer[i+1])                sup[i] =  -3;
               if(RSIBuffer[i]>80 && RSIBuffer[i]<RSIBuffer[i+1])                sdn[i] =   4;

               if(RSIBuffer[i]>20 && RSIBuffer[i+1]<=20)                         sup[i] =   5;
               if(RSIBuffer[i+1]>=80 && RSIBuffer[i]<80)                         sdn[i] =  -5;

               if(RSIBuffer[i+1]<=MainTrend_OSLevel && RSIBuffer[i]>MainTrend_OSLevel)    sup[i] =  12;  
               if(RSIBuffer[i+1]>=MainTrend_OBLevel && RSIBuffer[i]<MainTrend_OBLevel )   sdn[i] = -12;

            marsiomaXupSig[i] = EMPTY_VALUE;
            marsiomaXdnSig[i] = EMPTY_VALUE;
            
               if(RSIBuffer[i+1]<=marsioma[i+1] && RSIBuffer[i]>marsioma[i]) marsiomaXupSig[i] = -11; 
               if(RSIBuffer[i+1]>=marsioma[i+1] && RSIBuffer[i]<marsioma[i]) marsiomaXdnSig[i] =  11;

 
//--------------    Alerts   ------------- 

// sound  alerts 


        if   (RSIBuffer[SoundAlertsDelay_Bars+1]<=marsioma[SoundAlertsDelay_Bars+1] 
           && RSIBuffer[SoundAlertsDelay_Bars]  > marsioma[SoundAlertsDelay_Bars]
           && TimeStampS != Time[0]&& Volume[0]>1)
               {        
            if (SoundAlerts)  PlaySound(AlertsSoundFile);
               TimeStampS = Time[0];
               }
            
        if   (RSIBuffer[SoundAlertsDelay_Bars+1]>=marsioma[SoundAlertsDelay_Bars+1] 
           && RSIBuffer[SoundAlertsDelay_Bars]  < marsioma[SoundAlertsDelay_Bars]
           && TimeStampS != Time[0]&& Volume[0]>1)
               {        
            if (SoundAlerts)  PlaySound(AlertsSoundFile);
               TimeStampS = Time[0];
               }



        if    (RSIBuffer[SoundAlertsDelay_Bars+1]>=SellTrigger_OBLevel 
            && RSIBuffer[SoundAlertsDelay_Bars]  < SellTrigger_OBLevel
            && TimeStampS1 != Time[0]&& Volume[0]>1)
               {  
            if (SoundAlerts)  PlaySound(AlertsSoundFile);
               TimeStampS1 = Time[0];
               }
  
        if    (RSIBuffer[SoundAlertsDelay_Bars+1]<=BuyTrigger_OSLevel 
            && RSIBuffer[SoundAlertsDelay_Bars]  > BuyTrigger_OSLevel
            && TimeStampS1 != Time[0]&& Volume[0]>1)
               {        
            if (SoundAlerts)  PlaySound(AlertsSoundFile);
               TimeStampS1 = Time[0];
               }



        if    (RSIBuffer[SoundAlertsDelay_Bars+1]>=MainTrend_OBLevel 
            && RSIBuffer[SoundAlertsDelay_Bars]  < MainTrend_OBLevel
            && TimeStampS2 != Time[0]&& Volume[0]>1)
               {        
            if (SoundAlerts)  PlaySound(AlertsSoundFile);
               TimeStampS2 = Time[0];
               }

         if   (RSIBuffer[SoundAlertsDelay_Bars+2]<=MainTrend_OSLevel 
            && RSIBuffer[SoundAlertsDelay_Bars]  > MainTrend_OSLevel
            && TimeStampS2 != Time[0]&& Volume[0]>1)
               {        
            if (SoundAlerts)  PlaySound(AlertsSoundFile);
               TimeStampS2 = Time[0];
               }


//--  Box with e-male


   string   alertmessage = "RSIOMA " +Symbol()+" chart M"+Period()+"  Bid price "+DoubleToStr(Bid,4)+" " ; 
 
 
         if   (RSIBuffer[AlertsDelay_Bars+1]<=marsioma[AlertsDelay_Bars+1] 
            && RSIBuffer[AlertsDelay_Bars]  > marsioma[AlertsDelay_Bars]
            && TimeStamp != Time[0]&& Volume[0]>1)
               {        
            alertmessage = (alertmessage +" RSIOMA_Crossed_MaRsioma_Up");
            if (BoxAlerts && RSIOMA_MaRsiomaCross)     Alert    (alertmessage);
            if (EmailAlerts)   SendMail (alertmessage,"");
               TimeStamp = Time[0];
               }
            
         if   (RSIBuffer[AlertsDelay_Bars+1]>=marsioma[AlertsDelay_Bars+1] 
            && RSIBuffer[AlertsDelay_Bars]  < marsioma[AlertsDelay_Bars]
            && TimeStamp != Time[0]&& Volume[0]>1)
               {        
            alertmessage = (alertmessage +" RSIOMA_Crossed_MaRsioma_Dn");
            if (BoxAlerts && RSIOMA_MaRsiomaCross)     Alert    (alertmessage);
            if (EmailAlerts)   SendMail (alertmessage,"");
               TimeStamp = Time[0];
               }




         if    (RSIBuffer[AlertsDelay_Bars+1]>=SellTrigger_OBLevel 
             && RSIBuffer[AlertsDelay_Bars]  < SellTrigger_OBLevel
             && TimeStamp1 != Time[0]&& Volume[0]>1)
               {  
            alertmessage = (alertmessage +" RSIOMA_Crossed_SellTriggerOBLevel_Dn");
            if (BoxAlerts && RSIOMA_TriggerLevelCross)     Alert    (alertmessage);
            if (EmailAlerts)   SendMail (alertmessage,"");
               TimeStamp1 = Time[0];
               }


         if    (RSIBuffer[AlertsDelay_Bars+1]<=BuyTrigger_OSLevel 
             && RSIBuffer[AlertsDelay_Bars]  > BuyTrigger_OSLevel
             && TimeStamp1 != Time[0]&& Volume[0]>1)
               {        
            alertmessage = (alertmessage +" RSIOMA_Crossed_BuyTriggerOSLevel_Up");
            if (BoxAlerts && RSIOMA_TriggerLevelCross)     Alert    (alertmessage);
            if (EmailAlerts)   SendMail (alertmessage,"");
               TimeStamp1 = Time[0];
               }





         if   (RSIBuffer[AlertsDelay_Bars+1]>=MainTrend_OBLevel 
            && RSIBuffer[AlertsDelay_Bars]  < MainTrend_OBLevel
            && TimeStamp2 != Time[0]&& Volume[0]>1)
               {        
            alertmessage = (alertmessage +" RSIOMA_Crossed_MainTrend_OBLevel_Dn");
            if (BoxAlerts && RSIOMA_TriggerLevelCross)     Alert    (alertmessage);
            if (EmailAlerts)   SendMail (alertmessage,"");
               TimeStamp2 = Time[0];
               }


         if   (RSIBuffer[AlertsDelay_Bars+1]<=MainTrend_OSLevel 
            && RSIBuffer[AlertsDelay_Bars]  > MainTrend_OSLevel
            && TimeStamp2 != Time[0]&& Volume[0]>1)
               {        
            alertmessage = (alertmessage +" RSIOMA_Crossed_MainTrend_OSLevel_Up");
            if (BoxAlerts && RSIOMA_TriggerLevelCross)     Alert    (alertmessage);
            if (EmailAlerts)   SendMail (alertmessage,"");
               TimeStamp2 = Time[0];
               }

  
   //-----
 
   //
   //
   //
   //
   //
 
   }
   
   for (i=0;i<indicator_buffers;i++) SetIndexDrawBegin(i,Bars-BarsToCount);


   return(0);
}


//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+

void drawLine(double lvl,string name, color Col )
{
   ObjectDelete(name);
   ObjectCreate(name, OBJ_HLINE, WindowFind(short_name), Time[0], lvl,Time[0], lvl);
   ObjectSet(name   , OBJPROP_STYLE, STYLE_DOT);
   ObjectSet(name   , OBJPROP_COLOR, Col);        
   ObjectSet(name   , OBJPROP_WIDTH, 1);
}

Comments