All_RSI
Download scriptThis tool is designed to provide a comprehensive, multi-dimensional view of market momentum by consolidating multiple Relative Strength Index (RSI) values into a single visual interface. Instead of requiring a trader to switch between different charts to see how the market is performing on various timeframes, this script automates that process by overlaying them simultaneously.
Core Functionality
Multi-Timeframe Integration The primary logic of the script revolves around gathering RSI data from seven different timeframes at once. Depending on your settings, it can display either shorter timeframes (such as 1-minute to Daily) or longer timeframes (such as 15-minute to Monthly). By pulling this data into one window, it allows you to see "the big picture" and the immediate "micro-movements" side-by-side.
Dynamic Visual Organization To keep the information readable and organized, the script performs several automated tasks:
- Automatic Sorting: The logic identifies which timeframe your current chart is set to and reorders the list of displayed timeframes. This ensures that the most relevant data is prioritized and easy to locate.
- Visual Separation: The script uses trend lines as visual "fences" to separate the different timeframes. This prevents the data from blending together, ensuring that you can clearly distinguish which line belongs to which period.
- Dynamic Labeling: Each timeframe is clearly labeled on the chart (e.g., "H1", "D1"). These labels adjust based on the data being displayed, so you always know exactly what each RSI movement represents.
Technical Smoothing and Positioning The script calculates how many bars of history to display for each timeframe and provides options to shift these visual elements to the right. This shifting logic is intended to provide extra "breathing room" on the chart, preventing the indicator lines from overlapping with current price candles too closely, which helps in maintaining a clean workspace for analysis.
Summary of User Experience
For a trader, this means you can see at a glance whether the market is overbought or oversold across multiple horizons—from the 1-minute tick to the Monthly trend—without ever leaving your current screen. It transforms a complex task of cross-referencing multiple charts into a single, organized visual summary.
//+------------------------------------------------------------------+
//| All RSI.mq4 |
//| mladen |
//+------------------------------------------------------------------+
#property copyright "mladen"
#property link ""
#define indicatorName "All RSI"
//----
#property indicator_separate_window
#property indicator_minimum 0
#property indicator_maximum 100
#property indicator_buffers 1
#property indicator_color1 Gold
#property indicator_level1 30
#property indicator_level2 70
#property indicator_levelcolor DimGray
//---- input parameters
extern int RSIperiod =14;
extern int AppliedPrice =0;
extern bool showHigherTimeframes=true;
extern int barsPerTimeFrame =35;
extern bool shiftRight =False;
extern color txtColor =Silver;
extern color separatorColor =DimGray;
//---- buffers
double ExtMapBuffer1[];
//----
string shortName;
string labelsShort[] ={"M1","M5","M15","M30","H1","H4","D1"};
string labelsLong[] ={"M15","M30","H1","H4","D1","W1","MN1"};
string labels[];
int periodsShort[]={PERIOD_M1,PERIOD_M5,PERIOD_M15,PERIOD_M30,PERIOD_H1,PERIOD_H4,PERIOD_D1};
int periodsLong[] ={PERIOD_M15,PERIOD_M30,PERIOD_H1,PERIOD_H4,PERIOD_D1,PERIOD_W1,PERIOD_MN1};
int periods[];
int Shift;
//+------------------------------------------------------------------+
//| Custom indicator initialization function |
//+------------------------------------------------------------------+
int init()
{
if (shiftRight) Shift=1;
else Shift=0;
SetIndexStyle(0,DRAW_LINE);
SetIndexBuffer(0,ExtMapBuffer1);
SetIndexShift(0,Shift*(barsPerTimeFrame+1));
SetIndexLabel(0,"RSI");
//----
barsPerTimeFrame =MathMax(barsPerTimeFrame,30);
shortName=indicatorName+" ("+RSIperiod+")";
IndicatorShortName(shortName);
if (showHigherTimeframes)
{
ArrayCopy(labels,labelsLong);
ArrayCopy(periods,periodsLong);
}
else
{
ArrayCopy(labels,labelsShort);
ArrayCopy(periods,periodsShort);
}
//----
for(int i=1;i<7;i++)
if (Period()==periods[i])
{
string tmpLbl=labels[i];
int tmpPer=periods[i];
//----
for(int k=i ;k>0; k--)
{
labels[k] =labels[k-1];
periods[k]=periods[k-1];
}
labels[0] =tmpLbl;
periods[0]=tmpPer;
}
return(0);
}
//+------------------------------------------------------------------+
//| Custom indicator deinitialization function |
//+------------------------------------------------------------------+
int deinit()
{
for(int l=0;l<7;l++)
{
ObjectDelete(indicatorName+l);
ObjectDelete(indicatorName+l+1);
}
return(0);
}
//+------------------------------------------------------------------+
//| Custom indicator iteration function |
//+------------------------------------------------------------------+
int start()
{
string on;
int wn=WindowFind(shortName);
int k=0;
//----
for(int p=0; p<7;p++)
{
for(int i=0; i<barsPerTimeFrame;i++,k++)
ExtMapBuffer1[k]=iRSI(NULL,periods[p],RSIperiod,AppliedPrice,i);
ExtMapBuffer1[k]=EMPTY_VALUE; k+=1;
//----
on=indicatorName+p;
if(ObjectFind(on)==-1)
ObjectCreate(on,OBJ_TREND,wn,0,0);
ObjectSet(on,OBJPROP_TIME1,myTime(k-Shift*(barsPerTimeFrame+1)-1));
ObjectSet(on,OBJPROP_TIME2,myTime(k-Shift*(barsPerTimeFrame+1)-1));
ObjectSet(on,OBJPROP_PRICE1, 0);
ObjectSet(on,OBJPROP_PRICE2,100);
ObjectSet(on,OBJPROP_COLOR ,separatorColor);
ObjectSet(on,OBJPROP_WIDTH ,2);
on=indicatorName+p+1;
if(ObjectFind(on)==-1)
ObjectCreate(on,OBJ_TEXT,wn,0,0);
ObjectSet(on,OBJPROP_TIME1,myTime(k-Shift*(barsPerTimeFrame+1)-6));
ObjectSet(on,OBJPROP_PRICE1,100);
ObjectSetText(on,labels[p],9,"Arial",txtColor);
}
//----
SetIndexDrawBegin(0,Bars-k);
return(0);
}
//+------------------------------------------------------------------+
//+ Custom functions and procedures +
//+------------------------------------------------------------------+
int myTime(int a)
{
if(a<0)
return(Time[0]+Period()*60*MathAbs(a));
else return(Time[a]);
}
//+------------------------------------------------------------------+
Comments