OPEN-SOURCE SCRIPT
TSI Indicator with Trailing Stop

Author: ProfitGang
Type: Indicator (visual + alerts). No orders are executed.
What it does
This tool combines the True Strength Index (TSI) with a simple tick-based trailing stop visualizer.
It plots buy/sell markers from a TSI cross with momentum confirmation and, if enabled, draws a trailing stop line that “ratchets” in your favor. It also shows a compact info table (position state, entry price, trailing status, and unrealized ticks).
Signal logic (summary)
TSI is computed with double EMA smoothing (user lengths).
Signals:
Buy when TSI crosses above its signal line and momentum (TSI–Signal histogram) improves, with TSI above your Buy Threshold.
Sell when TSI crosses below its signal line and momentum weakens, with TSI below your Sell Threshold.
Confirmation: Optional “Confirm on bar close” setting evaluates signals on closed bars to reduce repaint risk.
Trailing stop (visual only)
Units are ticks (uses the symbol’s min tick).
Start Trailing After (ticks): activates the trail only once price has moved in your favor by the set amount.
Trailing Stop (ticks): distance from price once active.
For longs: stop = close - trail; it never moves down.
For shorts: stop = close + trail; it never moves up.
Exits shown on chart when the trailing line is touched or an opposite signal occurs.
Note: This is a simulation for visualization and does not place, manage, or guarantee broker orders.
Inputs you can tune
TSI Settings: Long Length, Short Length, Signal Length, Buy/Sell thresholds, Confirm on Close.
Trailing Stop: Start Trailing After (ticks), Trailing Stop (ticks), Show/Hide trailing lines.
Display: Toggle chart signals, info table, and (optionally) TSI plots on the price chart.
Alerts included
TSI Buy / TSI Sell
Long/Short Trailing Activated
Long/Short Trail Exit
Tips for use
Timeframes/markets: Works on any symbol/timeframe that reports a valid min tick. If your market has large ticks, adjust the tick inputs accordingly.
TSI view: By default, TSI lines are hidden to avoid rescaling the price chart. Enable “Show TSI plots on price chart” if you want to see the oscillator inline.
Non-repainting note: With Confirm on bar close enabled, signals are evaluated on closed bars. Intrabar previews can change until the bar closes—this is expected behavior in TradingView.
Limitations
This is an indicator for education/research. It does not execute trades, and visuals may differ from actual broker fills.
Performance varies by market conditions; thresholds and trail settings should be tested by the user.
Disclaimer
Nothing here is financial advice. Markets involve risk, including possible loss of capital. Always do your own research and test on a demo before using any tool in live trading.
— ProfitGang
Type: Indicator (visual + alerts). No orders are executed.
What it does
This tool combines the True Strength Index (TSI) with a simple tick-based trailing stop visualizer.
It plots buy/sell markers from a TSI cross with momentum confirmation and, if enabled, draws a trailing stop line that “ratchets” in your favor. It also shows a compact info table (position state, entry price, trailing status, and unrealized ticks).
Signal logic (summary)
TSI is computed with double EMA smoothing (user lengths).
Signals:
Buy when TSI crosses above its signal line and momentum (TSI–Signal histogram) improves, with TSI above your Buy Threshold.
Sell when TSI crosses below its signal line and momentum weakens, with TSI below your Sell Threshold.
Confirmation: Optional “Confirm on bar close” setting evaluates signals on closed bars to reduce repaint risk.
Trailing stop (visual only)
Units are ticks (uses the symbol’s min tick).
Start Trailing After (ticks): activates the trail only once price has moved in your favor by the set amount.
Trailing Stop (ticks): distance from price once active.
For longs: stop = close - trail; it never moves down.
For shorts: stop = close + trail; it never moves up.
Exits shown on chart when the trailing line is touched or an opposite signal occurs.
Note: This is a simulation for visualization and does not place, manage, or guarantee broker orders.
Inputs you can tune
TSI Settings: Long Length, Short Length, Signal Length, Buy/Sell thresholds, Confirm on Close.
Trailing Stop: Start Trailing After (ticks), Trailing Stop (ticks), Show/Hide trailing lines.
Display: Toggle chart signals, info table, and (optionally) TSI plots on the price chart.
Alerts included
TSI Buy / TSI Sell
Long/Short Trailing Activated
Long/Short Trail Exit
Tips for use
Timeframes/markets: Works on any symbol/timeframe that reports a valid min tick. If your market has large ticks, adjust the tick inputs accordingly.
TSI view: By default, TSI lines are hidden to avoid rescaling the price chart. Enable “Show TSI plots on price chart” if you want to see the oscillator inline.
Non-repainting note: With Confirm on bar close enabled, signals are evaluated on closed bars. Intrabar previews can change until the bar closes—this is expected behavior in TradingView.
Limitations
This is an indicator for education/research. It does not execute trades, and visuals may differ from actual broker fills.
Performance varies by market conditions; thresholds and trail settings should be tested by the user.
Disclaimer
Nothing here is financial advice. Markets involve risk, including possible loss of capital. Always do your own research and test on a demo before using any tool in live trading.
— ProfitGang
Skrip sumber terbuka
Dalam semangat sebenar TradingView, pencipta skrip ini telah menjadikannya sumber terbuka supaya pedagang dapat menilai dan mengesahkan kefungsiannya. Terima kasih kepada penulis! Walaupun anda boleh menggunakannya secara percuma, ingat bahawa menerbitkan semula kod ini adalah tertakluk kepada Peraturan Dalaman kami.
profitgang
haze
haze
Penafian
Maklumat dan penerbitan adalah tidak dimaksudkan untuk menjadi, dan tidak membentuk, nasihat untuk kewangan, pelaburan, perdagangan dan jenis-jenis lain atau cadangan yang dibekalkan atau disahkan oleh TradingView. Baca dengan lebih lanjut di Terma Penggunaan.
Skrip sumber terbuka
Dalam semangat sebenar TradingView, pencipta skrip ini telah menjadikannya sumber terbuka supaya pedagang dapat menilai dan mengesahkan kefungsiannya. Terima kasih kepada penulis! Walaupun anda boleh menggunakannya secara percuma, ingat bahawa menerbitkan semula kod ini adalah tertakluk kepada Peraturan Dalaman kami.
profitgang
haze
haze
Penafian
Maklumat dan penerbitan adalah tidak dimaksudkan untuk menjadi, dan tidak membentuk, nasihat untuk kewangan, pelaburan, perdagangan dan jenis-jenis lain atau cadangan yang dibekalkan atau disahkan oleh TradingView. Baca dengan lebih lanjut di Terma Penggunaan.