True Strength Index Oscillator - TSI Oscillator (TSIOsc)

TSI Oscillator is a very popular indicator among traders.

Technical Forex Market Indicator
TSI Oscillator
Technical Forex Market Indicator
TSI Oscillator
Technical Forex Market Indicator
TSI Oscillator
Technical Forex Market Indicator
TSI Oscillator
Technical Forex Market Indicator
TSI Oscillator
Technical Forex Market Indicator
TSI Oscillator
Technical Forex Market Indicator
TSI Oscillator
Technical Forex Market Indicator
TSI Oscillator










True Strength Index oscillator - TSI Oscillator is a very popular indicator among traders. TSI Oscillator was developed by William Blau in 1991, and is a traditional indicator used in technical analysis. This indicator is used to determine both the trend and overbought-oversold conditions, to intraday time frames as well as longer-term horizons. The TSI Oscillator a double-smoothed version of momentum (an EMAof an EMAof momentum) to a double-smoothed version of the absolute value of the momentum. The double smoothing removes the noise, leaving smoothed representations of momentum. Dividing the smoothed momentum by the smoothed absolute value of momentum creates a ratio that is bound by +1 to -1, which is then multiplied by 100 to produce an indicator that ranges from +100 to -100. Most TSI values fall between +25 and -25, and William Blau suggested using these values as overbought and oversold levels, respectively. William Blau also advised adding a signal line — in this case, a seven-period EMA of the TSI line - to better indicate trend changes (similar to the role of the signal line in the Moving Average Convergence Divergence - MACD). Figures shows the TSI Oscillator (blue line) with the addition of the signal line (red line). Trend changes are indicated when the TSI Oscillator crosses above or below its signal line. In this example, the TSI accurately tracks the longer-term price trend, while penetrations of the –25 and +25 overbought and oversold levels (complemented by TSI/signal line crossovers) coincided with reversals. This indicator is designed to have very little or no time lag. TSI Oscillator, a technical momentum indicator that helps traders determine overbought and oversold conditions of a security by incorporating the short-term purchasing momentum of the market with the lagging benefits of moving averages.
Mathematical Formula:

TSI(close,r,s) = 100*EMA(EMA(mtm,r),s)/EMA(EMA(|mtm|,r),s)

where:
mtm = close today – close yesterday
EMA(mtm,r) = exponential moving average of mtm with period length = r
EMA(EMA(mtm,r),s) = exponential moving average of EMA(mtm,r) with period length = s
|mtm| = absolute value of mtm
r = 25,
s = 13


True Strength Index Oscillator - TSI Oscillator MQ4 Code Base (Copy Code)
//+------------------------------------------------------------------+
//|                                                      TSI-Osc.mq4 |
//|                      Copyright © 2005, MetaQuotes Software Corp. |
//|                                        http://www.metaquotes.net |
//+------------------------------------------------------------------+
#property copyright "Copyright © 2005, MetaQuotes Software Corp."
#property link      "http://www.metaquotes.net"

#property indicator_separate_window
#property indicator_buffers 2
#property indicator_color1 Blue
#property indicator_color2 Red
#property indicator_maximum 100
#property indicator_minimum -100
#property indicator_level1 0
#property indicator_level2 50
#property indicator_level3 -50
//---- input parameters
// M5 and M15 , 8,8,8
// M30 7,7,7
// H1 and H4 6,6,6
extern int First_R = 7;
extern int Second_S = 7;
extern int SignalPeriod = 7;
//---- buffers
double TSI_Buffer[];
double SignalBuffer[];
double MTM_Buffer[];
double EMA_MTM_Buffer[];
double EMA2_MTM_Buffer[];
double ABSMTM_Buffer[];
double EMA_ABSMTM_Buffer[];
double EMA2_ABSMTM_Buffer[];
//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init()
  {
//---- indicators
   IndicatorBuffers(8);
   SetIndexBuffer(2, MTM_Buffer);
   SetIndexBuffer(3, EMA_MTM_Buffer);
   SetIndexBuffer(4, EMA2_MTM_Buffer);
   SetIndexBuffer(5, ABSMTM_Buffer);
   SetIndexBuffer(6, EMA_ABSMTM_Buffer);
   SetIndexBuffer(7, EMA2_ABSMTM_Buffer);

   SetIndexStyle(0, DRAW_LINE);
   SetIndexBuffer(0, TSI_Buffer);
   SetIndexLabel(0, "TSI");
   SetIndexStyle(1, DRAW_LINE);
   SetIndexBuffer(1, SignalBuffer);
   SetIndexLabel(1, "Signal");
//----
   IndicatorShortName("TSIOsc" + "(" + First_R + "," + Second_S + "," + SignalPeriod + ")");
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| Custor indicator deinitialization function                       |
//+------------------------------------------------------------------+
int deinit()
  {
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+
int start()
  {
   int counted_bars = IndicatorCounted();
   int limit, i;
   limit = Bars - counted_bars - 1; 
   for(i = Bars - 1; i >= 0; i--) 
     {
       MTM_Buffer[i] = (Close[i] - Close[i+1]);
       //MTM_Buffer[i]=((High[i]+Low[i])/2)-((High[i+1]+Low[i+1])/2);
       //MTM_Buffer[i]=(((Close[i]-Close[i+1])/Close[i+1])+Point);
       //MTM_Buffer[i]=iMomentum(NULL,0,1,PRICE_CLOSE,i)-iMomentum(NULL,0,1,PRICE_CLOSE,i+1);
       //MTM_Buffer[i]=iMomentum(NULL,0,1,PRICE_CLOSE,i)-iMomentum(NULL,0,1,PRICE_CLOSE,i+1);
       //MTM_Buffer[i]=iMomentum(NULL,0,1,PRICE_CLOSE,i)-iMomentum(NULL,0,1,PRICE_CLOSE,i+1);
       ABSMTM_Buffer[i] = MathAbs(MTM_Buffer[i]);
     }
//----
   for(i = Bars - 1; i >= 0; i--)
     {
       EMA_MTM_Buffer[i] = iMAOnArray(MTM_Buffer, 0, First_R, 0, MODE_EMA, i);
       EMA_ABSMTM_Buffer[i] = iMAOnArray(ABSMTM_Buffer, 0, First_R, 0, MODE_EMA, i);
     }
//----
   for(i = Bars - 1; i >= 0; i--)
     {
       EMA2_MTM_Buffer[i] = iMAOnArray(EMA_MTM_Buffer, 0, Second_S, 0, MODE_EMA, i);
       EMA2_ABSMTM_Buffer[i] = iMAOnArray(EMA_ABSMTM_Buffer, 0, Second_S, 0, MODE_EMA, i);
     }
//----
   for(i = limit; i >= 0; i--)
     {
       TSI_Buffer[i] = 100.0*EMA2_MTM_Buffer[i] / EMA2_ABSMTM_Buffer[i];
     }
   for(i = limit; i >= 0; i--)
     {
       SignalBuffer[i] = iMAOnArray(TSI_Buffer, 0, SignalPeriod, 0, MODE_EMA, i);
     }
//----
   return(0);
  }
//+------------------------------------------------------------------+