Brooky_Rsi_Ichimoku
Download scriptThis indicator is designed to provide a comprehensive visual overview of market sentiment by combining two well-known trading methodologies into a single display: the Relative Strength Index (RSI) and the Ichimoku Kinko Hyo system.
Instead of applying the Ichimoku logic directly to the price of an asset (like a currency or stock), this script applies it to the RSI values. This means it is analyzing the "momentum" and "strength" of the market rather than just the raw price movements, potentially filtering out some noise to reveal clearer trends.
Core Components of the Logic
The script calculates several distinct components to help you visualize these momentum trends:
1. Momentum Trend Lines (Tenkan and Kijun) These function as the "fast" and "slow" moving averages of the RSI data.
- The Tenkan Sen tracks short-term momentum changes quickly.
- The Kijun Sen tracks medium-term momentum, providing a smoother, more stable baseline. When these lines cross or move in relation to one another, they signal potential shifts in the immediate trend of the market's strength.
2. The "Cloud" (Senkou Span A and B) The script creates a shaded area known as a "Cloud." This is formed by two different calculations:
- Senkou Span A is derived from the average of the Tenkan and Kijun lines.
- Senkou Span B looks further into the past to determine the long-term momentum boundaries. The space between these two lines creates a visual "Cloud." In traditional trading, the cloud helps identify support and resistance zones; in this version, it identifies zones of momentum stability or volatility.
3. The Lagging Indicator (Chinkou Span) This line plots the RSI value from a previous point in time back onto the current chart. Its purpose is to provide a "delayed" confirmation of where the market was, allowing you to see if current momentum is higher or lower than it was several periods ago.
How it Works Together
By merging these elements, the indicator allows you to see more than just whether a market is "overbought" or "oversold." It provides a structured map of momentum dynamics:
- Trend Identification: You can see if the overall momentum is trending upward or downward by observing the direction of the lines and the position of the price relative to the Cloud.
- Support and Resistance: The Cloud provides a visual area where momentum often finds "balance." Trading above or below this cloud suggests a shift in market sentiment.
- Convergence: By watching how the fast (Tenkan) and slow (Kijun) lines interact within the RSI framework, you can identify potential turning points before they become obvious in the price action alone.
In summary, this tool transforms the RSI from a simple oscillator into a multi-layered trend-following system, giving you a clearer picture of the underlying strength driving the market.
//+------------------------------------------------------------------+
//| Brooky_Rsi_Ichimoku.mq4 |
//| Copyright © 2004, MetaQuotes Software Corp. |
//| http://www.metaquotes.net/ |
//+------------------------------------------------------------------+
#property copyright "Copyright © 2004, MetaQuotes Software Corp."
#property link "http://www.metaquotes.net/"
#property indicator_separate_window
#property indicator_buffers 8
#property indicator_color1 Blue
#property indicator_color2 Red
#property indicator_color3 C'241,139,56'
#property indicator_color4 Thistle
#property indicator_color5 Lime
#property indicator_color6 C'241,139,56'
#property indicator_color7 Thistle
#property indicator_color8 C'82,82,82'
#property indicator_width1 3
#property indicator_width2 3
#property indicator_width5 3
#property indicator_level1 50
#property indicator_level2 30
#property indicator_level3 70
//---- input parameters
extern string Author_Site = "www.Forex-Indicators.weebly.com";
extern int Tenkan=9;
extern int Kijun=26;
extern int Senkou=52;
extern string RSI_Period =" Set RSI Period Below";
extern int Rsip =14;
extern string Cloud_Style ="2 for Dots : 0 for Line";
extern int CL_Style =0;
//---- buffers
double Tenkan_Buffer[];
double Kijun_Buffer[];
double SpanA_Buffer[];
double SpanB_Buffer[];
double Chinkou_Buffer[];
double SpanA2_Buffer[];
double SpanB2_Buffer[];
double Fill_Buffer[];
//----
int a_begin;
//+------------------------------------------------------------------+
//| Custom indicator initialization function |
//+------------------------------------------------------------------+
int init()
{
//----
SetIndexStyle(0,DRAW_LINE);
SetIndexBuffer(0,Tenkan_Buffer);
SetIndexDrawBegin(0,Tenkan-1);
SetIndexLabel(0,"Tenkan Sen");
//----
SetIndexStyle(1,DRAW_LINE);
SetIndexBuffer(1,Kijun_Buffer);
SetIndexDrawBegin(1,Kijun-1);
SetIndexLabel(1,"Kijun Sen");
//----
a_begin=Kijun; if(a_begin<Tenkan) a_begin=Tenkan;
SetIndexStyle(2,DRAW_HISTOGRAM,CL_Style);
SetIndexBuffer(2,SpanA_Buffer);
SetIndexDrawBegin(2,Kijun+a_begin-1);
SetIndexShift(2,Kijun);
SetIndexLabel(2,NULL);
SetIndexStyle(5,DRAW_LINE,CL_Style);
SetIndexBuffer(5,SpanA2_Buffer);
SetIndexDrawBegin(5,Kijun+a_begin-1);
SetIndexShift(5,Kijun);
SetIndexLabel(5,"Senkou Span A");
//----
SetIndexStyle(3,DRAW_HISTOGRAM,CL_Style);
SetIndexBuffer(3,SpanB_Buffer);
SetIndexDrawBegin(3,Kijun+Senkou-1);
SetIndexShift(3,Kijun);
SetIndexLabel(3,NULL);
SetIndexStyle(6,DRAW_LINE,CL_Style);
SetIndexBuffer(6,SpanB2_Buffer);
SetIndexDrawBegin(6,Kijun+Senkou-1);
SetIndexShift(6,Kijun);
SetIndexLabel(6,"Senkou Span B");
//----
SetIndexStyle(4,DRAW_LINE);
SetIndexBuffer(4,Chinkou_Buffer);
SetIndexShift(4,-Kijun);
SetIndexLabel(4,"Chinkou Span");
SetIndexStyle(7,DRAW_HISTOGRAM);
SetIndexBuffer(7,Fill_Buffer);
SetIndexDrawBegin(7,Kijun+Senkou-1);
SetIndexShift(7,Kijun);
//----
return(0);
}
//+------------------------------------------------------------------+
//| Ichimoku Kinko Hyo on RSI |
//+------------------------------------------------------------------+
int start()
{
int i,k;
int counted_bars=IndicatorCounted();
double high,low,price;
//----
if(Bars<=Tenkan || Bars<=Kijun || Bars<=Senkou) return(0);
//---- initial zero
if(counted_bars<1)
{
for(i=1;i<=Tenkan;i++) Tenkan_Buffer[Bars-i]=0;
for(i=1;i<=Kijun;i++) Kijun_Buffer[Bars-i]=0;
for(i=1;i<=a_begin;i++) { SpanA_Buffer[Bars-i]=0; SpanA2_Buffer[Bars-i]=0; }
for(i=1;i<=Senkou;i++) { SpanB_Buffer[Bars-i]=0; SpanB2_Buffer[Bars-i]=0; }
}
//---- Tenkan Sen
i=Bars-Tenkan;
if(counted_bars>Tenkan) i=Bars-counted_bars-1;
while(i>=0)
{
high=iRSI(NULL,0,Rsip,PRICE_HIGH,i);
low=iRSI(NULL,0,Rsip,PRICE_LOW,i); k=i-1+Tenkan;
while(k>=i)
{
price=iRSI(NULL,0,Rsip,PRICE_HIGH,k);
if(high<price) high=price;
price=iRSI(NULL,0,Rsip,PRICE_LOW,k);
if(low>price) low=price;
k--;
}
Tenkan_Buffer[i]=(high+low)/2;
i--;
}
//---- Kijun Sen
i=Bars-Kijun;
if(counted_bars>Kijun) i=Bars-counted_bars-1;
while(i>=0)
{
high=iRSI(NULL,0,Rsip,PRICE_HIGH,i);
low=iRSI(NULL,0,Rsip,PRICE_LOW,i); k=i-1+Kijun;
while(k>=i)
{
price=iRSI(NULL,0,Rsip,PRICE_HIGH,k);
if(high<price) high=price;
price=iRSI(NULL,0,Rsip,PRICE_LOW,k);
if(low>price) low=price;
k--;
}
Kijun_Buffer[i]=(high+low)/2;
i--;
}
//---- Senkou Span A
i=Bars-a_begin+1;
if(counted_bars>a_begin-1) i=Bars-counted_bars-1;
while(i>=0)
{
price=(Kijun_Buffer[i]+Tenkan_Buffer[i])/2;
SpanA_Buffer[i]=price;
SpanA2_Buffer[i]=price;
i--;
}
//---- Senkou Span B
i=Bars-Senkou;
if(counted_bars>Senkou) i=Bars-counted_bars-1;
while(i>=0)
{
high=iRSI(NULL,0,Rsip,PRICE_HIGH,i);
low=iRSI(NULL,0,Rsip,PRICE_LOW,i);k=i-1+Senkou;
while(k>=i)
{
price=iRSI(NULL,0,Rsip,PRICE_HIGH,k);
if(high<price) high=price;
price=iRSI(NULL,0,Rsip,PRICE_LOW,k);
if(low>price) low=price;
k--;
}
price=(high+low)/2;
SpanB_Buffer[i]=price;
SpanB2_Buffer[i]=price;
if(SpanA_Buffer[i]<=SpanB_Buffer[i])
{
Fill_Buffer[i]=SpanA_Buffer[i];
}
if(SpanA_Buffer[i]>SpanB_Buffer[i])
{
Fill_Buffer[i]=SpanB_Buffer[i];
}
i--;
}
//---- Chinkou Span
i=Bars-1;
if(counted_bars>1) i=Bars-counted_bars-1;
while(i>=0) { Chinkou_Buffer[i]=iRSI(NULL,0,Rsip,PRICE_CLOSE,i); i--; }
//----
return(0);
}
//+------------------------------------------------------------------+
Comments