RSIOMA_v2HHLSX__rev_alert

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

The RSIOMA v2 HHLSX is a sophisticated technical analysis tool designed to provide traders with a multi-layered view of market momentum, trend strength, and specific entry/exit opportunities. Rather than relying on a single data point, this script combines smoothed momentum indicators with dynamic "trigger" levels to filter out market noise and highlight high-probability signals.

Core Logic and Components

1. Smoothed Momentum (The RSIOMA) The foundation of the tool is a modified Relative Strength Index (RSI). To make the data more readable and less erratic, the script applies a Moving Average to the price before calculating the RSI. This "smoothed" approach helps identify the underlying strength of a currency pair or asset without the frequent, jagged spikes often seen in standard indicators.

2. Trend Identification The tool categorizes market behavior into different visual zones:

  • Primary Momentum: It uses a 50-level baseline to distinguish between bullish (above 50) and bearish (below 50) sentiment.
  • Major Trends: The script monitors specific threshold levels (typically 30 and 70). When the momentum moves into these extreme zones, it identifies whether the market is in a sustained long-term trend or potentially reaching an overextended state.

3. Dynamic Trigger Signals The indicator features "Magnet" levels and trigger points designed to catch quick shifts in price action:

  • Overbought/Oversold Logic: The script watches for the momentum to cross specific thresholds (such as 20 and 80). It looks for "rejection" behavior—where the price hits these extremes and begins to curve back—providing visual cues for potential reversals.
  • Entry Alerts: It identifies specific points where the momentum breaks through trend barriers, marking these as potential support or resistance points.

4. The Cross-Signal (XSig) One of the most actionable parts of this script is the "MaRsioma Xsig." This logic tracks the relationship between the smoothed RSI and its own Moving Average.

  • Bullish Signal: When the momentum line crosses above its moving average, it generates an upward signal.
  • Bearish Signal: When the momentum line crosses below its moving average, it generates a downward signal.

Visual Execution and Alerts

The indicator communicates this logic through several visual layers:

  • Histograms: These provide a sense of the "volume" and direction of momentum at a glance.
  • Arrows: The script places specific arrows on the chart to pinpoint the exact moment a Cross-Signal occurs, making it easier for traders to identify entry points without manual scanning.
  • Horizontal Reference Lines: The tool automatically draws dotted lines for key thresholds (Buy/Sell Triggers and Trend Levels), ensuring that the trader always has a clear visual map of the "danger zones" and "opportunity zones."
  • Real-time Notifications: For traders who cannot watch their screens constantly, the script includes an alert system that sends a pop-up notification whenever a momentum cross (Up or Down) is confirmed.
Indicators Used
Moving average indicatorRelative strength indexMoving average indicator
Miscellaneous
Implements a curve of type %1It issuies visual alerts to the screen
12 Views
0 Downloads
0 Favorites
RSIOMA_v2HHLSX__rev_alert
//+--------------------------------------------------------------------------------+
//|      RSIOMAv2HHLSX                                 Kalenzo    fxtsd.com        |
//|  Hornet(i-RSI)                   2007, FxTSD.com;  MetaQuotes Software Corp. ik|
//|  Hist & Levels 20/80;30/70 CrossSig            web: http://www.fxservice.eu    |
//|  Rsioma/MaRsioma X sig                     email: bartlomiej.gorski@gmail.com  |
//|  please, keep your code tidy. mladen                                           |
//+--------------------------------------------------------------------------------+
//  The base for this indicator was orginal RSI attached with Metatrader.
//                                      ^^ removed ^^ :)|-<   Hornet

#property copyright "Copyright © 2007, MetaQuotes Software Corp."
#property link      "http://www.metaquotes.net/"

#property indicator_separate_window
#property indicator_buffers   7
#property indicator_minimum -20
#property indicator_maximum 120
#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     SlateBlue
#property indicator_levelcolor SlateGray
#property indicator_width1  2   
#property indicator_width4  2
#property indicator_width5  2
#property indicator_width7  2
#property indicator_level1  100
#property indicator_level4  50

//---- 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 BuyTrigger          = 80.00;
extern double SellTrigger         = 20.00;
extern color  BuyTriggerColor     = DodgerBlue;
extern color  SellTriggerColor    = Magenta;
extern bool   Alert_On            = true;

extern double MainTrendLong       = 70.00;
extern double MainTrendShort      = 30.00;
extern color  MainTrendLongColor  = Red;
extern color  MainTrendShortColor = Green;
extern double MajorTrend          = 50;
extern color  marsiomaXSigColor   = SlateBlue;
extern int    BarsToCount         = 500;

//---- buffers
//
//
//
//

double RSIBuffer[];
double MABuffer1[];
double bdn[];
double bup[];
double sdn[];
double sup[];
double marsioma[];
double marsiomaXSig[];

//
//
//
//
//

datetime lastBarTime;
string   short_name;


//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+

int init()
{
   short_name = StringConcatenate("RSIOMA(",RSIOMA,")");   
   IndicatorShortName(short_name);
   
   //
   //
   //
   //
   //
   
   SetIndexBuffer(0,RSIBuffer);
   SetIndexBuffer(2,bup);
   SetIndexBuffer(1,bdn);
   SetIndexBuffer(3,sdn);//Magnet
   SetIndexBuffer(4,sup);//DodgerBlue
   SetIndexBuffer(5,marsioma);
   SetIndexBuffer(6,marsiomaXSig);
      SetIndexStyle(2,DRAW_HISTOGRAM);
      SetIndexStyle(1,DRAW_HISTOGRAM);
      SetIndexStyle(3,DRAW_HISTOGRAM);
      SetIndexStyle(4,DRAW_HISTOGRAM);
      SetIndexStyle(6,DRAW_ARROW);
         SetIndexArrow(6,159);
   SetIndexLabel(0,"Rsioma");
   SetIndexLabel(5,"MaRsioma");
   SetIndexLabel(1,"TrendDn");
   SetIndexLabel(2,"TrendUp");
   SetIndexLabel(6,"Up/DnXsig");
  
 
   //
   //
   //    additional buffer(s)
   //
   //
   
      BarsToCount = MathMin(Bars,BarsToCount);
          ArrayResize( MABuffer1,BarsToCount);
          ArraySetAsSeries(MABuffer1,true);
                 lastBarTime = EMPTY_VALUE;

      //
      //
      //
      //
      //
   
      drawLine(BuyTrigger,"BuyTrigger", BuyTriggerColor);
      drawLine(SellTrigger,"SellTrigger", SellTriggerColor );
      drawLine(MainTrendLong,"MainTrendLong", MainTrendLongColor );
      drawLine(MainTrendShort,"MainTrendShort",MainTrendShortColor );
   return(0);
}


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

int start()
{
   int   counted_bars=IndicatorCounted();
   int   limit,i=0;

   //
   //
   //
   //
   //
   
   if(counted_bars<0) return(-1);
   if(lastBarTime != Time[0]) {
      lastBarTime  = Time[0];
             ArrayInitialize(MABuffer1,0.0);
                  counted_bars = 0;
      }         
      if(counted_bars>0) counted_bars--;
              limit=Bars-counted_bars;
              limit=MathMin(limit,BarsToCount-1);
   
   //
   //
   //
   //
   //
   
   for(i=limit;i>=0;i--) MABuffer1[i]=iMA(Symbol(),0,RSIOMA,0,RSIOMA_MODE,RSIOMA_PRICE,i);
   for(i=limit;i>=0;i--)
   {
         RSIBuffer[i]=iRSIOnArray(MABuffer1,0,RSIOMA,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] > MainTrendLong)    bup[i] =  12;
            if(RSIBuffer[i] < MainTrendShort)   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]<=MainTrendShort && RSIBuffer[i]>MainTrendShort) sup[i] =  12;  
            if(RSIBuffer[i]<MainTrendLong && RSIBuffer[i+1]>=MainTrendLong)   sdn[i] = -12;
   }

   //
   //
   //
   //
   //
   
   for(i=limit;i>=0;i--)
   {
         marsioma[i]     = iMAOnArray(RSIBuffer,0,Ma_RSIOMA,0,Ma_RSIOMA_MODE,i); 
         marsiomaXSig[i] = EMPTY_VALUE;
            if(RSIBuffer[i+1]<=marsioma[i+1]&&RSIBuffer[i]>marsioma[i]) marsiomaXSig[i] = -8; 
            if(RSIBuffer[i+1]>=marsioma[i+1]&&RSIBuffer[i]<marsioma[i]) marsiomaXSig[i] =  8;
   
    
    if(Alert_On==true)
   {                  
      if(RSIBuffer[i+1]<=marsioma[i+1]&&RSIBuffer[i]>marsioma[i])
         AlertOnce(Symbol()+ ":" + "  -  Up Signal",1);
      if(RSIBuffer[i+1]>=marsioma[i+1]&&RSIBuffer[i]<marsioma[i])   
         AlertOnce(Symbol()+ ":" + "  -  Down Signal",2);
   }}
 
   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);
}

bool AlertOnce(string alert_msg, int ref)
{  
   static int LastAlert_1 = 0;
   static int LastAlert_2 = 0;
   static int LastAlert_3 = 0;
   static int LastAlert_4 = 0;
   
   switch(ref)
   {
      case 1:
         if( LastAlert_1 == 0 || LastAlert_1 < Bars )
         {
            Alert(alert_msg);
            LastAlert_1 = Bars;
            return (1);
         }
      break;
      case 2:
         if( LastAlert_2 == 0 || LastAlert_2 < Bars )
         {
            Alert(alert_msg);
            LastAlert_2 = Bars;
            return (1);
         }
      break;
      case 3:
         if( LastAlert_3 == 0 || LastAlert_3 < Bars )
         {
            Alert(alert_msg);
            LastAlert_3 = Bars;
            return (1);
         }
      break;
      case 4:
         if( LastAlert_4 == 0 || LastAlert_4 < Bars )
         {
            Alert(alert_msg);
            LastAlert_4 = Bars;
            return (1);
         }
      break;
   }
}

Comments