Author: Copyright � 2004, MetaQuotes Software Corp.
-RSI-3TF

This tool is a multi-timeframe technical analysis indicator designed to help traders visualize market momentum across three different time horizons simultaneously. Instead of looking at just one chart period, it overlays data from multiple timeframes onto a single view, providing a more comprehensive perspective on price movement.

Core Functionality

The primary logic of this script revolves around the Relative Strength Index (RSI), which is a standard momentum oscillator used to identify overbought or oversold conditions. While a typical RSI only shows you the strength of the current chart you are looking at, this specific tool calculates and displays three distinct RSI lines at once:

  • Timeframe 1: Tracks short-term momentum (defaulting to your current chart settings).
  • Timeframe 2: Tracks medium-term momentum (set to a 30-minute interval by default).
  • Timeframe 3: Tracks long-term momentum (set to a 60-minute interval by default).

How the Logic Works

The script performs several automated steps every time the market updates to ensure the data remains accurate:

  1. Time Alignment: The most critical part of this logic is "time shifting." Because a 60-minute candle represents a much larger block of time than a 1-minute or 5-minute candle, the script automatically calculates which specific historical candle on the larger timeframes corresponds to the exact moment on your current chart. This ensures that all three lines are perfectly synchronized in time.
  2. Data Fetching: It pulls the RSI value for each of these three periods based on a user-defined "Period" (the number of candles used to calculate the average strength).
  3. Visual Overlay: It plots these three different data streams into a single window. You can see the short-term "noise," the medium-term trend, and the long-term momentum as three separate colored lines.

User Experience & Visual Aids

To make the data easier to interpret at a glance, the tool includes several visual guides:

  • Reference Levels: The indicator window features horizontal levels at 30, 50, and 70.
    • The 70 level typically suggests the market may be overextended to the upside.
    • The 30 level typically suggests it may be overextended to the downside.
    • The 50 level acts as a central equilibrium point.
  • Customizable History: Users can define how many past bars the script should analyze, allowing for a balance between performance and historical depth.

By viewing all three timeframes at once, this logic allows a trader to see if a short-term price movement is supported by the broader trend or if it is an isolated occurrence.

Indicators Used
Relative strength index
11 Views
0 Downloads
0 Favorites
-RSI-3TF
//+------------------------------------------------------------------+
//|                                                     #RSI-3TF.mq4 |
//|                      Copyright © 2004, MetaQuotes Software Corp. |
//|                                       http://www.metaquotes.net/ |
//|                                                                  |
//|                   29.10.2005 Ìîäåðíèçàöèÿ Êèì Èãîðü Â. aka KimIV |
//|                                              http://www.kimiv.ru |
//|code change by Alex.Piech.FinGeR                                  |
//|http://www.forex-tsd.com                                          |
//+------------------------------------------------------------------+
#property copyright "Copyright © 2004, MetaQuotes Software Corp."
#property link      "http://www.metaquotes.net/"

#property indicator_separate_window
#property indicator_minimum 0
#property indicator_maximum 100
#property indicator_buffers 3
#property indicator_color1 DodgerBlue
#property indicator_color2 Yellow
#property indicator_color3 Red
#property indicator_level1 70
#property indicator_level2 30
#property indicator_level3 50


//------- Âíåøíèå ïàðàìåòðû èíäèêàòîðà -------------------------------
extern int TF_1         =  0;
extern int RSI_Period_1 = 14;
extern int TF_2         = 30;
extern int RSI_Period_2 = 14;
extern int TF_3         = 60;
extern int RSI_Period_3 = 14;
extern int NumberOfBars = 1000;  // Êîëè÷åñòâî áàðîâ îáñ÷¸òà (0-âñå)

//------- Áóôåðû èíäèêàòîðà ------------------------------------------
double RSIBuffer1[];
double RSIBuffer2[];
double RSIBuffer3[];

//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
void init() {
  string short_name;

  //---- indicator line
  SetIndexStyle (0, DRAW_LINE, STYLE_SOLID, 1);
  SetIndexBuffer(0, RSIBuffer1);
  SetIndexStyle (1, DRAW_LINE, STYLE_SOLID, 3);
  SetIndexBuffer(1, RSIBuffer2);
  SetIndexStyle (2, DRAW_LINE, STYLE_SOLID, 3);
  SetIndexBuffer(2, RSIBuffer3);
 
  
  
  //---- name for DataWindow and indicator subwindow label
  short_name="RSI("+RSI_Period_1+")";
  IndicatorShortName(short_name);
  SetIndexLabel(0,short_name);
 
  short_name="RSI("+RSI_Period_2+")";
  SetIndexLabel(1,short_name);
   
  short_name="RSI("+RSI_Period_3+")";
  SetIndexLabel(2,short_name);

  SetIndexDrawBegin(0,RSI_Period_1);
  SetIndexDrawBegin(1,RSI_Period_2);
  SetIndexDrawBegin(2,RSI_Period_3);
}

//+------------------------------------------------------------------+
//| Relative Strength Index                                          |
//+------------------------------------------------------------------+
void start() {
  int LoopBegin, sh, nsb,nsb2,nsb3;

 	if (NumberOfBars==0) LoopBegin=Bars-1;
  else LoopBegin=NumberOfBars-1;

  for (sh=LoopBegin; sh>=0; sh--) {
    nsb3=iBarShift(NULL, TF_1, Time[sh], False);
    nsb=iBarShift(NULL, TF_2, Time[sh], False);
    nsb2=iBarShift(NULL, TF_3, Time[sh], False);
    RSIBuffer1[sh]=iRSI(NULL, TF_1, RSI_Period_1, PRICE_CLOSE, nsb3);
    RSIBuffer2[sh]=iRSI(NULL, TF_2, RSI_Period_2, PRICE_CLOSE, nsb);
    RSIBuffer3[sh]=iRSI(NULL, TF_3, RSI_Period_3, PRICE_CLOSE, nsb2);
  }
}
//+------------------------------------------------------------------+



//look please last Line !!!!  


















































// BIG Thanks all for PAYPAL Donation - regnif@gmx.net - :) 
// The Money only use for FX Project's 









































Comments