RSIOMA_v3LMA_custJMA_RSI_LSMA

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

Indicator Overview

The RSIOMA_v3LMA is a sophisticated technical analysis tool designed to provide traders with a smoothed visualization of market momentum. Unlike standard indicators that react sharply to every price tick, this script uses a multi-layered calculation process to filter out "market noise" and highlight underlying trends. It essentially creates a "trend of a trend," making it easier to identify significant shifts in momentum without being misled by minor fluctuations.

How the Logic Works

The script operates through a three-step processing chain:

1. The Base Layer (JMA Foundation) Instead of starting with raw price data (like the closing price), the logic begins by applying a Jurik Moving Average (JMA). The JMA is renowned for its ability to provide very smooth curves while maintaining high responsiveness to price changes. This serves as the stabilized foundation for all subsequent calculations.

2. The Momentum Layer (RSI Application) The script then takes that smoothed JMA data and applies a Relative Strength Index (RSI) calculation to it. By calculating the RSI "on the array" of the JMA, the indicator measures the velocity and strength of the moving average rather than the raw price. This identifies whether the trend is accelerating, decelerating, or losing steam.

3. The Smoothing Layer (LSMA Finalization) To ensure the final output is clean and easy to read, the script applies a Linear Weighted Moving Average (LSMA) to the RSI results. This final step produces the "RSIOMA" lines seen on your chart. Because it is linearly weighted, it gives more importance to recent data points, allowing the indicator to react quickly to new price action while remaining visually stable.

Key Features for the Trader

  • Visual Clarity: The script generates two primary lines. One represents the primary RSIOMA value, and the second represents its moving average.
  • Trend Identification: When these two lines move in harmony, it suggests a strong, consistent trend. When they diverge or cross, it can signal a potential change in momentum or a turning point in the market.
  • Overbought/Oversold Context: The indicator is designed to work with specific horizontal levels (such as 30, 50, 70, and 80). These help traders identify when a trend might be reaching an exhausted state or requiring a correction.
  • Noise Reduction: By layering three different mathematical transformations (JMA $\rightarrow$ RSI $\rightarrow$ LSMA), the script significantly reduces "whipsaws"—the false signals that often occur when using simpler indicators in volatile markets.
Indicators Used
Relative strength index
8 Views
0 Downloads
0 Favorites
RSIOMA_v3LMA_custJMA_RSI_LSMA
//+----------------------------------------------------------------------------------+
//|      RSIOMA_v3LMA   by  Mladen  &  fxbs       Kalenzo            | fxtsd.com |ik|
//|  Hornet(RSIOnArray)  2007, FxTSD.com         MetaQuotes Software Corp.           |
//|  //Hist & Levels 20/80;30/70  CrossSig       web: http://www.fxservice.eu        |
//|  //Rsioma/MaRsioma X sig ()                  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   2
#property indicator_minimum -20
#property indicator_maximum 110
#property indicator_color1     Blue
#property indicator_color2     BlueViolet
//
#property indicator_width1  2   
//
#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       = 20;
extern int    Ma_RSIOMA_MODE  = MODE_EMA;
//

extern int    BarsToCount         = 500;

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

double MABuffer1[];
double RSIBuffer1[];

//
//
//    indexes
//
//

double RSIBuffer[];
double marsioma[];

//
//
//
//
//

int      correction;
datetime lastBarTime;
string   short_name;
double   lengthvar;
//
extern string JMA = "iCustom JMA settings";
extern int Len = 14;
extern int  phase= 0;
extern int BarCount =1500;

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

int init()
{
   short_name = StringConcatenate("RSIOMA jma(",Len,")[",RSIOMA,"]rsi(",Ma_RSIOMA,")");   
   IndicatorShortName(short_name);
   //
   //
   //
   //
   //
   SetIndexBuffer(0,RSIBuffer);
   SetIndexBuffer(1,marsioma);
   //
   //  
   SetIndexLabel(0,"Rsioma("+RSIOMA+")");
   SetIndexLabel(1,"MaRsioma("+Ma_RSIOMA+")");
 
 
   //
   //
   //    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(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]  = LSMA(i,RSIOMA,false,RSIBuffer1);
      MABuffer1[i]  = iCustom(NULL, 0, "JMA",Len,phase,BarCount,0,i);
  //   MABuffer1[i]=iCustom(NULL,0,"LSMA",20,500,0, i);

//      for(i=limit;i>=0;i--) RSIBuffer1[i] = iRSIOnArray(MABuffer1,0,RSIOMA,i);
  //Sample:     double val=iCustom(NULL, 0, "SampleInd",13,1,0);

       for(i=limit;i>=0;i--) 
      RSIBuffer1[i] = iRSIOnArray(MABuffer1,0,RSIOMA,i);
//      RSIBuffer1[i] = iCCIOnArray(MABuffer1,0,RSIOMA,i);
//double iRSIOnArray( double array[], int total, int period, int shift) 
//double iCCIOnArray( double array[], int total, int period, int shift) 
//double iMomentumOnArray( double array[], int total, int period, int shift) 

      for(i=limit;i>=0;i--)
      {
         RSIBuffer[i]= RSIBuffer1[i];
         marsioma[i] = LSMA(i,Ma_RSIOMA,true,RSIBuffer1);
           
         //
         //
         //

         }

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


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

double LSMA(int shift,int period,bool onArray,double& values[])
{
   double sum = 0;
   double res = 0;


   lengthvar   = period + 1;
   lengthvar   /= 3;

   //
   //
   //
   //
   //
   
   for(int i = period; i >= 1 ; i--)
      if (onArray && (shift+period-i) <= (BarsToCount+correction))
               sum += (i-lengthvar)*values[shift+period-i];
      else     sum += (i-lengthvar)* Close[shift+period-i];
      res = sum*6/(period*(period+1));
   
   //
   //
   //
   //
   //
   
   return(res);
}


//  {  MABuffer1[i]=iMA(Symbol(),0,RSIOMA,0,RSIOMA_MODE,RSIOMA_PRICE,i);
//double iMA( string symbol, int timeframe, int period, int ma_shift, int ma_method, int applied_price, int shift) 
//double iCustom( string symbol, int timeframe, string name, ..., int mode, int shift) 
/////
//  { marsioma[i] = iMAOnArray(RSIBuffer,0,Ma_RSIOMA,0,Ma_RSIOMA_MODE,i); 
//  double iMAOnArray( double array[], int total, int period, int ma_shift, int ma_method, int shift) 
////////
//double iRSIOnArray( double array[], int total, int period, int shift) 
//double iCCIOnArray( double array[], int total, int period, int shift) 
//double iMomentumOnArray( double array[], int total, int period, int shift) 
//double iStdDevOnArray( double array[], int total, int ma_period, int ma_shift, int ma_method, int shift) 
//double iCustom( string symbol, int timeframe, string name, ..., int mode, int shift) 
//Sample:     double val=iCustom(NULL, 0, "SampleInd",13,1,0);

Comments