RSI_Del_WA__mtf
Download scriptThis indicator is designed to help traders analyze price momentum by comparing two different Relative Strength Index (RSI) periods simultaneously. By blending these two perspectives, it identifies trends and potential shifts in market sentiment more effectively than using a single RSI alone.
Core Logic and Mechanism
The script operates on a multi-layered calculation process:
1. Dual Momentum Comparison The tool calculates two separate RSI values at once. One uses a shorter time period (standard for detecting quick price changes), while the other uses a longer time period (better for identifying the broader trend). By subtracting the long-term RSI value from the short-term RSI value, the script creates a "momentum gap." This helps visualize whether the current price movement is accelerating faster than the historical average.
2. Moving Average Smoothing To filter out market "noise" and minor fluctuations that might trigger false signals, the script applies a Simple Moving Average (SMA) to the momentum gap calculated above. This produces a smoother line on your chart, making it easier to see the primary direction of the price trend without being distracted by erratic spikes.
3. Multi-Timeframe Integration One of the most sophisticated features of this script is its ability to "look ahead" at different timeframes. It can be configured to display data from higher timeframes (such as viewing Daily or Weekly trends while looking at a 15-minute chart). It automatically aligns the data so that you can see how the larger market context influences your current trading window.
Visual Representation
The indicator provides two distinct visual elements:
- The Primary Line: A smoothed representation of the momentum difference, showing the current "velocity" of the market.
- The Secondary Data Point: A reference line that helps gauge the strength of the RSI gap relative to a zero baseline (the equilibrium point).
Summary for the Trader
Instead of just telling you if a price is "overbought" or "oversold," this tool tells you how fast the price is moving relative to its recent history. When combined with the multi-timeframe capability, it allows you to see if a short-term move is supported by a stronger, long-term trend, helping you stay aligned with the dominant market direction.
//+------------------------------------------------------------------+
//| RSI_Def_WA_mtf Waddah_Attar_Def_RSI.mq4 |
//| Copyright © 2007, Eng. Waddah Attar |
//| mtf:www.forex-tsd.com Keris2112 ml ki waddahattar@hotmail.com |
//+------------------------------------------------------------------+
#property copyright "Copyright © 2007, Eng. Waddah Attar"
#property link "waddahattar@hotmail.com"
//----
#property indicator_separate_window
#property indicator_buffers 2
#property indicator_color1 Green
#property indicator_color2 Red
#property indicator_width1 2
#property indicator_width2 1
#property indicator_level1 0
#property indicator_levelcolor Teal
//----
extern int RSIPeriod1=14;
extern int RSIPeriod2=28;
double ind_buffer[];
double MABuffer[];
//extern int History = 1500;
extern int TimeFrame=0;
extern string note_TimeFrames = "M1;5,15,30,60H1;240H4;1440D1;10080W1;43200MN|0-CurrentTF";
string IndicatorFileName;
//+------------------------------------------------------------------+
//| |
//+------------------------------------------------------------------+
int init()
{
IndicatorBuffers(3);
SetIndexStyle(0, DRAW_LINE);
SetIndexStyle(1, DRAW_LINE);
//----
SetIndexBuffer(0, ind_buffer);
SetIndexBuffer(1, MABuffer);
//----
TimeFrame = MathMax(TimeFrame,Period());
switch(TimeFrame)
{
case 1 : string TimeFrameStr="M1"; break;
case 5 : TimeFrameStr="M5"; break;
case 15 : TimeFrameStr="M15"; break;
case 30 : TimeFrameStr="M30"; break;
case 60 : TimeFrameStr="H1"; break;
case 240 : TimeFrameStr="H4"; break;
case 1440 : TimeFrameStr="D1"; break;
case 10080 : TimeFrameStr="W1"; break;
case 43200 : TimeFrameStr="MN"; break;
default : TimeFrameStr="TF0";
}
IndicatorShortName("RSI_Del ("+RSIPeriod1+","+RSIPeriod2+") ["+TimeFrameStr+"] ");
IndicatorFileName = WindowExpertName();
// IndicatorShortName("Waddah Attar Def RSI");
// Comment("copyright waddahwttar@hotmail.com");
return(0);
}
//+------------------------------------------------------------------+
//| |
//+------------------------------------------------------------------+
int deinit()
{
// Comment("");
//----
return(0);
}
//+------------------------------------------------------------------+
//| |
//+------------------------------------------------------------------+
int start()
{
double RSI1,RSI2,Explo;
datetime TimeArray[];
int limit, i, y=0, counted_bars = IndicatorCounted();
//----
if(counted_bars < 0) return(-1);
//----
if(counted_bars > 0) counted_bars--;
ArrayCopySeries(TimeArray,MODE_TIME,Symbol(),TimeFrame);
limit = Bars - counted_bars;
if (TimeFrame != Period())
{
limit = MathMax(limit,TimeFrame/Period());
for(i=0, y=0; i<limit; i++)
{
if(Time[i]<TimeArray[y]) y++;
MABuffer[i] = iCustom(NULL,TimeFrame,IndicatorFileName,RSIPeriod1,RSIPeriod2,0,y);
ind_buffer[i] = iCustom(NULL,TimeFrame,IndicatorFileName,RSIPeriod1,RSIPeriod2,1,y);
}
return(0);
}
//----
for(i = limit; i >= 0; i--)
{
RSI1 = iRSI(NULL, 0, RSIPeriod1, PRICE_CLOSE, i);
RSI2 = iRSI(NULL, 0, RSIPeriod2, PRICE_CLOSE, i);
MABuffer[i] = (RSI1-RSI2);
}
for(i = limit; i >= 0; i--)
ind_buffer[i] = iMAOnArray(MABuffer,0,RSIPeriod1,0,MODE_SMA,i);
return(0);
}
//+------------------------------------------------------------------+
Comments