Automating Dennis Richard's turtle strategy
The Turtle strategy is one of the most famous and profitable trend-following strategies
Let's see how we can automate it
As well known for the legend that surrounds it as for its results, the "turtle" trading strategy is one of the simplest trend-following strategies
In this tutorial, we will see how we can automate it, and what returns we can expect from it using backtests. ( spoiler : they're huge )
For those in a hurry, the strategy we'll be building is also available in the "pre-made strategies" section
- 1. The Turtle strategy
- 2. Automating it
- 3. Backtesting it
- 4. Running it
1) The Turtle strategy
The turtle strategy's rules are simple :
- Buy : when the current trading price is higher than the maximum of the highs of the last 30 candles
- Sell : when the current trading price is lower than the minimum of the closes of the last 20 candles

2) Automating it
As always, we're going to go in bots and click on "new bot"

We want to check if the max of the highs of the last candle is lower than the the max of the closes of the current candle
We'll be doing : 0 < [MAX highs 1 period ago] < [MAX current closes]
We're going to click the middle value and setup a 2H, 30 periods MAX on highs.
On the "intervals back in time" field, select 1 : we want the past candle's MAX.

Press enter, you'll see this :

Now : it's your turn
With the above explanations and the given rules, you should be able to bootstrap your own custom automated turtle strategy by filling the last 3 values Feel free to play with all the parameters : timeperiods, intervals, additional indicators .. That's the key to profits !
If you're stuck or in a hurry, click on "pre-made strategies" in the bot interface : you'll find the turtle between other strategies
The solution :
Here's what you should have if you applied the rules to the letter :
Buy :

Sell :

3) Backtesting our strategy
To start a backtest, click on the simulate button :


Those are quite good results, we should be able to push them even more by customizing a bit this strategy.
4) Running our strategy
After saving your strategy, just click on the "enable" button and enjoy the results 😉
We encourage you to enable telegram notifications to be alerted whenever your bot takes position.
In order to be sure that our strategy is profitable, we encourage you to test it for a while on the sandbox exchange.
As a reminder, sandbox trading on kaktana is 100% free, forever.