OPEN-SOURCE SCRIPT

Custom TSI

//version=5
indicator("Custom TSI", overlay = false)

// Input parameters for TSI settings
int longfLen = input.int(11, "Long Length", minval = 1)
int shortfLen = input.int(3, "Short Length", minval = 1)
int signalfLen = input.int(7, "Signal Length", minval = 1)

// Calculate TSI
tsi = ta.tsi(close, shortfLen, longfLen) * 100

// Calculate TSI Signal Line
tsiSignal = ta.ema(tsi, signalfLen)

// Plot TSI and Signal Line
plot(tsi, "TSI", color=color.blue, linewidth=2)
plot(tsiSignal, "Signal Line", color=color.red, linewidth=2)

// Highlight TSI crossing Signal Line
bgcolor(ta.crossover(tsi, tsiSignal) ? color.new(color.green, 90) : na, title="TSI Cross Up")
bgcolor(ta.crossunder(tsi, tsiSignal) ? color.new(color.red, 90) : na, title="TSI Cross Down")

// Alerts
alertcondition(ta.crossover(tsi, tsiSignal), title="TSI Cross Up", message="TSI has crossed above the Signal Line")
alertcondition(ta.crossunder(tsi, tsiSignal), title="TSI Cross Down", message="TSI has crossed below the Signal Line")
educationalFundamental AnalysisMoving Averages

Open-source script

In true TradingView spirit, the author of this script has published it open-source, so traders can understand and verify it. Cheers to the author! You may use it for free, but reuse of this code in publication is governed by House rules. You can favorite it to use it on a chart.

Want to use this script on a chart?

Disclaimer