OPEN-SOURCE SCRIPT
업데이트됨 0 Turtle Breakout Pro v6.13

0 Turtle Breakout Pro v6.12
Overview
The Turtle Breakout Pro is a modern, highly advanced homage to the legendary Turtle Trading system engineered by Richard Dennis and William Eckhardt. This script transforms a traditional Donchian Channel breakout indicator into a fully-fledged, institutional-grade risk management engine. It doesn't just trade price action; it trades volatility.
Designed for Pine Script v6, this strategy dynamically adapts to market conditions by calculating position sizes based on the Average True Range (ATR – the famous Turtle "N"). It includes a comprehensive backtesting dashboard that introduces advanced metrics, such as distinguishing between "Time in Market" and actual "Capital Deployed".
Core Mechanics & Strategy Logic
The Entry (Donchian Breakout): The system triggers entries based on price breakouts from the Donchian Channel. You can customize the channel lengths for the upper and lower bands independently.
Dynamic Position Sizing (The "N"): This is the heart of the Turtle philosophy. By enabling position sizing, the strategy calculates the exact quantity to buy/sell so that a hit to your ATR Stop Loss will only cost you a predefined percentage of your total equity (e.g., 2%).
The 2N Stop-Loss: The system features an optional, hard ATR-based stop loss. It calculates the ATR at the exact moment of entry and freezes the stop-loss level, protecting your capital from sudden market crashes.
Volatility Filter: An optional ATR SMA filter ensures the system only takes breakout setups when the market is actively expanding, filtering out choppy, low-momentum sideways markets.
Key Features & Upgrades
Pro Dashboard (Table): A sleek, non-intrusive UI panel displaying deep performance metrics:
Comparison against Buy & Hold
CAGR, Max Drawdown, and absolute Return
Sharpe Ratio and Calmar Ratio
Advanced Exposure Tracking: Clearly separates "Time in Market" (how often you are in a trade) from "Avg. Capital Deployed" (how much of your cash is actually at risk).
Live Exposure Labels: Plots a dynamic label directly on the chart for every executed trade, showing you exactly what percentage of your total equity is deployed in that specific position. The distance of the label is dynamically tied to the ATR to prevent overlapping with chart candles.
Crash-Proof Math Engine: The sizing formula is fortified against runtime errors (RE 10024). It seamlessly handles micro-fractions for Crypto and Forex markets while ignoring infinite values caused by broken broker data.
Time Filtering: Built-in date range inputs allow for precise historical backtesting without altering the code.
How to Use
Apply to your chart and open the settings (⚙️).
Set your Max Position Risk % (Standard Turtle rule is 1% to 2%).
Adjust the ATR Risk Offset and ATR Stop Multiplier (Standard is 2.0 to replicate the classic 2N-Stop).
Decide if you want to allow Short Trades or run the system as a Long-Only trend follower.
Disclaimer: Trend following systems typically experience a lower win rate but capture massive outliers. Ensure you understand the psychological requirements of sitting through drawdowns before trading this system live.
Overview
The Turtle Breakout Pro is a modern, highly advanced homage to the legendary Turtle Trading system engineered by Richard Dennis and William Eckhardt. This script transforms a traditional Donchian Channel breakout indicator into a fully-fledged, institutional-grade risk management engine. It doesn't just trade price action; it trades volatility.
Designed for Pine Script v6, this strategy dynamically adapts to market conditions by calculating position sizes based on the Average True Range (ATR – the famous Turtle "N"). It includes a comprehensive backtesting dashboard that introduces advanced metrics, such as distinguishing between "Time in Market" and actual "Capital Deployed".
Core Mechanics & Strategy Logic
The Entry (Donchian Breakout): The system triggers entries based on price breakouts from the Donchian Channel. You can customize the channel lengths for the upper and lower bands independently.
Dynamic Position Sizing (The "N"): This is the heart of the Turtle philosophy. By enabling position sizing, the strategy calculates the exact quantity to buy/sell so that a hit to your ATR Stop Loss will only cost you a predefined percentage of your total equity (e.g., 2%).
The 2N Stop-Loss: The system features an optional, hard ATR-based stop loss. It calculates the ATR at the exact moment of entry and freezes the stop-loss level, protecting your capital from sudden market crashes.
Volatility Filter: An optional ATR SMA filter ensures the system only takes breakout setups when the market is actively expanding, filtering out choppy, low-momentum sideways markets.
Key Features & Upgrades
Pro Dashboard (Table): A sleek, non-intrusive UI panel displaying deep performance metrics:
Comparison against Buy & Hold
CAGR, Max Drawdown, and absolute Return
Sharpe Ratio and Calmar Ratio
Advanced Exposure Tracking: Clearly separates "Time in Market" (how often you are in a trade) from "Avg. Capital Deployed" (how much of your cash is actually at risk).
Live Exposure Labels: Plots a dynamic label directly on the chart for every executed trade, showing you exactly what percentage of your total equity is deployed in that specific position. The distance of the label is dynamically tied to the ATR to prevent overlapping with chart candles.
Crash-Proof Math Engine: The sizing formula is fortified against runtime errors (RE 10024). It seamlessly handles micro-fractions for Crypto and Forex markets while ignoring infinite values caused by broken broker data.
Time Filtering: Built-in date range inputs allow for precise historical backtesting without altering the code.
How to Use
Apply to your chart and open the settings (⚙️).
Set your Max Position Risk % (Standard Turtle rule is 1% to 2%).
Adjust the ATR Risk Offset and ATR Stop Multiplier (Standard is 2.0 to replicate the classic 2N-Stop).
Decide if you want to allow Short Trades or run the system as a Long-Only trend follower.
Disclaimer: Trend following systems typically experience a lower win rate but capture massive outliers. Ensure you understand the psychological requirements of sitting through drawdowns before trading this system live.
릴리즈 노트
// v6.14: Fixed Max Position Exposure calculation and added visual plots for ATR Stop Loss (lines) & ATR Volatility Filter (background).
릴리즈 노트
v6.16: Added Profit Factor, Win Rate, and Average Win/Loss Ratio to the performance dashboard.릴리즈 노트
v6.17: ATR Stop lines automatically disappear when trailing Donchian bands overtake them.릴리즈 노트
v6.18: Added optional Pyramiding (Scale-In) logic with remaining capital. Updated default ATR & Risk parameters.릴리즈 노트
// v6.22: Refactored Position Sizing to calculate exact Exposure based on anticipated execution (Stop) price.// v6.23: Updated default parameters (ATR 2, Risk 2.25). Added dynamic Dashboard Positioning and Sortino Ratio.
릴리즈 노트
// v6.25: Fixed Buy & Hold metrics to freeze when the Backtest End Date is reached instead of using current chart prices.// v6.26: Fixed parsing error (line too long) by replacing nested ternary operators with a switch statement for dashboard position.
릴리즈 노트
v6.27: Added Custom Interest Rate (Borrowing Costs) logic to adjust equity and metrics for realistic leverage simulation.// v6.28: Fixed local scope history reference warning for 'adj_equity[1]' inside the performance metrics calculation.
릴리즈 노트
// v6.29: Added Adj. Sortino and Calmar (by Capital Exposure). Reordered Dashboard.// v6.30: Removed maxval=100 limit on Exposure for leverage support. Fixed accurate Label Calculation by reversing openprofit.
// v6.31: Integrated 3 Drawdown Calculations (Strict Float, TV Standard, Closed) with Intra-Bar accuracy into the dashboard.
오픈 소스 스크립트
트레이딩뷰의 진정한 정신에 따라, 이 스크립트의 작성자는 이를 오픈소스로 공개하여 트레이더들이 기능을 검토하고 검증할 수 있도록 했습니다. 작성자에게 찬사를 보냅니다! 이 코드는 무료로 사용할 수 있지만, 코드를 재게시하는 경우 하우스 룰이 적용된다는 점을 기억하세요.
면책사항
해당 정보와 게시물은 금융, 투자, 트레이딩 또는 기타 유형의 조언이나 권장 사항으로 간주되지 않으며, 트레이딩뷰에서 제공하거나 보증하는 것이 아닙니다. 자세한 내용은 이용 약관을 참조하세요.
오픈 소스 스크립트
트레이딩뷰의 진정한 정신에 따라, 이 스크립트의 작성자는 이를 오픈소스로 공개하여 트레이더들이 기능을 검토하고 검증할 수 있도록 했습니다. 작성자에게 찬사를 보냅니다! 이 코드는 무료로 사용할 수 있지만, 코드를 재게시하는 경우 하우스 룰이 적용된다는 점을 기억하세요.
면책사항
해당 정보와 게시물은 금융, 투자, 트레이딩 또는 기타 유형의 조언이나 권장 사항으로 간주되지 않으며, 트레이딩뷰에서 제공하거나 보증하는 것이 아닙니다. 자세한 내용은 이용 약관을 참조하세요.