Regime Guard + Turtle Breakout + MFE 2-Stage Trail | Long-only | — Strategy by a0101054

By a0101054

Performance Metrics

Description

**脚本名称**:HKEX 长线趋势突破(Regime Guard + Turtle Breakout + MFE 两段式 ATR 追踪止损)| Long-only | v6这是一个面向港股(含港股通整手规则)的**日线趋势跟随策略**,核心目标是在趋势行情中尽量吃到大波段,同时通过“制度过滤 + 两段式追踪止损”控制回撤与利润回吐。### 核心逻辑* **Regime Guard(趋势制度过滤)** 仅在价格位于 **EMA200 上方**时允许开仓;可选开启 **EMA200 斜率向上**过滤,降低震荡市的假突破。* **Turtle / Donchian Breakout(海龟突破)** 使用 Donchian 通道:突破 `Entry Len` 的上轨触发入场;跌破 `Exit Len` 的下轨触发离场(趋势反转退出)。* **MFE 2-Stage Trail(基于最高浮盈的两段式 ATR 追踪止损)** 使用持仓期间最高价(MFE)计算“盈利达到多少 R”,达到阈值后把追踪止损从“宽”切换为“紧”,以减少利润回吐。* **Breakeven(保本机制)** 盈利达到 `BE R` 后,将止损抬到成本附近,减少“盈利单回撤成亏损”的概率。* **风险与仓位控制(可选)** * `ATR% Guard`:过滤极端波动区间,减少脉冲行情误入 * `Volatility Targeting`:基于 ATR% 自动缩放仓位(高波动降仓、低波动放大) * `DD Scaling`:在权益回撤扩大时自动降仓,尽量压缩尾部风险 * `Risk Cap`:单次订单按“止损距离”限制最大风险(% equity)### 适用标的与周期* 适合:**有明显趋势阶段**、流动性较好、跳空不极端的标的* 默认:**日线(1D)*** Long-only:只做多,适用于趋势向上阶段的捕捉,不适合长期单边下跌票。### 港股通整手(Board Lot)* 下单数量按 `Board Lot Shares` 自动对齐整手(例如 100/200/500 股一手)。* 请根据券商显示的该股每手股数修改此参数。### 使用方法1. 将脚本添加到图表(建议 1D)。2. 在输入项中设置 `Board Lot Shares`、佣金/滑点等。3. 先用默认参数观察信号与止损线,再根据标的波动特性微调: * 更少回撤:降低 `trailTight` 或降低 `tightenAtR`(更早收紧) * 更能持有趋势:提高 `trailBase` 或提高 `tightenAtR`(更晚收紧) * 更少交易:开启 `Require EMA slope up` 或提高 `Entry Len`### 重要说明(必读)* 该策略为**教育与研究用途**,并非投资建议。* 回测结果高度依赖样本期、佣金、滑点、撮合规则与标的特性;实盘可能与回测显著不同。* 本策略属于趋势类系统,震荡期可能出现连续小亏,需配合风险控制与组合管理。---## English description (for TradingView)**Title**: HKEX Trend Breakout (Regime Guard + Turtle Breakout + MFE 2-Stage ATR Trail) | Long-only | v6This is a **daily trend-following strategy** designed for HKEX stocks (with **Stock Connect board-lot compliance**). The goal is to capture major trend legs while controlling drawdowns and profit giveback using a **regime filter** and an **MFE-based 2-stage trailing stop**.### Core components* **Regime Guard (Trend regime filter)** Entries are allowed only when price is **above EMA200**. Optionally require **positive EMA200 slope** to reduce chop/whipsaws.* **Turtle / Donchian Breakout** Classic Donchian channel breakout: cross above `Entry Len` high triggers entry; cross below `Exit Len` low triggers exit.* **MFE 2-Stage ATR Trailing Stop** Uses **MFE (highest high since entry)** to compute profit in “R”. Once MFE exceeds a threshold, the trailing stop switches from a **wider** ATR multiple to a **tighter** one, aiming to reduce trend profit giveback.* **Breakeven logic** After profit reaches `BE R`, the stop is raised to (at least) breakeven to reduce the chance of winners turning into losers.* **Risk & position scaling (optional)** * `ATR% Guard` to block entries during extreme volatility * `Volatility Targeting` to scale exposure by ATR% * `DD Scaling` to reduce exposure under larger equity drawdowns * `Risk Cap` to limit per-order risk based on stop distance### Best use cases* Works best on instruments with **clear trending phases**, decent liquidity, and relatively controlled gaps.* Default timeframe: **1D*** **Long-only** by design (trend capture on the upside; not intended for persistent bear markets).### HKEX Board Lot complianceOrder quantity is rounded to the configured **Board Lot Shares** (e.g., 100/200/500 shares per lot). Please set it according to your broker/exchange spec for the symbol.### How to use1. Add to chart (recommended 1D).2. Set `Board Lot Shares`, commission/slippage, and other inputs.3. Tune based on your instrument: * Lower drawdown: reduce `trailTight` and/or lower `tightenAtR` (tighten earlier) * Hold trends longer: increase `trailBase` and/or increase `tightenAtR` (tighten later) * Fewer trades: enable `Require EMA slope up` and/or increase `Entry Len`### DisclaimerThis script is for **educational/research purposes only** and does not constitute investment advice. Backtest performance depends heavily on sample period, fees, slippage, execution assumptions, and instrument characteristics. Real-world results may differ materially.

Browse all 5,900+ TradingView Pine Script strategies

View on TradingView