OPEN-SOURCE SCRIPT
Turtle Trading System (Not Financial Advise)

I am testing this script, not financial advise, but this is how it works, i hope;
How the Script Works
The script is a TradingView strategy that backtests and automates the Turtle rules. It uses two systems, a short-term S1 (20-day) and a long-term S2 (55-day), which you can select to test.
The strategy follows these core principles:
Trend Identification: The script uses Donchian Channels to identify breakouts. A new trend is signaled when the price breaks above the highest high or below the lowest low of a specified period.
Position Sizing: The script automatically calculates the size of each trade unit to ensure you risk a consistent percentage of your capital on every trade. This is based on the Average True Range (ATR), which measures volatility.
Pyramiding: When a trade moves in a profitable direction, the script will add more units at specific intervals to increase your position and ride the trend. This is how the Turtles made their big profits.
Win/Loss Condition:
A crucial rule is implemented for System 1 (S1): you only enter a trade if the previous S1 trade was a loss. If the last S1 trade was a win, you must wait for a signal from System 2 (S2).
How to Enter and Exit a Long Position
The script will automatically enter a long position when the price breaks above the highest high of the last 20 days (S1) or 55 days (S2), depending on which system you've selected.
Stop-Loss (SL): Your stop-loss is automatically placed at a distance of 2 * N (ATR) below the entry price. . This is a crucial risk management rule that limits your potential loss. The stop-loss is also plotted visually on the chart.
Exit Long: The script will close the long position automatically under two conditions:
Reversal: The price drops and closes below the lowest low of the last 10 days (S1) or 20 days (S2).
Stop-Loss Hit: The price hits your initial stop-loss, limiting your loss.
How to Enter and Exit a Short Position
Enter Short: The script will automatically enter a short position when the price breaks below the lowest low of the last 20 days (S1) or 55 days (S2).
Stop-Loss (SL): Your stop-loss is automatically placed at a distance of 2 * N (ATR) above the entry price. . This prevents large losses if the price moves against you.
Exit Short: The script will close the short position automatically under two conditions:
Reversal: The price rallies and closes above the highest high of the last 10 days (S1) or 20 days (S2).
Stop-Loss Hit: The price hits your initial stop-loss, limiting your loss.
How the Script Works
The script is a TradingView strategy that backtests and automates the Turtle rules. It uses two systems, a short-term S1 (20-day) and a long-term S2 (55-day), which you can select to test.
The strategy follows these core principles:
Trend Identification: The script uses Donchian Channels to identify breakouts. A new trend is signaled when the price breaks above the highest high or below the lowest low of a specified period.
Position Sizing: The script automatically calculates the size of each trade unit to ensure you risk a consistent percentage of your capital on every trade. This is based on the Average True Range (ATR), which measures volatility.
Pyramiding: When a trade moves in a profitable direction, the script will add more units at specific intervals to increase your position and ride the trend. This is how the Turtles made their big profits.
Win/Loss Condition:
A crucial rule is implemented for System 1 (S1): you only enter a trade if the previous S1 trade was a loss. If the last S1 trade was a win, you must wait for a signal from System 2 (S2).
How to Enter and Exit a Long Position
The script will automatically enter a long position when the price breaks above the highest high of the last 20 days (S1) or 55 days (S2), depending on which system you've selected.
Stop-Loss (SL): Your stop-loss is automatically placed at a distance of 2 * N (ATR) below the entry price. . This is a crucial risk management rule that limits your potential loss. The stop-loss is also plotted visually on the chart.
Exit Long: The script will close the long position automatically under two conditions:
Reversal: The price drops and closes below the lowest low of the last 10 days (S1) or 20 days (S2).
Stop-Loss Hit: The price hits your initial stop-loss, limiting your loss.
How to Enter and Exit a Short Position
Enter Short: The script will automatically enter a short position when the price breaks below the lowest low of the last 20 days (S1) or 55 days (S2).
Stop-Loss (SL): Your stop-loss is automatically placed at a distance of 2 * N (ATR) above the entry price. . This prevents large losses if the price moves against you.
Exit Short: The script will close the short position automatically under two conditions:
Reversal: The price rallies and closes above the highest high of the last 10 days (S1) or 20 days (S2).
Stop-Loss Hit: The price hits your initial stop-loss, limiting your loss.
Skrip sumber terbuka
Dalam semangat sebenar TradingView, pencipta skrip ini telah menjadikannya sumber terbuka supaya pedagang dapat menilai dan mengesahkan kefungsiannya. Terima kasih kepada penulis! Walaupun anda boleh menggunakannya secara percuma, ingat bahawa menerbitkan semula kod ini adalah tertakluk kepada Peraturan Dalaman kami.
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.
Skrip sumber terbuka
Dalam semangat sebenar TradingView, pencipta skrip ini telah menjadikannya sumber terbuka supaya pedagang dapat menilai dan mengesahkan kefungsiannya. Terima kasih kepada penulis! Walaupun anda boleh menggunakannya secara percuma, ingat bahawa menerbitkan semula kod ini adalah tertakluk kepada Peraturan Dalaman kami.
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.