OPEN-SOURCE SCRIPT

Modular Range-Trading Strategy (V9.2)

315
# 模块化震荡行情策略 (V9.2)
# Modular Range-Trading Strategy (V9.2)

## 策略简介 | Strategy Overview
该策略基于布林带 (Bollinger Bands)、RSI、MACD、ADX 等经典指标的组合,通过多逻辑模块化结构识别震荡区间的价格反转机会,支持多空双向操作,并在相同逻辑下允许智能加仓,适用于震荡市场的回测和研究。

This strategy combines classic indicators such as Bollinger Bands, RSI, MACD, and ADX to identify price reversal opportunities within ranging markets. It features a modular multi-logic structure, allowing both long and short trades with intelligent pyramiding under the same logic. It is designed for backtesting and research in range-bound conditions.

---

## 功能特点 | Key Features
- **多逻辑结构**:支持多套震荡逻辑(动能确认均值回归、布林带极限反转等)。
- **加仓与仓位互斥**:同逻辑下可智能加仓,不同逻辑间自动互斥,避免冲突。
- **回测可调时间范围**:可自定义回测起止时间,精准评估策略表现。
- **指标可视化**:布林带、RSI、MACD 及动态 ATR 止损线实时绘图。
- **K线收盘确认信号**:通过 `barstate.isconfirmed` 控制信号,避免未收盘的虚假信号。

- **Multi-logic structure**: Supports multiple range-trading logics (e.g., momentum-based mean reversion, Bollinger Band reversals).
- **Pyramiding with mutual exclusion**: Allows intelligent pyramiding within the same logic while preventing conflicts between different logics.
- **Adjustable backtesting range**: Customizable start and end dates for accurate performance evaluation.
- **Visual indicators**: Real-time plotting of Bollinger Bands, RSI, MACD, and dynamic ATR stop lines.
- **Close-bar confirmation**: Uses `barstate.isconfirmed` to avoid false signals before bar close.

---

## 使用说明 | Usage
1. 将该脚本添加到 TradingView 图表。
2. 在参数中设置回测时间段和指标参数。
3. 仅用于学习与策略研究,请勿直接用于实盘交易。

1. Add this script to your TradingView chart.
2. Configure backtesting dates and indicator parameters as needed.
3. For educational and research purposes only. **Not for live trading.**

---

## ⚠️ 免责声明 | Disclaimer
本策略仅供学习和研究使用,不构成任何形式的投资建议。
作者不参与任何实盘交易、资金管理或收益分成,也不保证策略盈利能力。
严禁将本脚本用于任何非法集资、私募募资或与虚拟货币相关的金融违法活动。
使用本策略即表示您自行承担所有风险与法律责任。

This strategy is for educational and research purposes only and does not constitute investment advice.
The author does not participate in live trading, asset management, or profit sharing, nor guarantee profitability.
The use of this script in illegal fundraising, private placements, or cryptocurrency-related financial activities is strictly prohibited.
By using this strategy, you accept all risks and legal responsibilities.

---

Disclaimer

The information and publications are not meant to be, and do not constitute, financial, investment, trading, or other types of advice or recommendations supplied or endorsed by TradingView. Read more in the Terms of Use.