OPEN-SOURCE SCRIPT
已更新 Simple Trend & Breakout System v6

Key Features of the Strategy:
Multi-Timeframe (MTF) Trend Filter: The strategy uses a 240-period Exponential Moving Average (EMA) to determine the overall trend. Thanks to the MTF feature, the EMA is always anchored to the Daily (1D) chart by default, even if you switch your viewing chart to a Weekly timeframe. You can easily adjust the EMA length in steps of 5 within the settings.
Breakout Entry Logic: Instead of buying blindly, the script waits for bullish or bearish momentum (consecutive higher/lower closes). It then places a stop order 0.1% above the high (for longs) or below the low (for shorts) of the signal candle to catch the actual breakout.
Dynamic Percentage Trailing Stop: Exits are handled by a dynamic trailing stop set to 2.5% by default. It trails your position automatically, locking in profits and cutting losses, and is visualized directly on the chart (green line for longs, red line for shorts).
Realistic Backtesting Conditions: It includes a realistic trading commission of 0.01% per trade and allows you to set a custom Backtest Date Range (defaulting to 1998 - 2099).
Smart Data Handling (No Empty Drag): If you set the start year to 1922, but the asset data only begins in 1973, the script automatically detects the real start date. It calculates the CAGR accurately based only on the available data, preventing distorted, watered-down performance metrics.
Comprehensive StatTab: A dashboard in the bottom right corner gives you a direct comparison between your Strategy's performance and a pure Buy & Hold approach. It tracks Win Rate, Profit Factor, CAGR, Maximum Drawdowns, and the exact dates those drawdowns occurred.
Relative Equity Curve: An optional purple line that plots your strategy's equity growth directly onto the price chart. It anchors your starting capital to the asset's initial opening price, allowing you to visually see if your strategy is outperforming the underlying asset in real-time.
Multi-Timeframe (MTF) Trend Filter: The strategy uses a 240-period Exponential Moving Average (EMA) to determine the overall trend. Thanks to the MTF feature, the EMA is always anchored to the Daily (1D) chart by default, even if you switch your viewing chart to a Weekly timeframe. You can easily adjust the EMA length in steps of 5 within the settings.
Breakout Entry Logic: Instead of buying blindly, the script waits for bullish or bearish momentum (consecutive higher/lower closes). It then places a stop order 0.1% above the high (for longs) or below the low (for shorts) of the signal candle to catch the actual breakout.
Dynamic Percentage Trailing Stop: Exits are handled by a dynamic trailing stop set to 2.5% by default. It trails your position automatically, locking in profits and cutting losses, and is visualized directly on the chart (green line for longs, red line for shorts).
Realistic Backtesting Conditions: It includes a realistic trading commission of 0.01% per trade and allows you to set a custom Backtest Date Range (defaulting to 1998 - 2099).
Smart Data Handling (No Empty Drag): If you set the start year to 1922, but the asset data only begins in 1973, the script automatically detects the real start date. It calculates the CAGR accurately based only on the available data, preventing distorted, watered-down performance metrics.
Comprehensive StatTab: A dashboard in the bottom right corner gives you a direct comparison between your Strategy's performance and a pure Buy & Hold approach. It tracks Win Rate, Profit Factor, CAGR, Maximum Drawdowns, and the exact dates those drawdowns occurred.
Relative Equity Curve: An optional purple line that plots your strategy's equity growth directly onto the price chart. It anchors your starting capital to the asset's initial opening price, allowing you to visually see if your strategy is outperforming the underlying asset in real-time.
版本注释
v12 Update:// - Removed the continuous "Active Entry Line" that cluttered the chart during a trade.
// - Now strictly shows ONLY the pending trigger levels before entry and a 1-bar historical marker.
// v11 Update:
// - Overhauled "Pending Entry" visualization (live dashed line + historical 1-bar dash).
// v10/9/8/7 Updates:
// - Pro Dashboard, Time in Market, Calmar/Sortino Ratios, Trail plotting, Stop Year Bugfix.
开源脚本
秉承TradingView的精神,该脚本的作者将其开源,以便交易者可以查看和验证其功能。向作者致敬!您可以免费使用该脚本,但请记住,重新发布代码须遵守我们的网站规则。
免责声明
这些信息和出版物并非旨在提供,也不构成TradingView提供或认可的任何形式的财务、投资、交易或其他类型的建议或推荐。请阅读使用条款了解更多信息。
开源脚本
秉承TradingView的精神,该脚本的作者将其开源,以便交易者可以查看和验证其功能。向作者致敬!您可以免费使用该脚本,但请记住,重新发布代码须遵守我们的网站规则。
免责声明
这些信息和出版物并非旨在提供,也不构成TradingView提供或认可的任何形式的财务、投资、交易或其他类型的建议或推荐。请阅读使用条款了解更多信息。