Turtle Channels

Turtle Channels is a strategy that trades XAUUSD on daily bars. It adds up to 4 entries in the same direction, keeps at least 500 points between entri

core language

turtle-channels.abx
1strategy "Turtle Channels"
2market: XAUUSD
3bars: 1d
4pyramiding: 4
5min_distance: 500 points
6max_drawdown: 20%
7
8input entry_length = 20
9input exit_length = 10
10input unit_risk = 0.5%
11
12entry_channel = donchian(entry_length)
13exit_channel = donchian(exit_length)
14
15when crosses_above(close, entry_channel.upper[1]):
16buy risk: unit_risk, stop: atr(20) * 2, tag: "turtle"
17
18when crosses_below(close, exit_channel.lower[1]):
19close_all side: long, tag: "turtle"
20
21plot entry_channel.upper, color: green
22plot exit_channel.lower, color: red
What this script says

Turtle Channels is a strategy that trades XAUUSD on daily bars. It adds up to 4 entries in the same direction, keeps at least 500 points between entries and stops trading after a 20% drawdown.

You can change 3 inputs: entry_length (default 20), exit_length (default 10) and unit_risk (default 0.5%).

It calculates entry_channel as the Donchian Channels (length entry_length) and exit_channel as the Donchian Channels (length exit_length).

When the close crosses above the previous bar's entry_channel.upper, it buys at market, risking unit_risk of the balance, with a stop 2 × the 20-bar ATR from the entry and tagged "turtle".

When the close crosses below the previous bar's exit_channel.lower, it closes all long trades tagged "turtle".

On the chart, it plots entry_channel.upper and exit_channel.lower.

Try this in the Terminal. AlgoBars is free: $0 a month, no card needed.

Create my free account