Author: Copyright � 2005, MetaQuotes Software Corp.
TSI_v1

This technical tool is designed to provide traders with a clearer picture of market momentum by smoothing out the "noise" typically found in volatile price movements. Rather than looking at raw price action, this indicator focuses on the speed and strength of the current trend to help identify potential shifts in direction.

How the Logic Works

The script follows a multi-step calculation process to refine data into a single, readable visual line:

1. Calculating Momentum The first step is determining the basic momentum. The tool looks at the difference between the current closing price and the previous closing price. This tells us whether the market is moving up or down and by how much.

2. Measuring Absolute Strength To ensure the indicator focuses on the magnitude of the move regardless of direction, the logic also calculates the "Absolute Momentum." By removing the negative signs from downward moves, the tool can measure the pure intensity of price activity.

3. Multi-Layer Smoothing Raw momentum data is often jagged and difficult to read. To solve this, the script applies two successive layers of Exponential Moving Averages (EMAs).

  • The first layer smooths out the immediate price fluctuations based on a primary timeframe (defined by the "First_R" setting).
  • The second layer applies an additional smoothing pass over that result using a secondary timeframe (defined by the "Second_S" setting).

4. The Final TSI Calculation The final visual output, known as the True Strength Index (TSI), is generated by comparing the smoothed momentum against the smoothed absolute momentum. By dividing the trend strength by the total intensity and multiplying it by 100, the indicator produces a normalized value.

What This Means for the User

By using this layered approach—moving from raw price change to absolute strength, and then smoothing that data twice—the tool filters out "fake" price spikes. The resulting yellow line on your chart represents a stabilized view of market trend strength, making it easier to identify sustained movements and potential reversals in more reliable terms.

Indicators Used
Moving average indicator
Miscellaneous
Implements a curve of type %1
13 Views
0 Downloads
0 Favorites
TSI_v1
/*-----------------------------+
|			       |
| Shared by www.Aptrafx.com    |
|			       |
+------------------------------*/

  //+------------------------------------------------------------------+
//|                                                          TSI.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 1
#property indicator_color1 Yellow
//---- input parameters
extern int       First_R=5;
extern int       Second_S=8;
//---- buffers
double TSI_Buffer[];
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(7);
   SetIndexBuffer(1, MTM_Buffer);
   SetIndexBuffer(2, EMA_MTM_Buffer);
   SetIndexBuffer(3, EMA2_MTM_Buffer);
   SetIndexBuffer(4, ABSMTM_Buffer);
   SetIndexBuffer(5, EMA_ABSMTM_Buffer);
   SetIndexBuffer(6, EMA2_ABSMTM_Buffer);

   SetIndexStyle(0,DRAW_LINE);
   SetIndexBuffer(0,TSI_Buffer);
   SetIndexLabel(0,"TSI");
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| Custor indicator deinitialization function                       |
//+------------------------------------------------------------------+
int deinit()
  {
//---- TODO: add your code here
   
//----
   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];//iMomentum(NULL,0,1,PRICE_CLOSE,i);
      ABSMTM_Buffer[i]=MathAbs(MTM_Buffer[i]);
      //TSI_Buffer[i]=ABSMTM_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);
      //TSI_Buffer[i]=EMA_ABSMTM_Buffer[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);
      //TSI_Buffer[i]=EMA2_ABSMTM_Buffer[i];
      }

   for (i=Bars-1;i>=0;i--)
      {
      TSI_Buffer[i]=100.0*EMA2_MTM_Buffer[i]/EMA2_ABSMTM_Buffer[i];
      }
      
//---- TODO: add your code here
   
//----
   return(0);
  }
//+------------------------------------------------------------------+

Comments