OPEN-SOURCE SCRIPT

[3Commas] Turtle Strategy

333
Turtle Strategy

🔷 What it does: This indicator implements a modernized version of the Turtle Trading Strategy, designed for trend-following and automated trading with webhook integration. It identifies breakout opportunities using Donchian channels, providing entry and exit signals.
  • Channel 1: Detects short-term breakouts using the highest highs and lowest lows over a set period (default 20).
  • Channel 2: Acts as a confirmation filter by applying an offset to the same period, reducing false signals.
  • Exit Channel: Functions as a dynamic stop-loss (wait for candle close), adjusting based on market structure (default 10 periods).
  • Additionally, traders can enable a fixed Take Profit level, ensuring a systematic approach to profit-taking.

🔷 Who is it for:
  • Trend Traders: Those looking to capture long-term market moves.
  • Bot Users: Traders seeking to automate entries and exits with bot integration.
  • Rule-Based Traders: Operators who prefer a structured, systematic trading approach.

🔷 How does it work: The strategy generates buy and sell signals using a dual-channel confirmation system.
  • Long Entry: A buy signal is generated when the close price crosses above the previous high of Channel 1 and is confirmed by Channel 2.
  • Short Entry: A sell signal occurs when the close price falls below the previous low of Channel 1, with confirmation from Channel 2.
  • Exit Management: The Exit Channel acts as a trailing stop, dynamically adjusting to price movements. To exit the trade, wait for a full bar close.
  • Optional Take Profit (%): Closes trades at a predefined %.

🔷 Why it’s unique:
  • Modern Adaptation: Updates the classic Turtle Trading Strategy, with the possibility of using a second channel with an offset to filter the signals.
  • Dynamic Risk Management: Utilizes a trailing Exit Channel to help protect gains as trades move favorably.
  • Bot Integration: Automates trade execution through direct JSON signal communication with your DCA Bots.

🔷 Considerations Before Using the Indicator:
  • Market & Timeframe: Best suited for trending markets; higher timeframes (e.g., H4, D1) are recommended to minimize noise.
  • Sideways Markets: In choppy conditions, breakouts may lead to false signals—consider using additional filters.
  • Backtesting & Demo Testing: It is crucial to thoroughly backtest the strategy and run it on a demo account before risking real capital.
  • Parameter Adjustments: Ensure that commissions, slippage, and position sizes are set accurately to reflect real trading conditions.

🔷 STRATEGY PROPERTIES
  • Symbol: BINANCE:ETHUSDT (Spot).
  • Timeframe: 4h.
  • Test Period: All historical data available.
  • Initial Capital: 10000 USDT.
  • Order Size per Trade: 1% of Capital, you can use a higher value e.g. 5%, be cautious that the Max Drawdown does not exceed 10%, as it would indicate a very risky trading approach.
  • Commission: Binance commission 0.1%, adjust according to the exchange being used, lower numbers will generate unrealistic results. By using low values e.g. 5%, it allows us to adapt over time and check the functioning of the strategy.
  • Slippage: 5 ticks, for pairs with low liquidity or very large orders, this number should be increased as the order may not be filled at the desired level.
  • Margin for Long and Short Positions: 100%.
  • Indicator Settings: Default Configuration.
    • Period Channel 1: 20.
    • Period Channel 2: 20.
    • Period Channel 2 Offset: 20.
    • Period Exit: 10.
    • Take Profit %: Disable.
    • Strategy: Long & Short.

🔷 STRATEGY RESULTS
  • ⚠️Remember, past results do not guarantee future performance.
  • Net Profit: +516.87 USDT (+5.17%).
  • Max Drawdown: -100.28 USDT (-0.95%).
  • Total Closed Trades: 281.
  • Percent Profitable: 40.21%.
  • Profit Factor: 1.704.
  • Average Trade: +1.84 USDT (+1.80%).
  • Average # Bars in Trades: 29.

🔷 How to Use It:

🔸 Adjust Settings:
  • Select your asset and timeframe suited for trend trading.
  • Adjust the periods for Channel 1, Channel 2, and the Exit Channel to align with the asset’s historical behavior. You can visualize these channels by going to the Style tab and enabling them.
  • For example, if you set Channel 2 to 40 with an offset of 40, signals will take longer to appear but will aim for a more defined trend.
  • Experiment with different values, a possible exit configuration is using 20 as well. Compare the results and adjust accordingly.
  • Enable the Take Profit (%) option if needed.

🔸Results Review:
  • It is important to check the Max Drawdown. This value should ideally not exceed 10% of your capital. Consider adjusting the trade size to ensure this threshold is not surpassed.
  • Remember to include the correct values for commission and slippage according to the symbol and exchange where you are conducting the tests. Otherwise, the results will not be realistic.
  • If you are satisfied with the results, you may consider automating your trades. However, it is strongly recommended to use a small amount of capital or a demo account to test proper execution before committing real funds.

🔸Create alerts to trigger the DCA Bot:
  • Verify Messages: Ensure the message matches the one specified by the DCA Bot.
  • Multi-Pair Configuration: For multi-pair setups, enable the option to add the symbol in the correct format.
  • Signal Settings: Enable the option to receive long or short signals (Entry | TP | SL), copy and paste the messages for the DCA Bots configured.
  • Alert Setup:
  • When creating an alert, set the condition to the indicator and choose "alert() function call only".
  • Enter any desired Alert Name.
  • Open the Notifications tab, enable Webhook URL, and paste the Webhook URL.
  • For more details, refer to the section: "How to use TradingView Custom Signals".
  • Finalize Alerts: Click Create, you're done! Alerts will now be sent automatically in the correct format.

🔷 INDICATOR SETTINGS
  • Period Channel 1: Period of highs and lows to trigger signals
  • Period Channel 2: Period of highs and lows to filter signals
  • Offset: Move Channel 2 to the right x bars to try to filter out the favorable signals.
  • Period Exit: It is the period of the Donchian channel that is used as trailing for the exits.
  • Strategy: Order Type direction in which trades are executed.
  • Take Profit %: When activated, the entered value will be used as the Take Profit in percentage from the entry price level.
  • Use Custom Test Period: When enabled signals only works in the selected time window. If disabled it will use all historical data available on the chart.
  • Test Start and End: Once the Custom Test Period is enabled, here you select the start and end date that you want to analyze.
  • Check Messages: Check Messages: Enable this option to review the messages that will be sent to the bot.
  • Entry | TP | SL: Enable this options to send Buy Entry, Take Profit (TP), and Stop Loss (SL) signals.
  • Deal Entry and Deal Exit: Copy and paste the message for the deal start signal and close order at Market Price of the DCA Bot. This is the message that will be sent with the alert to the Bot, you must verify that it is the same as the bot so that it can process properly.
  • DCA Bot Multi-Pair: You must activate it if you want to use the signals in a DCA Bot Multi-pair in the text box you must enter (using the correct format) the symbol in which you are creating the alert, you can check the format of each symbol when you create the bot.

👨🏻‍💻💭 We hope this tool helps enhance your trading. Your feedback is invaluable, so feel free to share any suggestions for improvements or new features you'd like to see implemented.

__
The information and publications within the 3Commas TradingView account are not meant to be and do not constitute financial, investment, trading, or other types of advice or recommendations supplied or endorsed by 3Commas and any of the parties acting on behalf of 3Commas, including its employees, contractors, ambassadors, etc.

כתב ויתור

המידע והפרסומים אינם אמורים להיות, ואינם מהווים, עצות פיננסיות, השקעות, מסחר או סוגים אחרים של עצות או המלצות שסופקו או מאושרים על ידי TradingView. קרא עוד בתנאים וההגבלות.