RSIOMA_v2HHLSX__rev

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

Overview

The RSIOMA v2 is a technical analysis tool designed to help traders identify market trends and potential entry points by layering multiple layers of smoothing and momentum calculations. Instead of relying on a single standard indicator, this script combines Relative Strength Index (RSI) logic with Moving Averages (MA) to filter out "market noise" and provide clearer visual signals for buying and selling.

Core Logic & Mechanics

1. Dual-Layer Smoothing The tool does not calculate the RSI directly from the raw price. Instead, it first processes the market data through a Moving Average to create a smoothed base. It then calculates an RSI based on that smoothed average. This technique helps prevent the indicator from reacting too wildly to minor, insignificant price fluctuations, providing a more stable view of momentum.

2. Trend Identification (Visual Histograms) The script monitors where the smoothed RSI sits relative to specific threshold levels:

  • Main Trends: It identifies dominant market directions based on the 30 and 70 levels. When the indicator moves above these boundaries, it signals a stronger trend in that direction.
  • Momentum Bias: The tool also tracks the 50-level midpoint to provide a general "bullish" or "bearish" bias, represented visually as a histogram.

3. Signal Detection (The "X-Signal") One of the primary features of this script is the detection of "Cross Signals." It calculates a second moving average specifically based on the RSI values (a Moving Average of an RSI).

  • When the smoothed RSI line crosses above this secondary average, it identifies a potential upward momentum shift.
  • When it crosses below, it signals a potential downward momentum shift.
  • These transitions are highlighted on the chart as specific arrows or markers to alert the trader to a change in the immediate trend.

4. Extreme Zone Monitoring The logic includes specific "Trigger" zones (at the 20 and 80 levels). These act as magnets to identify overbought or oversold conditions. The script looks for specific movements—such as the RSI dropping into an extreme zone and then beginning to turn back—to help identify potential reversals before they fully manifest in the price.

Visual Summary for Traders

  • Smoothing: Provides a "cleaner" view of market strength than the standard RSI.
  • Histograms: Offer a quick glance at the current trend strength (Strong vs. Weak).
  • X-Signals: Act as dynamic alerts when momentum shifts direction.
  • Dynamic Levels: Uses color-coded horizontal lines to define clear boundaries for "Safe Zones" and "Danger Zones."
Indicators Used
Moving average indicatorRelative strength indexMoving average indicator
Miscellaneous
Implements a curve of type %1
9 Views
0 Downloads
0 Favorites
RSIOMA_v2HHLSX__rev
//+--------------------------------------------------------------------------------+
//|      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 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;
   }
   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