OPEN-SOURCE SCRIPT

Turtle 2.0 – Backtest Strategy for Trend Confirmation

173
A simple backtesting tool for traders who want to test and understand their own ideas.

This is not a signal provider. Not a finished system. Not financial advice.

Purpose of this Script

This strategy is not intended for live trading, but rather as an analytical and educational tool.
It is based on a simplified, trend-following Turtle-style logic and helps you explore the question:

“When does a strategy work – and when does it fail?”

I (Tom) am not a professional trader myself, but someone who is between beginner and intermediate.
This tool helps me (and hopefully you too) think more systematically and back up (or challenge) my own ideas.

Core Idea

Most trading strategies only work under certain market conditions.
This script helps you analyze:

– Does your logic work better in clear trends?
– Do trend filters help – and when do they hurt?
– How do sideways phases affect performance?
– Is your setup robust across different timeframes and assets?

Adjustable Settings

The script is designed to be flexible. In the settings panel, you can configure:

• Enable EMA trend filter – Activate or deactivate trend filtering
• EMA 1–4 – Length of exponential moving averages (e.g. 21, 50, etc.)
• Show pivots – Display local highs and lows as reference
• Pivot length – Number of candles to each side to define a pivot
• Show signals – Enable or disable signal visualization

All parameters can be adjusted directly in the TradingView settings menu.

If You Decide to Trade with It (Not Recommended)

If you still want to test this strategy with real trading, please consider:

Always analyze market context (trend, volatility, news)

Use your own stop-loss and take-profit logic

Avoid choppy or sideways markets

Test across different timeframes and instruments

Combine it with volume, support/resistance, or candlestick patterns

Note: The script is non-repainting – signals are shown only after the bar is closed.

Possible Use Cases

– Only show signals in trend phases
– Analyze: When does your setup perform well or poorly?
– Review “what-if” scenarios
– Base for experimentation and further development

Feedback Welcome

If you have ideas, questions, or suggestions – feel free to reach out.
I'd love to hear your thoughts or see how you use or modify the script.

Background & Development

This script was initially inspired by publicly available code from parsimaj.
It was completely rewritten, modernized, documented, and customized to my own requirements.
The goal was to create a simple, robust, and flexible learning and testing tool.

License & Disclaimer

– No guarantee of profitability. Not financial advice.
– Use at your own risk. Educational and analytical use only.

Author: Tom & ChatGPT
Version: Turtle 2.0 – Backtest Edition
Platform: TradingView – Pine Script v5

Penafian

Maklumat dan penerbitan adalah tidak dimaksudkan untuk menjadi, dan tidak membentuk, nasihat untuk kewangan, pelaburan, perdagangan dan jenis-jenis lain atau cadangan yang dibekalkan atau disahkan oleh TradingView. Baca dengan lebih lanjut di Terma Penggunaan.