 API ChartStyles Community Components Community Indicators IndexDefinitions Knowledge Base Misc Optimizers Pending Deletion PosSizers Providers Standard Indicators TASC Traders Tips TASCIndicators Tutorial Videos Visualizers Quick Search
»

TSI (True Strength Index)

Syntax

public TSI(DataSeries ds, int period1, int period2, string description)
public static TSISeries(DataSeries ds, int period1, int period2)

Parameter Description

 ds Price series period1 First EMA period period2 Second EMA period

Description

The True Strength Index (TSI) is a momentum-based oscillator, developed by William Blau, designed to determine both the trend and overbought- oversold conditions.

Interpretation

• The True Strength Index is a variation of the Relative Strength Index, so values of -25 and +25 can also be used to identify levels where a security is overbought or oversold.
• A signal line (7-day EMA) is usually added in the Moving Average Convergence/Divergence (MACD) fashion to help identify reversals.

Calculation

The formula for the TSI is:
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

Example

using System;
using System.Collections.Generic;
using System.Text;
using System.Drawing;
using WealthLab;
using WealthLab.Indicators;
using Community.Indicators; // TSI

namespace WealthLab.Strategies { public class ATMag02_2002_TSI : WealthScript { protected override void Execute() { // Plot True Strength Index and Signal Line ChartPane TSIPane = CreatePane( 50, true, true ); SetPaneMinMax( TSIPane, -30, 30 ); DataSeries TSISer = TSI.Series( Close, 25, 13 ); PlotSeries( TSIPane, TSISer, Color.Blue, LineStyle.Solid, 1 ); DataSeries Signal = EMA.Series( TSISer, 7, EMACalculation.Modern ); PlotSeries( TSIPane, Signal, Color.Black, LineStyle.Dashed, 1 );

// Obtain Difference of TSI and Signal Line, Plot it DataSeries Diff = TSISer - Signal; Diff.Description = "TSI/Signal Difference"; ChartPane DiffPane = CreatePane( 35, false, true ); PlotSeries( DiffPane, Diff, Color.Black, LineStyle.Histogram, 2 );

for(int bar = 20; bar < Bars.Count; bar++) { if (IsLastPositionActive) { if( CrossUnder( bar, Diff, 0 ) ) SellAtMarket( bar + 1, LastPosition ); } else { if( CrossOver( bar, Diff, 0 ) ) BuyAtMarket( bar + 1 ); } } } } }