Log in to see Cloud of Tags

Wealth-Lab Wiki

TSI (True Strength Index)

RSS

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

References


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 ); } } } } }

Important Disclaimer: The information provided by Wealth-Lab is strictly for informational purposes and is not to be construed as advice or solicitation to buy or sell any security.  The owner of Wealth-Lab.com assumes no liability resulting from the use of the material contained herein for investment purposes. By using this web site, you agree to the terms of this disclaimer and our Terms of Use.


ScrewTurn Wiki. Some of the icons created by FamFamFam.