OPEN-SOURCE SCRIPT
Zen CSC Bar Strategy v1

🧠 Zen Consecutive Bar Strategy — Research Tool (Trend + Reversal)
**Description:**
This strategy is designed as a flexible research tool for studying price behavior following consecutive bull or bear bars. It allows users to explore breakout and reversal scenarios with full control over trade entry and filtering logic.
**🔧 Key Features:**
* **Configurable bar sequence**: Detects customizable streaks of consecutive bull or bear bars.
* **Trend or Reversal mode**: Toggle between breakout-style entries or fade/reversal-style setups.
* **MA-based filter**: Optionally restrict trades to occur above or below the 20-period moving average.
* Longs can be limited to above/below MA
* Shorts can be limited to above/below MA
* **Customizable R-multiple targets**: Choose between 0.5R, 1R, 1.5R, or 2R reward targets.
* **Stop loss logic**: Uses syminfo.mintick to offset stops by 1 tick beyond the pattern high/low.
* **Entry logic**: Buy/Sell either on the close of the setup bar or on breakout beyond high/low.
* **Trade direction**: Enable long-only, short-only, or both.
**📊 Research Use Only:**
This is not a ready-to-trade system. It’s intended to help traders test ideas and collect performance stats under different configurations. Use it to:
* Evaluate the failure rate of open spikes
* Study behavior following strong directional bars
* Compare trend-following vs mean-reversion edge across sessions
**❗Disclaimer:**
This script is for educational purposes only. It does not constitute financial advice. Past performance does not guarantee future results.
**Description:**
This strategy is designed as a flexible research tool for studying price behavior following consecutive bull or bear bars. It allows users to explore breakout and reversal scenarios with full control over trade entry and filtering logic.
**🔧 Key Features:**
* **Configurable bar sequence**: Detects customizable streaks of consecutive bull or bear bars.
* **Trend or Reversal mode**: Toggle between breakout-style entries or fade/reversal-style setups.
* **MA-based filter**: Optionally restrict trades to occur above or below the 20-period moving average.
* Longs can be limited to above/below MA
* Shorts can be limited to above/below MA
* **Customizable R-multiple targets**: Choose between 0.5R, 1R, 1.5R, or 2R reward targets.
* **Stop loss logic**: Uses syminfo.mintick to offset stops by 1 tick beyond the pattern high/low.
* **Entry logic**: Buy/Sell either on the close of the setup bar or on breakout beyond high/low.
* **Trade direction**: Enable long-only, short-only, or both.
**📊 Research Use Only:**
This is not a ready-to-trade system. It’s intended to help traders test ideas and collect performance stats under different configurations. Use it to:
* Evaluate the failure rate of open spikes
* Study behavior following strong directional bars
* Compare trend-following vs mean-reversion edge across sessions
**❗Disclaimer:**
This script is for educational purposes only. It does not constitute financial advice. Past performance does not guarantee future results.
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.