OPEN-SOURCE SCRIPT
Smart Deviation Trend Bands PRO + MTF Filter

Smart Deviation Trend Bands PRO + MTF Filter
This advanced version of Smart Deviation Bands gives you everything you need to catch cleaner trend bounces and avoid fake signals.
🔹 Classic deviation bands with 1, 2 and 3 standard deviations
🔹 Dynamic SMA line with clear trend coloring
🔹 Built-in multi-timeframe trend filter (MTF)
🔹 Signals only appear when they align with the higher timeframe trend
🔹 Ready-to-use alerts for bullish and bearish bounces
How it works
The script plots classic standard deviation bands around a dynamic Simple Moving Average (SMA). The three bands (1, 2 and 3 standard deviations) help you spot different levels of pullbacks or extensions relative to the trend.
A built-in multi-timeframe filter checks the trend on a higher timeframe (HTF). A signal appears only when a bounce aligns with the bigger trend:
Bullish bounce: Price crosses up from the lower deviation band while the HTF trend is up.
Bearish bounce: Price crosses down from the upper deviation band while the HTF trend is down.
Signal markers
🟢 Green circle: Bullish bounce — price crossing up from lower band with HTF uptrend
🔴 Red circle: Bearish bounce — price crossing down from upper band with HTF downtrend
How to use
Works on any market (crypto, stocks, forex).
Works on any timeframe — the filter can use any higher timeframe you choose (for example, H4, 1D, 1W).
Fully adjustable settings: SMA length, standard deviation multipliers, and filter timeframe.
Combine this with your strategy to filter out fake breakouts and trade in line with the bigger trend.
⚠️ Disclaimer: This script is for educational purposes only and does not constitute financial advice. Always test any strategy thoroughly and trade at your own risk.
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.
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.
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.