trader.strategies.turtle module

Donchian breakout, the entry/exit core of the Turtle system.

Deliberately not the full Turtle system: no pyramiding, no ATR position sizing, no 2N stop. Sizing and stops belong to the engine so strategies remain comparable on signal quality alone.

class trader.strategies.turtle.TurtleStrategy(id, entry_period=20, exit_period=10)[source]

Bases: object

Buy a breakout above the entry channel; exit below the exit channel.

Parameters:
  • id (str)

  • entry_period (int)

  • exit_period (int)

id: str
entry_period: int
exit_period: int
backtestable: ClassVar[bool] = True
warmup_bars()[source]
Return type:

int

evaluate(bars, position)[source]
Parameters:
Return type:

Signal