Min_Max_RSI
Download scriptThis tool is designed to provide a visual representation of market momentum by identifying and tracking extreme price movements relative to a central baseline. It simplifies the behavior of the Relative Strength Index (RSI)—a popular technical analysis tool—by filtering out minor fluctuations and focusing on significant highs and lows.
How it Works
The logic operates by dividing the market movement into two distinct zones: bullish momentum (above the midpoint) and bearish momentum (below the midpoint).
- The Baseline: The script uses a fixed central level of 50 as its anchor point. This acts as the "equilibrium" line for the indicator.
- Tracking Highs (Upper Zone): When the market moves into bullish territory (above 50), the script continuously monitors the RSI values. It ignores any price action that falls back below the midpoint and only captures the highest peak reached during a specific upward move.
- Tracking Lows (Lower Zone): Conversely, when the market moves into bearish territory (below 50), the script monitors the downward trend. It ignores any movement that rises back above the midpoint and focuses solely on capturing the lowest valley reached during that downward move.
Visual Output
The indicator generates two distinct lines on your chart:
- The Top Line: This tracks the peak momentum reached during bullish phases. By isolating the "highest high" of an upward move, it helps traders visualize the upper limit of current strength.
- The Bottom Line: This tracks the lowest momentum point reached during bearish phases. It highlights the extreme floor of downward moves, providing a clear picture of the depth of a sell-off.
Summary for Traders
Instead of showing every single fluctuation of the RSI, this script "cleans" the data. It creates a visual history of how high the momentum spiked during uptrends and how low it dropped during downtrends. This allows you to see the boundaries of market exhaustion more clearly, making it easier to identify overextended price action in real-time.
//+------------------------------------------------------------------+
//| Min_Max_RSI.mq4 |
//| Copyright © 2007, 4/Mar/2007 David W Honeywell |
//| hellonwheels.trans@gmail.com |
//+------------------------------------------------------------------+
#property copyright "Copyright © 2007, 4/Mar/2007 David W Honeywell"
#property link "hellonwheels.trans@gmail.com"
#property indicator_separate_window
#property indicator_minimum 0
#property indicator_maximum 100
#property indicator_buffers 2
#property indicator_color1 Lime
#property indicator_color2 Red
extern int RsiPeriods = 14,ShowBars = 500;
double Hrsi;
double Lrsi;
double TopArrow[];
double BottomArrow[];
//+------------------------------------------------------------------+
//| Custom indicator initialization function |
//+------------------------------------------------------------------+
int init()
{
//---- indicators
SetIndexStyle(0,DRAW_LINE);
SetIndexEmptyValue(0,0.0);
SetIndexBuffer(0,TopArrow);
SetIndexStyle(1,DRAW_LINE);
SetIndexEmptyValue(1,0.0);
SetIndexBuffer(1,BottomArrow);
//----
return(0);
}
//+------------------------------------------------------------------+
//| Custom indicator deinitialization function |
//+------------------------------------------------------------------+
int deinit()
{
//----
//----
return(0);
}
//+------------------------------------------------------------------+
//| Custom indicator iteration function |
//+------------------------------------------------------------------+
int start()
{
int counted_bars=IndicatorCounted();
//----
for ( int shift = ShowBars; shift > 0; shift-- )
{
if (iRSI(Symbol(),0,RsiPeriods,PRICE_CLOSE,shift) <= 50.0000) { Hrsi = 50.0000; }
if (iRSI(Symbol(),0,RsiPeriods,PRICE_CLOSE,shift) > 50.0000 && iRSI(Symbol(),0,RsiPeriods,PRICE_CLOSE,shift) >= Hrsi) { Hrsi = iRSI(Symbol(),0,RsiPeriods,PRICE_CLOSE,shift); }
if (iRSI(Symbol(),0,RsiPeriods,PRICE_CLOSE,shift) >= 50.0000) { Lrsi = 50.0000; }
if (iRSI(Symbol(),0,RsiPeriods,PRICE_CLOSE,shift) < 50.0000 && iRSI(Symbol(),0,RsiPeriods,PRICE_CLOSE,shift) <= Lrsi) { Lrsi = iRSI(Symbol(),0,RsiPeriods,PRICE_CLOSE,shift); }
TopArrow[shift] = Hrsi;
BottomArrow[shift] = Lrsi;
}
//----
return(0);
}
//+------------------------------------------------------------------+
Comments