rsi_filter

This tool is designed as a technical analysis assistant for the MetaTrader platform, specifically engineered to help traders identify market momentum and smooth out "noise" in price action. It works by layering two distinct mathematical concepts: the Relative Strength Index (RSI) and a Moving Average.

Core Logic Overview

The script processes price data through a two-step filtering process to provide a clearer picture of market trends. Rather than looking at raw price alone, it analyzes the speed and change of price movements to determine if an asset is overextended or trending steadily.

Step 1: Momentum Measurement (RSI)

First, the tool calculates the Relative Strength Index (RSI). This is a standard technical indicator that measures the velocity of price changes. It helps identify whether an asset has been buying or selling aggressively over a specific period (the timeframe defined by the user). By using this as a baseline, the tool captures the "heartbeat" of the market's momentum.

Step 2: Trend Smoothing (Moving Average)

The unique feature of this specific script is that it does not show you the raw RSI directly. Instead, it applies a Moving Average to the RSI data.

Think of this as a secondary filter:

  • The first step (RSI) tells you what the market is doing right now.
  • The second step (Moving Average) smooths out those immediate fluctuations to show you the underlying trend of that momentum.

Visual Output and Purpose

The result is a filtered line that reacts less erratically than a standard RSI indicator. By smoothing the momentum data, the tool aims to help traders:

  • Identify consistent trends: It filters out minor, "jittery" price movements that might trigger false signals.
  • Observe trend reversals: It allows for a clearer view of when momentum is genuinely shifting direction versus just experiencing a temporary spike.
  • Enhanced Clarity: By using a specific smoothing method (SMMA), the tool provides a more balanced view of the data, making it easier to visualize whether the market's strength is accelerating or decelerating over time.
Indicators Used
Relative strength indexMoving average indicator
Miscellaneous
Implements a curve of type %1
8 Views
0 Downloads
0 Favorites
rsi_filter
//+------------------------------------------------------------------+
//|                                                   RSI_Filter.mq4 |
//+------------------------------------------------------------------+
//|                                                   RSI_Filter.mq4 |
//|                          Copyright 2014, Toptahlil Software Corp |
//|                                      Emial : Toptahlil@yahoo.com |
//+------------------------------------------------------------------+
#property description "feedbacks: https://login.mql5.com/en/users/toptahlil/feedbacks"
#property copyright  "post a job for me: http://www.mql5.com/en/job/new?prefered=toptahlil"
#property link      "Emial : Toptahlil@yahoo.com"
#property description      "Skype ID : Toptahlil"
#property description      "MQL5  ID : Toptahlil"
#property version   "1.0"

#property indicator_separate_window
#property indicator_buffers 2
#property indicator_color1 Blue
#property indicator_color2 Red


extern int RSI_Period=34;
extern ENUM_APPLIED_PRICE RSI_ApplyPrice= PRICE_CLOSE;
extern int MA_Period=34;
extern  ENUM_MA_METHOD MA_Method =MODE_SMMA;
extern int MA_Shift=0;
double B1[], B2[], B3[];

//----
int ExtCountedBars=0;
//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init()
  {
//---- indicators

//---- drawing settings
   SetIndexStyle(0, DRAW_LINE);
   SetIndexStyle(1, DRAW_LINE);
   SetIndexBuffer(0,B1);
   SetIndexBuffer(1,B2);
   IndicatorDigits(MarketInfo(Symbol(),MODE_DIGITS));
//---- indicator short name
   IndicatorShortName("RSI_Filter");
   ArraySetAsSeries(B1,true);
   ArraySetAsSeries(B2,true);
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+
int start()
  {
   
   int    pos=Bars-2;
   int i;   
   if(ExtCountedBars>2) pos=Bars-ExtCountedBars-1;
//---- main calculation loop
   for(i=0;i<Bars;i++)
      {
      B1[i] = iRSI(Symbol(),Period(),RSI_Period,RSI_ApplyPrice,i);
      }
   for(i=0;i<Bars;i++)
      {
      
      B2[i]= iMAOnArray(B1,0,MA_Period,MA_Shift,MA_Method,i);
      }  
   return(0);
   }

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

Comments