OPEN-SOURCE SCRIPT
Sell to Buy / Buy to Sell

Sell to Buy / Buy to Sell — Momentum Shift Detector
The Sell to Buy / Buy to Sell indicator detects simple but powerful two-bar momentum shift patterns directly on your chart, offering early insights into potential reversals or strong breakout continuation.
🔎 How it works:
Sell to Buy (StB):
Previous candle (bar -1) is bearish
Current candle (bar 0) is bullish
The bullish candle closes above the high of the previous bearish candle
Confirmed only after bar close
Buy to Sell (BtS):
Previous candle (bar -1) is bullish
Current candle (bar 0) is bearish
The bearish candle closes below the low of the previous bullish candle
Confirmed only after bar close
🎯 Key Features:
✅ Pure price action logic — no indicators, no oscillators
✅ Immediate visual markers:
Green "StB" label for bullish momentum shifts
Red "BtS" label for bearish momentum shifts
✅ Full alert system to notify you in real-time when either pattern occurs
⚙ Who is this for?
Scalpers looking for short-term momentum shifts
Swing traders identifying potential reversals or breakout confirmations
Price action traders who want clean and objective setup detection
The Sell to Buy / Buy to Sell indicator is designed to give you clear and simple signals whenever the market shows decisive strength after a short-term opposite move — potentially marking the start of a new impulse.
The Sell to Buy / Buy to Sell indicator detects simple but powerful two-bar momentum shift patterns directly on your chart, offering early insights into potential reversals or strong breakout continuation.
🔎 How it works:
Sell to Buy (StB):
Previous candle (bar -1) is bearish
Current candle (bar 0) is bullish
The bullish candle closes above the high of the previous bearish candle
Confirmed only after bar close
Buy to Sell (BtS):
Previous candle (bar -1) is bullish
Current candle (bar 0) is bearish
The bearish candle closes below the low of the previous bullish candle
Confirmed only after bar close
🎯 Key Features:
✅ Pure price action logic — no indicators, no oscillators
✅ Immediate visual markers:
Green "StB" label for bullish momentum shifts
Red "BtS" label for bearish momentum shifts
✅ Full alert system to notify you in real-time when either pattern occurs
⚙ Who is this for?
Scalpers looking for short-term momentum shifts
Swing traders identifying potential reversals or breakout confirmations
Price action traders who want clean and objective setup detection
The Sell to Buy / Buy to Sell indicator is designed to give you clear and simple signals whenever the market shows decisive strength after a short-term opposite move — potentially marking the start of a new impulse.
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.