True Strength Index
"True Strength Index (TSI)" by everget, MPL-2.0. Ported to FloScript by FloSignals; modifications under MPL-2.0. Original: True Strength Index (TSI) (v1.0), read 2026-11-15T18:28:44.994Z; source language v4.
Licence: Mozilla Public License 2.0 (MPL-2.0) — full text. The source is published with it, modifications included, under the same licence.
True Strength Index (TSI) by everget, ported from Pine v4. Pane indicator with 3 plots, 2 marker series, 4 fills, 5 levels, bar/background colouring and 13 inputs.
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// (Notice added by FloSignals: the author's source carries none. It was published open-source on 2021-02-11; since 2019-07-26 the platform it was published on has released such a script under MPL-2.0 automatically.)
// Copyright (c) 2021-present, Alex Orekhov (everget)
// ------------------------------------------------------------------------------------------------
// Original author: everget
// Original title: True Strength Index (TSI)
// Licence: MPL-2.0 (the notice above was added by FloSignals; the original carries none)
// Pine version: 4
// Fetched: 2026-11-15
// Ported to FloScript by FloSignals; modifications under MPL-2.0.
// Converter: @flosignals/floscript 0.1.0, strict mode, score 100/100
// ------------------------------------------------------------------------------------------------
//@floscript=1
//@version=5
// Converted by the FloScript converter from a Pine-compatible v4 source.
indicator("True Strength Index", shorttitle="TSI")
longLength = input.int(title="Long Length", defval=25)
shortLength = input.int(title="Short Length", defval=13)
signalLength = input.int(title="Signal Length", defval=13, minval=1)
src = input.source(title="Source", defval=close)
obLevel = input.int(title="Overbought Level", defval=40)
osLevel = input.int(title="Oversold Level", defval=-40)
maxLevel = input.int(title="Max Level", defval=75)
minLevel = input.int(title="Min Level", defval=-75)
showHistogram = input.bool(title="Show Histogram ?", defval=false)
highlightBreakouts = input.bool(title="Highlight Overbought/Oversold Breakouts ?", defval=true)
highlightCrossovers = input.bool(title="Highlight TSI/Signal Crossovers ?", defval=true)
highlightZeroCrossovers = input.bool(title="Highlight Zero Line Crossovers ?", defval=true)
applyRibbonFilling = input.bool(title="Apply Ribbon Filling ?", defval=true)
mom = ta.change(src)
numerator = ta.ema(ta.ema(mom, longLength), shortLength)
denominator = ta.ema(ta.ema(math.abs(mom), longLength), shortLength)
tsi = 100 * numerator / denominator
signal = ta.ema(tsi, signalLength)
trendColor = tsi > signal ? #0ebb23 : color.red
tsiColor = applyRibbonFilling ? trendColor : #ff3e7d
signalColor = applyRibbonFilling ? trendColor : #3c78d8
tsiPlot = plot(tsi, title="TSI", color=color.new(tsiColor, 0))
signalPlot = plot(signal, title="Signal", color=color.new(signalColor, 0))
hist = tsi - signal
histColor = hist >= 0 ? (hist[1] < hist ? #26A69A : #B2DFDB) : hist[1] < hist ? #FFCDD2 : #EF5350
plot(showHistogram ? hist : na, title="Histogram", style=plot.style_columns, color=color.new(histColor, 0))
var color noneColor = color.new(color.white, 100)
maxLevelPlot = hline(maxLevel, title="Max Level", linestyle=hline.style_dotted, color=noneColor)
obLevelPlot = hline(obLevel, title="Overbought Level", linestyle=hline.style_dotted, color=#00796b)
hline(0, title="Zero Level", linestyle=hline.style_dotted, color=#989898)
osLevelPlot = hline(osLevel, title="Oversold Level", linestyle=hline.style_dotted, color=#f57f17)
minLevelPlot = hline(minLevel, title="Min Level", linestyle=hline.style_dotted, color=noneColor)
fill(obLevelPlot, osLevelPlot, title="Middle Zone", color=color.new(color.purple, 95))
obFillColor = tsi > obLevel and highlightBreakouts ? color.green : noneColor
osFillColor = tsi < osLevel and highlightBreakouts ? color.red : noneColor
fill(maxLevelPlot, obLevelPlot, title="Overbought Level Breakout", color=color.new(obFillColor, 85))
fill(minLevelPlot, osLevelPlot, title="Oversold Level Breakout", color=color.new(osFillColor, 85))
fillColor = applyRibbonFilling ? trendColor : noneColor
fill(tsiPlot, signalPlot, title="Ribbon", color=color.new(fillColor, 70))
zeroCrossBgColor = highlightZeroCrossovers ? (tsi > 0 ? color.green : color.red) : noneColor
bgcolor(color.new(zeroCrossBgColor, 90), title="Zero Line Crossover Background")
plotshape(highlightCrossovers and ta.crossover(tsi, signal) ? tsi : na, title="TSI/Signal Crossover", location=location.absolute, style=shape.circle, size=size.tiny, color=color.new(color.green, 0))
plotshape(highlightCrossovers and ta.crossunder(tsi, signal) ? tsi : na, title="TSI/Signal Crossunder", location=location.absolute, style=shape.circle, size=size.tiny, color=color.new(color.red, 0))
This file is under the Mozilla Public License 2.0; it is a port of the original by everget, with the original licence header kept and the changes made for FloScript noted in the file.
- v1
Library refresh 2026-11-15
Disclaimer. Scripts are written and published by members, or ported by FloSignals from open-source originals, and are their authors' own work and opinion. FloSignals does not review them for correctness and nothing in a script is financial advice or a recommendation to buy or sell anything — read the Risk Disclaimer. Posting here is under the Community Rules; a script that is not the poster's to post can be reported as the Copyright & Takedowns page says.

Comments (0)
No comments yet. Members can leave one.