OPEN-SOURCE SCRIPT
Turtle System 1 (20/10) + N-Stop + MTF Table V7.2

🐢 Description: Turtle System 1 (20/10) IndicatorThis indicator implements the original trading signals of the Turtle Trading System 1 based on the classic Donchian Channels. It incorporates a historically correct, volatility-based Trailing Stop (N-Stop) and a Multi-Timeframe (MTF) status dashboard. The script is written in Pine Script v6, optimized for performance and reliability.📊 Core Logic and ParametersThe system is a pure trend-following model, utilizing the more widely known, conservative parameters of the Turtle System 1:FunctionParameterValueDescriptionEntry$\text{Donchian Breakout}$$\mathbf{20}$Buy/Sell upon breaking the 20-day High/Low.Exit (Turtle)$\text{Donchian Breakout}$$\mathbf{10}$Close the position upon breaking the 10-day Low/High.Volatility$\mathbf{N}$ (ATR Period)$\mathbf{20}$Calculation of market volatility using the Average True Range (ATR).Stop-LossMultiplier$\mathbf{2.0}
SETS the initial and Trailing Stop at $\mathbf{2N}$.🛠️ Key Technical Features1. Original Turtle Trailing Stop (Section 4)The stop-loss mechanism is implemented with the historically accurate Turtle Trailing Logic. The stop is not aggressively tied to the current candle's low/high, which often causes premature exits. Instead, the stop only trails in the direction of the trend, maximizing the previous stop price against the new calculated $\text{Close} \pm 2N$:$$\text{New Trailing Stop} = \text{max}(\text{Previous Stop}, \text{Close} \pm (2 \times N))$$2. Reliable Multi-Timeframe (MTF) Status (Section 6)The indicator features a robust MTF status table.Purpose: It calculates and persistently stores the Turtle System 1 status (LONG=1, SHORT=-1, FLAT=0) for various timeframes (1H, 4H, 8H, 1D, and 1W).Method: It uses global var int variables combined with request.security(), ensuring the status is accurately maintained and updated across different bars and timeframes, providing a reliable higher-timeframe context.3. VisualizationsChannels: The 20-period (Entry) and 10-period (Exit) Donchian Channels are plotted.Stop Line: The dynamic $\mathbf{2N}$ Trailing Stop is visible as a distinct line.Signals: plotshape markers indicate Entry and Exit.MTF Table: A clean, color-coded status summary is displayed in the upper right corner.
Mã nguồn mở
Theo đúng tinh thần TradingView, tác giả của tập lệnh này đã công bố nó dưới dạng mã nguồn mở, để các nhà giao dịch có thể xem xét và xác minh chức năng. Chúc mừng tác giả! Mặc dù bạn có thể sử dụng miễn phí, hãy nhớ rằng việc công bố lại mã phải tuân theo Nội Quy.
Thông báo miễn trừ trách nhiệm
Thông tin và các ấn phẩm này không nhằm mục đích, và không cấu thành, lời khuyên hoặc khuyến nghị về tài chính, đầu tư, giao dịch hay các loại khác do TradingView cung cấp hoặc xác nhận. Đọc thêm tại Điều khoản Sử dụng.
Mã nguồn mở
Theo đúng tinh thần TradingView, tác giả của tập lệnh này đã công bố nó dưới dạng mã nguồn mở, để các nhà giao dịch có thể xem xét và xác minh chức năng. Chúc mừng tác giả! Mặc dù bạn có thể sử dụng miễn phí, hãy nhớ rằng việc công bố lại mã phải tuân theo Nội Quy.
Thông báo miễn trừ trách nhiệm
Thông tin và các ấn phẩm này không nhằm mục đích, và không cấu thành, lời khuyên hoặc khuyến nghị về tài chính, đầu tư, giao dịch hay các loại khác do TradingView cung cấp hoặc xác nhận. Đọc thêm tại Điều khoản Sử dụng.