OPEN-SOURCE SCRIPT
Stochastic Trend Signal with MTF Filter

Multi-Timeframe Stochastic Trend Filter – Real Signals with Confirmation Candles
This script is a multi-timeframe Stochastic trend filter designed to help traders identify reliable BUY/SELL signals based on both momentum and higher-timeframe trend context.
It combines three key components:
Entry Signal Logic:
Entry is based on the Stochastic Oscillator (%K, 14,3), where overbought/oversold conditions are detected in the current chart's timeframe.
A green (bullish) candle following a red candle with %K below 20 can trigger a BUY signal.
A red (bearish) candle following a green candle with %K above 80 can trigger a SELL signal.
Trend Confirmation – Daily Filter:
The script uses Stochastic on the 1D (Daily) timeframe to determine whether short-term momentum aligns with a broader daily trend.
BUY signals are only allowed if the Daily %K is above 50.
SELL signals are only allowed if the Daily %K is below 50.
Long-Term Trend Filter – Weekly Stochastic:
A second filter uses Weekly %K:
BUY signals are suppressed if the Weekly trend is bearish (Weekly %K < 50) while Daily %K is bullish (> 50).
SELL signals are suppressed if the Weekly trend is bullish (Weekly %K > 50) while Daily %K is bearish (< 50).
🖼️ The chart background changes color to visually assist users:
Green background: bullish alignment on Daily and Weekly Stochastic.
Red background: bearish alignment.
Gray background: trend conflict (Daily and Weekly disagree).
✅ This script is ideal for swing traders or position traders who want to enter with confirmation while avoiding false signals during trend conflict zones.
🔔 Alerts are provided for BUY and SELL signals once all conditions are met.
How to use:
Apply on timeframe (4H recommended).
Add alerts for "BUY Alert" and "SELL Alert".
Use background color and plotted labels as entry filters.
Disclaimer: This is not financial advice. Always use proper risk management and test on demo accounts first.
This script is a multi-timeframe Stochastic trend filter designed to help traders identify reliable BUY/SELL signals based on both momentum and higher-timeframe trend context.
It combines three key components:
Entry Signal Logic:
Entry is based on the Stochastic Oscillator (%K, 14,3), where overbought/oversold conditions are detected in the current chart's timeframe.
A green (bullish) candle following a red candle with %K below 20 can trigger a BUY signal.
A red (bearish) candle following a green candle with %K above 80 can trigger a SELL signal.
Trend Confirmation – Daily Filter:
The script uses Stochastic on the 1D (Daily) timeframe to determine whether short-term momentum aligns with a broader daily trend.
BUY signals are only allowed if the Daily %K is above 50.
SELL signals are only allowed if the Daily %K is below 50.
Long-Term Trend Filter – Weekly Stochastic:
A second filter uses Weekly %K:
BUY signals are suppressed if the Weekly trend is bearish (Weekly %K < 50) while Daily %K is bullish (> 50).
SELL signals are suppressed if the Weekly trend is bullish (Weekly %K > 50) while Daily %K is bearish (< 50).
🖼️ The chart background changes color to visually assist users:
Green background: bullish alignment on Daily and Weekly Stochastic.
Red background: bearish alignment.
Gray background: trend conflict (Daily and Weekly disagree).
✅ This script is ideal for swing traders or position traders who want to enter with confirmation while avoiding false signals during trend conflict zones.
🔔 Alerts are provided for BUY and SELL signals once all conditions are met.
How to use:
Apply on timeframe (4H recommended).
Add alerts for "BUY Alert" and "SELL Alert".
Use background color and plotted labels as entry filters.
Disclaimer: This is not financial advice. Always use proper risk management and test on demo accounts first.
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.