OPEN-SOURCE SCRIPT
3 Down, 3 Up Strategy

█ STRATEGY DESCRIPTION
The "3 Down, 3 Up Strategy" is a mean-reversion strategy designed to capitalize on short-term price reversals. It enters a long position after consecutive bearish closes and exits after consecutive bullish closes. This strategy is NOT optimized and can be used on any timeframes.
█ WHAT ARE CONSECUTIVE DOWN/UP CLOSES?
- Consecutive Down Closes: A sequence of trading bars where each close is lower than the previous close.
- Consecutive Up Closes: A sequence of trading bars where each close is higher than the previous close.
█ SIGNAL GENERATION
1. LONG ENTRY
A Buy Signal is triggered when:
2. EXIT CONDITION
█ ADDITIONAL SETTINGS
█ PERFORMANCE OVERVIEW
The "3 Down, 3 Up Strategy" is a mean-reversion strategy designed to capitalize on short-term price reversals. It enters a long position after consecutive bearish closes and exits after consecutive bullish closes. This strategy is NOT optimized and can be used on any timeframes.
█ WHAT ARE CONSECUTIVE DOWN/UP CLOSES?
- Consecutive Down Closes: A sequence of trading bars where each close is lower than the previous close.
- Consecutive Up Closes: A sequence of trading bars where each close is higher than the previous close.
█ SIGNAL GENERATION
1. LONG ENTRY
A Buy Signal is triggered when:
- The price closes lower than the previous close for Consecutive Down Closes for Entry (default: 3) consecutive bars.
- The signal occurs within the specified time window (between Start Time and End Time).
- If enabled, the close price must also be above the 200-period EMA (Exponential Moving Average).
2. EXIT CONDITION
- A Sell Signal is generated when the price closes higher than the previous close for Consecutive Up Closes for Exit (default: 3) consecutive bars.
█ ADDITIONAL SETTINGS
- Consecutive Down Closes for Entry: Number of consecutive lower closes required to trigger a buy. Default = 3.
- Consecutive Up Closes for Exit: Number of consecutive higher closes required to exit. Default = 3.
- EMA Filter: Optional 200-period EMA filter to confirm long entries in bullish trends. Default = disabled.
- Start Time and End Time: Restrict trading to specific dates (default: 2014-2099).
█ PERFORMANCE OVERVIEW
- Designed for volatile markets with frequent short-term reversals.
- Performs best when price oscillates between clear support/resistance levels.
- The EMA filter improves reliability in trending markets but may reduce trade frequency.
- Backtest to optimize consecutive close thresholds and EMA period for specific instruments.
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.