INVITE-ONLY SCRIPT

Trend following swing

33
Strategy: Trend-Following Swing (波段)

This strategy is designed to identify and capitalize on potential swing movements within a prevailing trend. It combines multiple technical indicators to generate entry signals with an emphasis on momentum, trend strength, and a defined trading window.

Core Logic:

Momentum Identification (RMI): A custom Relative Momentum Index (RMI) is calculated by averaging a standard RSI and the Money Flow Index (MFI). This hybrid oscillator aims to gauge momentum strength more robustly.

A Long (Buy) signal is generated when the RMI crosses above a user-defined upper threshold (e.g., 66) while also being above a lower threshold and accompanied by a rising short-term EMA.

A Short (Sell) signal is generated when the RMI is below a user-defined lower threshold (e.g., 30) accompanied by a declining short-term EMA.

Trend Strength Filter (ADX): To ensure entries align with stronger trends, signals are only executed if the Average Directional Index (ADX) is above a specified level (e.g., 25), indicating a non-range-bound market.

Time Filter: Trading is restricted to a specific session window each day (e.g., 09:30 to 16:00) to focus on the most active or favorable market hours and potentially avoid off-hours volatility.

Dynamic Position Sizing & Visualization: The strategy incorporates a unique volatility-based band (Band) calculated from the Average True Range (ATR). This band, along with a Range-Weighted Moving Average (RWMA), is plotted on the chart. The visual fills and candle colors change (e.g., Bullish: Cyan, Bearish: Red) based on the active signal, providing a clear graphical representation of the current market bias and expected price range.

Risk Management - Auto-Exit: All open positions are automatically closed at a specified time each day (e.g., 16:10), enforcing a disciplined exit and preventing overnight risk.

In summary, this is a systematic trend-following swing trading strategy that uses momentum confirmation (RMI), trend strength filtering (ADX), time-based execution, and automated session-end risk closure. 本策略是一个旨在捕捉市场趋势中的波段机会的自动化交易系统。它通过结合动量指标、趋势强度过滤器和时间窗口管理,来识别高概率的交易入场点,并辅以独特的可视化工具和严格的日内风险控制。

核心逻辑与组成部分:

动量信号生成 (核心):

使用一个自定义的相对动量指数 (RMI),该指数由标准RSI和资金流量指数 (MFI) 平均计算而成,能更全面地衡量市场动量。

做多信号 (Buy): 当RMI从下方穿越用户设定的上限(默认66)且高于下限,同时短期EMA均线开始上扬时产生。

做空信号 (Sell): 当RMI低于用户设定的下限(默认30)且短期EMA均线开始下降时产生。

趋势强度过滤 (ADX过滤器):

引入了平均方向指数 (ADX) 作为趋势强度的过滤器。

只有当ADX值高于预设水平(默认25)时,产生的交易信号才会被执行。这确保了策略只在市场趋势明确、有足够力度的环境中开仓,有效避免在震荡市中频繁交易。

交易时间窗口:

策略可以限定在每天的特定时间段内进行交易(例如默认:09:30 - 16:00)。这有助于聚焦于市场流动性最强、趋势最明显的时段,规避开盘初期和盘后的异常波动。

动态波段与可视化:

策略基于平均真实波幅 (ATR) 计算出一个动态的波动率带宽 (Band)。

结合范围加权移动平均线 (RWMA),在主图上绘制出可视化的通道区域。该通道会根据当前信号方向(多头/空头)改变颜色(默认多头为青色,空头为红色),直观地展示当前的趋势方向、预期波动范围以及持仓状态。

风险管理与自动离场:

策略内置严格的定时平仓机制。所有持仓会在每个交易日的指定时间(例如16:10)被自动平仓,强制实现日内了结,有效规避隔夜跳空风险,符合波段交易的纪律性要求。

策略总结:

该“趋势跟随波段策略”是一个集信号生成、趋势过滤、时间管理和可视化于一体的综合性交易系统。它通过多条件确认来提高信号质量,并强调严格的日内风险控制,旨在通过跟随市场主流趋势进行波段操作,实现稳健的收益。

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.