OPEN-SOURCE SCRIPT
Trend Following: Turtle Trading Strategy - Pyramiding Edition

📚 Strategy Origins
This indicator is based on the legendary Turtle Trading Rules
featured in "Trend Following" classics, combining Donchian
Channel breakouts with pyramiding system, designed specifically
for capturing mid-to-long term trends.
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
⚙️ Core Mechanics
【Entry Logic】
- Break above 20-period Donchian high → Go Long
- Break below 20-period Donchian low → Go Short
【Exit Logic】
- Fall to 10-period Donchian low → Close Long
- Rise to 10-period Donchian high → Close Short
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
🛡️ Risk Management System
【Triple Protection Mechanism】
1️⃣ Per-Trade Risk: Only 2% capital risk per trade
2️⃣ ATR Dynamic Stop: 2x ATR distance, adapts to volatility
3️⃣ Drawdown Circuit Breaker: Auto-close at 25% max drawdown
【Trailing Stop】
- Automatically updates stop after each pyramid add
- Protects profits while letting winners run
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
🏔️ Pyramiding Logic
【Add-On Conditions】
- Price moves 0.5 ATR in favorable direction → Trigger add
- Maximum 4 additions (5 total position layers)
- Each add = 100% of base position size
【Pyramiding Advantages】
✓ Scale into trends, maximize gains in strong moves
✓ ATR-based spacing prevents overtrading
✓ Visual markers (🚀 L1, 📈 L2...) for clear tracking
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
🎯 Unique Optimization: Dual Timeframe Filter
【Daily 20 SMA Filter】
Yellow line on chart = Daily timeframe 20 SMA
📊 Filter Rules:
- 4H candle price > Daily 20 SMA → Long trades only
- 4H candle price < Daily 20 SMA → Short trades only
💡 Advantage: Avoids whipsaws in ranging markets,
ensures trading with the trend
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
⏰ Optimal Usage Environment
【Recommended Settings】
📌 Timeframe: 4-Hour Chart (4H)
📌 Assets: High-volatility Altcoins
📌 Money Management: Strict 2% per-trade risk
【Why 4H + Altcoins?】
- 4H timeframe: Optimal balance between noise and trend
- Altcoins: High volatility & strong trends fit Turtle logic
- Backtest edge: Outperforms BTC in most scenarios
⚠️ Risk Warning: High volatility = High reward potential + High drawdown risk
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
📊 Visualization Features
✅ Real-time Markers:
- 🚀 Initial entry labels (L1/S1)
- 📈📉 Pyramid addition markers (L2~L5)
- 💰 Exit signals with P&L percentage
✅ Helper Lines:
- Yellow line: Daily 20 SMA (trend direction)
- Blue crosses: Initial entry price
- Green/Orange dots: Next pyramid trigger price
✅ Background Alerts:
- Red background: Risk zone / Drawdown warning
- Yellow background: Multi-layer pyramid alert
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
⚙️ Parameter Guide
【Basic Parameters】
- Entry Channel: 20-period (classic Turtle setting)
- Exit Channel: 10-period (quick profit-taking)
- ATR Period: 14 (dynamic volatility measure)
【Risk Management】
- Risk per Trade: 2% (adjustable 0.5~5%)
- ATR Stop Multiplier: 2x (adjustable for conservatism)
- Max Drawdown: 25% (circuit breaker protection)
【Pyramiding Settings】
- Max Additions: 4 times (5 total layers)
- Trigger Distance: 0.5 ATR
- Add Size: 100% (equal sizing)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
⚠️ Important Notes
1. This is a trend-following system; may underperform in ranging markets
2. Drawdowns are inevitable cost of trend trading; psychological tolerance required
3. Pyramiding amplifies both gains and losses; strict risk management essential
4. Recommended to test on paper trading first before going live
5. Altcoin liquidity varies; watch for slippage and trading costs
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
📖 Ideal For
✓ Traders familiar with Turtle Trading Rules
✓ Medium-to-long term investors who can handle drawdowns
✓ Systematic trading enthusiasts
✓ Altcoin trend opportunity seekers
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
💡 Usage Tips
1. Backtest First: Thoroughly test on target assets
2. Parameter Tuning: Adjust ATR multiplier based on asset characteristics
3. Diversification: Don't put all eggs in one strategy basket
4. Keep Records: Maintain trading journal for regular review
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
【Key Features vs Traditional Turtle】
- Added: Daily MA filter to reduce false breakouts
- Enhanced: Trailing stop mechanism to protect profits
- Visual: Clear chart labeling system
【Real-World Application】
On high-volatility altcoins like SOL, AVAX, MATIC,
this strategy effectively captures major trend moves
from 2022-2024, with single-trend returns of 50%+
(including pyramiding effect)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
📌 Disclaimer:
This indicator is for educational and reference purposes only
and does not constitute investment advice. Cryptocurrency
trading carries high risk; please make decisions based on
your own circumstances.
Happy Trading! 🚀
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
🐢 海龜交易法則 - 金字塔加碼版
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
📚 策略靈感來源
本指標基於經典著作《趨勢跟蹤》中的海龜交易法則,
結合 Donchian 通道突破與金字塔加碼系統,
專為捕捉中長期趨勢而設計。
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
⚙️ 核心機制
【進場邏輯】
- 突破 20 週期 Donchian 通道高點 → 做多
- 跌破 20 週期 Donchian 通道低點 → 做空
【出場邏輯】
- 回落至 10 週期 Donchian 通道低點 → 多單出場
- 反彈至 10 週期 Donchian 通道高點 → 空單出場
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
🛡️ 風險控管系統
【三層保護機制】
1️⃣ 單筆風險控制:每筆交易僅冒 2% 資金風險
2️⃣ ATR 動態停損:2 倍 ATR 距離,適應市場波動
3️⃣ 回撤熔斷:達 25% 最大回撤自動平倉保護
【移動停損】
- 加碼後自動更新停損位
- 保護浮盈,讓利潤奔跑
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
🏔️ 金字塔加碼邏輯
【加碼條件】
- 價格朝有利方向移動 0.5 ATR → 觸發加碼
- 最多加碼 4 次(共 5 層倉位)
- 每次加碼為基礎倉位的 100%
【加碼優勢】
✓ 順勢增加曝險,在強趨勢中擴大收益
✓ ATR 動態調整,避免過度交易
✓ 視覺化標記(🚀 L1、📈 L2...),清晰追蹤
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
🎯 獨特優化:雙時間週期過濾
【日線 20 均線過濾】
圖表上的黃色線 = 日線級別的 20 SMA
📊 過濾規則:
- 4H K棒價格 > 日線 20 均線 → 僅開多單
- 4H K棒價格 < 日線 20 均線 → 僅開空單
💡 優勢:避免在震蕩市中頻繁交易,確保順勢而為
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
⏰ 最佳使用環境
【推薦配置】
📌 時間週期:4 小時線圖(4H)
📌 交易標的:高波動山寨幣
📌 資金管理:嚴守 2% 單筆風險
【為什麼選 4H + 山寨幣?】
- 4H 週期:平衡噪音與趨勢的最佳時間框架
- 山寨幣:波動大、趨勢強,更符合海龜法則邏輯
- 回測優勢:相比 BTC,山寨幣的績效表現更出色
⚠️ 風險提示:高波動 = 高收益潛力 + 高回撤風險
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
📊 視覺化功能
✅ 即時標記:
- 🚀 初始進場標記(L1/S1)
- 📈📉 加碼位置標記(L2~L5)
- 💰 出場信號與損益百分比
✅ 輔助線條:
- 黃色線:日線 20 均線(趨勢方向)
- 藍色叉號:初始進場價格
- 綠/橙圓點:下次加碼觸發價位
✅ 背景提示:
- 紅色背景:風險區 / 回撤警告
- 黃色背景:多層加碼提醒
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
⚙️ 參數說明
【基礎參數】
- 進場通道:20 週期(經典海龜設定)
- 出場通道:10 週期(快速止盈)
- ATR 週期:14(動態波動率)
【風險管理】
- 每筆風險:2%(可調 0.5~5%)
- ATR 停損:2 倍(可調整保守程度)
- 最大回撤:25%(熔斷保護)
【加碼設定】
- 加碼次數:4 次(共 5 層倉位)
- 觸發距離:0.5 ATR
- 加碼比例:100%(等量加碼)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
⚠️ 重要提醒
1. 本策略為趨勢跟蹤系統,在震蕩市可能表現不佳
2. 回撤是趨勢策略的必然代價,需要心理承受力
3. 金字塔加碼會放大盈虧,務必嚴守風險管理
4. 建議先在模擬盤測試,熟悉策略邏輯後再實盤
5. 山寨幣流動性差異大,需注意滑點與交易成本
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
📖 適合對象
✓ 熟悉海龜交易法則的交易者
✓ 能承受回撤的中長期投資者
✓ 偏好系統化交易的量化愛好者
✓ 尋找山寨幣趨勢機會的投機者
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
💡 使用建議
1. 回測驗證:在目標幣種上進行充分回測
2. 參數調整:根據標的特性微調 ATR 倍數
3. 分散投資:不要將全部資金用於單一策略
4. 記錄追蹤:保持交易日誌,定期檢討優化
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
📌 免責聲明:
本指標僅供教育和參考用途,不構成投資建議。
加密貨幣交易存在高風險,請根據自身情況謹慎決策。
祝交易順利!🚀
This indicator is based on the legendary Turtle Trading Rules
featured in "Trend Following" classics, combining Donchian
Channel breakouts with pyramiding system, designed specifically
for capturing mid-to-long term trends.
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
⚙️ Core Mechanics
【Entry Logic】
- Break above 20-period Donchian high → Go Long
- Break below 20-period Donchian low → Go Short
【Exit Logic】
- Fall to 10-period Donchian low → Close Long
- Rise to 10-period Donchian high → Close Short
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
🛡️ Risk Management System
【Triple Protection Mechanism】
1️⃣ Per-Trade Risk: Only 2% capital risk per trade
2️⃣ ATR Dynamic Stop: 2x ATR distance, adapts to volatility
3️⃣ Drawdown Circuit Breaker: Auto-close at 25% max drawdown
【Trailing Stop】
- Automatically updates stop after each pyramid add
- Protects profits while letting winners run
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
🏔️ Pyramiding Logic
【Add-On Conditions】
- Price moves 0.5 ATR in favorable direction → Trigger add
- Maximum 4 additions (5 total position layers)
- Each add = 100% of base position size
【Pyramiding Advantages】
✓ Scale into trends, maximize gains in strong moves
✓ ATR-based spacing prevents overtrading
✓ Visual markers (🚀 L1, 📈 L2...) for clear tracking
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
🎯 Unique Optimization: Dual Timeframe Filter
【Daily 20 SMA Filter】
Yellow line on chart = Daily timeframe 20 SMA
📊 Filter Rules:
- 4H candle price > Daily 20 SMA → Long trades only
- 4H candle price < Daily 20 SMA → Short trades only
💡 Advantage: Avoids whipsaws in ranging markets,
ensures trading with the trend
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
⏰ Optimal Usage Environment
【Recommended Settings】
📌 Timeframe: 4-Hour Chart (4H)
📌 Assets: High-volatility Altcoins
📌 Money Management: Strict 2% per-trade risk
【Why 4H + Altcoins?】
- 4H timeframe: Optimal balance between noise and trend
- Altcoins: High volatility & strong trends fit Turtle logic
- Backtest edge: Outperforms BTC in most scenarios
⚠️ Risk Warning: High volatility = High reward potential + High drawdown risk
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
📊 Visualization Features
✅ Real-time Markers:
- 🚀 Initial entry labels (L1/S1)
- 📈📉 Pyramid addition markers (L2~L5)
- 💰 Exit signals with P&L percentage
✅ Helper Lines:
- Yellow line: Daily 20 SMA (trend direction)
- Blue crosses: Initial entry price
- Green/Orange dots: Next pyramid trigger price
✅ Background Alerts:
- Red background: Risk zone / Drawdown warning
- Yellow background: Multi-layer pyramid alert
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
⚙️ Parameter Guide
【Basic Parameters】
- Entry Channel: 20-period (classic Turtle setting)
- Exit Channel: 10-period (quick profit-taking)
- ATR Period: 14 (dynamic volatility measure)
【Risk Management】
- Risk per Trade: 2% (adjustable 0.5~5%)
- ATR Stop Multiplier: 2x (adjustable for conservatism)
- Max Drawdown: 25% (circuit breaker protection)
【Pyramiding Settings】
- Max Additions: 4 times (5 total layers)
- Trigger Distance: 0.5 ATR
- Add Size: 100% (equal sizing)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
⚠️ Important Notes
1. This is a trend-following system; may underperform in ranging markets
2. Drawdowns are inevitable cost of trend trading; psychological tolerance required
3. Pyramiding amplifies both gains and losses; strict risk management essential
4. Recommended to test on paper trading first before going live
5. Altcoin liquidity varies; watch for slippage and trading costs
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
📖 Ideal For
✓ Traders familiar with Turtle Trading Rules
✓ Medium-to-long term investors who can handle drawdowns
✓ Systematic trading enthusiasts
✓ Altcoin trend opportunity seekers
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
💡 Usage Tips
1. Backtest First: Thoroughly test on target assets
2. Parameter Tuning: Adjust ATR multiplier based on asset characteristics
3. Diversification: Don't put all eggs in one strategy basket
4. Keep Records: Maintain trading journal for regular review
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
【Key Features vs Traditional Turtle】
- Added: Daily MA filter to reduce false breakouts
- Enhanced: Trailing stop mechanism to protect profits
- Visual: Clear chart labeling system
【Real-World Application】
On high-volatility altcoins like SOL, AVAX, MATIC,
this strategy effectively captures major trend moves
from 2022-2024, with single-trend returns of 50%+
(including pyramiding effect)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
📌 Disclaimer:
This indicator is for educational and reference purposes only
and does not constitute investment advice. Cryptocurrency
trading carries high risk; please make decisions based on
your own circumstances.
Happy Trading! 🚀
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
🐢 海龜交易法則 - 金字塔加碼版
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
📚 策略靈感來源
本指標基於經典著作《趨勢跟蹤》中的海龜交易法則,
結合 Donchian 通道突破與金字塔加碼系統,
專為捕捉中長期趨勢而設計。
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
⚙️ 核心機制
【進場邏輯】
- 突破 20 週期 Donchian 通道高點 → 做多
- 跌破 20 週期 Donchian 通道低點 → 做空
【出場邏輯】
- 回落至 10 週期 Donchian 通道低點 → 多單出場
- 反彈至 10 週期 Donchian 通道高點 → 空單出場
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
🛡️ 風險控管系統
【三層保護機制】
1️⃣ 單筆風險控制:每筆交易僅冒 2% 資金風險
2️⃣ ATR 動態停損:2 倍 ATR 距離,適應市場波動
3️⃣ 回撤熔斷:達 25% 最大回撤自動平倉保護
【移動停損】
- 加碼後自動更新停損位
- 保護浮盈,讓利潤奔跑
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
🏔️ 金字塔加碼邏輯
【加碼條件】
- 價格朝有利方向移動 0.5 ATR → 觸發加碼
- 最多加碼 4 次(共 5 層倉位)
- 每次加碼為基礎倉位的 100%
【加碼優勢】
✓ 順勢增加曝險,在強趨勢中擴大收益
✓ ATR 動態調整,避免過度交易
✓ 視覺化標記(🚀 L1、📈 L2...),清晰追蹤
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
🎯 獨特優化:雙時間週期過濾
【日線 20 均線過濾】
圖表上的黃色線 = 日線級別的 20 SMA
📊 過濾規則:
- 4H K棒價格 > 日線 20 均線 → 僅開多單
- 4H K棒價格 < 日線 20 均線 → 僅開空單
💡 優勢:避免在震蕩市中頻繁交易,確保順勢而為
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
⏰ 最佳使用環境
【推薦配置】
📌 時間週期:4 小時線圖(4H)
📌 交易標的:高波動山寨幣
📌 資金管理:嚴守 2% 單筆風險
【為什麼選 4H + 山寨幣?】
- 4H 週期:平衡噪音與趨勢的最佳時間框架
- 山寨幣:波動大、趨勢強,更符合海龜法則邏輯
- 回測優勢:相比 BTC,山寨幣的績效表現更出色
⚠️ 風險提示:高波動 = 高收益潛力 + 高回撤風險
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
📊 視覺化功能
✅ 即時標記:
- 🚀 初始進場標記(L1/S1)
- 📈📉 加碼位置標記(L2~L5)
- 💰 出場信號與損益百分比
✅ 輔助線條:
- 黃色線:日線 20 均線(趨勢方向)
- 藍色叉號:初始進場價格
- 綠/橙圓點:下次加碼觸發價位
✅ 背景提示:
- 紅色背景:風險區 / 回撤警告
- 黃色背景:多層加碼提醒
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
⚙️ 參數說明
【基礎參數】
- 進場通道:20 週期(經典海龜設定)
- 出場通道:10 週期(快速止盈)
- ATR 週期:14(動態波動率)
【風險管理】
- 每筆風險:2%(可調 0.5~5%)
- ATR 停損:2 倍(可調整保守程度)
- 最大回撤:25%(熔斷保護)
【加碼設定】
- 加碼次數:4 次(共 5 層倉位)
- 觸發距離:0.5 ATR
- 加碼比例:100%(等量加碼)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
⚠️ 重要提醒
1. 本策略為趨勢跟蹤系統,在震蕩市可能表現不佳
2. 回撤是趨勢策略的必然代價,需要心理承受力
3. 金字塔加碼會放大盈虧,務必嚴守風險管理
4. 建議先在模擬盤測試,熟悉策略邏輯後再實盤
5. 山寨幣流動性差異大,需注意滑點與交易成本
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
📖 適合對象
✓ 熟悉海龜交易法則的交易者
✓ 能承受回撤的中長期投資者
✓ 偏好系統化交易的量化愛好者
✓ 尋找山寨幣趨勢機會的投機者
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
💡 使用建議
1. 回測驗證:在目標幣種上進行充分回測
2. 參數調整:根據標的特性微調 ATR 倍數
3. 分散投資:不要將全部資金用於單一策略
4. 記錄追蹤:保持交易日誌,定期檢討優化
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
📌 免責聲明:
本指標僅供教育和參考用途,不構成投資建議。
加密貨幣交易存在高風險,請根據自身情況謹慎決策。
祝交易順利!🚀
Script open-source
In pieno spirito TradingView, il creatore di questo script lo ha reso open-source, in modo che i trader possano esaminarlo e verificarne la funzionalità. Complimenti all'autore! Sebbene sia possibile utilizzarlo gratuitamente, ricorda che la ripubblicazione del codice è soggetta al nostro Regolamento.
Declinazione di responsabilità
Le informazioni ed i contenuti pubblicati non costituiscono in alcun modo una sollecitazione ad investire o ad operare nei mercati finanziari. Non sono inoltre fornite o supportate da TradingView. Maggiori dettagli nelle Condizioni d'uso.
Script open-source
In pieno spirito TradingView, il creatore di questo script lo ha reso open-source, in modo che i trader possano esaminarlo e verificarne la funzionalità. Complimenti all'autore! Sebbene sia possibile utilizzarlo gratuitamente, ricorda che la ripubblicazione del codice è soggetta al nostro Regolamento.
Declinazione di responsabilità
Le informazioni ed i contenuti pubblicati non costituiscono in alcun modo una sollecitazione ad investire o ad operare nei mercati finanziari. Non sono inoltre fornite o supportate da TradingView. Maggiori dettagli nelle Condizioni d'uso.