Author: Copyright � 2008, masemus
BS_RSI

This custom indicator is designed to provide a visual representation of market momentum by analyzing the Relative Strength Index (RSI) across specific timeframes. It simplifies complex price action into a clear, binary signal that helps traders identify whether the current market sentiment leans toward the bullish or bearish side.

How the Logic Works

The core functionality of this tool revolves around three primary components: timeframe selection, momentum calculation, and visual signaling.

1. Dynamic Timeframe Analysis Unlike standard indicators that only look at the chart you are currently viewing, this script allows for "multi-timeframe" analysis. You can choose to monitor data from various periods—ranging from 1-minute charts up to monthly views—all within a single display. This enables you to see how broader market trends might be influencing your current price movements.

2. The Momentum Baseline The script utilizes the RSI, a popular momentum oscillator, as its primary engine. It monitors the speed and change of price movements over a specific period (customizable by the user). By analyzing these fluctuations, the indicator determines the "strength" of the current trend.

3. Binary Signal Generation The logic simplifies the RSI data into a high-contrast visual system based on a central threshold of 50:

  • Bearish Sentiment: When the momentum strength falls below the 50 mark, the script identifies a bearish lean and activates a specific visual signal.
  • Bullish Sentiment: When the momentum strength rises above the 50 mark, the script identifies a bullish lean and triggers a corresponding visual signal.

Visual Representation

Instead of displaying a complex moving line, the indicator translates these findings into clear sections on your screen. It separates the data so that you can easily distinguish between periods of upward pressure and downward pressure, providing a clean, "at-a-glance" overview of market behavior without the clutter of raw numerical data.

Indicators Used
Relative strength index
Miscellaneous
Implements a curve of type %1
12 Views
0 Downloads
0 Favorites
BS_RSI
//+------------------------------------------------------------------+
//|                                                       BS_RSI.mq4 |
//|                                        Copyright © 2008, masemus |
//|                                        http://www.metaquotes.net |
//+------------------------------------------------------------------+
#property copyright "Copyright © 2008, masemus"
#property link      "http://www.metaquotes.net"

#property indicator_separate_window
#property indicator_minimum -0.33
#property indicator_maximum 1.33
#property indicator_buffers 2
#property indicator_color1 SlateGray
#property indicator_color2 Red

//---- input parameters
extern int TF=0;
extern int PeriodRSI=5;
//---- indicator buffers
double ExtMapBuffer1[];
double ExtMapBuffer2[];
string TimeFrameStr;

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

int init()
  {
//---- indicators
  SetIndexStyle(0,DRAW_LINE);
  SetIndexBuffer(0,ExtMapBuffer1);
  SetIndexStyle(1,DRAW_SECTION);
  SetIndexBuffer(1,ExtMapBuffer2);

switch(TF)
   {
      case 1 : TimeFrameStr="Period_M1"; break;
      case 5 : TimeFrameStr="Period_M5"; break;
      case 15 : TimeFrameStr="Period_M15"; break;
      case 30 : TimeFrameStr="Period_M30"; break;
      case 60 : TimeFrameStr="Period_H1"; break;
      case 240 : TimeFrameStr="Period_H4"; break;
      case 1440 : TimeFrameStr="Period_D1"; break;
      case 10080 : TimeFrameStr="Period_W1"; break;
      case 43200 : TimeFrameStr="Period_MN1"; break;
      default : TimeFrameStr="Current Timeframe"; TF=0;
   }
   IndicatorShortName("BS_RSI ("+PeriodRSI+","+TimeFrameStr+")");  

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

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

//| RSIFilter_v1                                                     

//+------------------------------------------------------------------
int start()
  {
   int    counted_bars=IndicatorCounted();
//----

for (int i = 0; i < 1000; i++){
   ExtMapBuffer1[i]=0;
   ExtMapBuffer2[i]=0;

   double BS_RSI;
   
   BS_RSI=iRSI(NULL,TF,PeriodRSI,PRICE_CLOSE,i);
   	
	  if (BS_RSI>50)ExtMapBuffer2[i]=1;
	  if (BS_RSI<50)ExtMapBuffer1[i]=1;
	  
	}
	return(0);	
 }




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

Comments