Ah, the turtle traders. The legendary experiment.
The stuff that makes the hearts of all traders tingle with excitement. No? Well, it makes me excited at least, don’t judge 🙂
The Turtle Traders Experiment
“We’re going to raise traders just like they raise turtles in Singapore.”
Set in the 1980s, Richard Dennis (one of the most successful traders back then) strongly believed that trading could be taught. When he started out his plans to teach a group of 23 people to become great traders, many were sceptical though. This is how it worked: he gathered a small group of traders – the Turtles – and gave them a 2-week training course on a simple trend following system. With these clear instructions, the turtles were given a trading account and had to trade the rules they were taught for one month. After the month, the ones that were successful were given a larger trading account from Richard’s own money to trade.
Fast-forward 5 years and his turtles had earned an aggregate profit of $175 million. The experiment was an enormous success and showed that given a simple set of rules, anyone could be made a successful trader. Some of the original turtles went on to keep trading under their own accounts and were incredibly successful at it.
The Way Of The Turtle
Recently, I was gathering information on the best forex books I’ve ever read, and came across The Way Of The Turtle by Curtis Faith. Curtis was one of the original turtles and this book tells the story of what happened. It’s an incredible book to read, not only because the experiment is so uncommon, but because along the way, a lot of very valuable trading wisdom is shared. The same kind of wisdom we can use in the forex markets. It’s an incredible story about one of the most legendary experiments in financial markets ever, and I highly recommend everyone to get and read this book.
This got me thinking. Wouldn’t it be cool to create an expert advisor that uses the turtle rules and see what happens? I knew that the original turtle rules didn’t hold up anymore against current markets, but who cares?
I set out to build the turtle traders expert advisor.
Now, I have to say, the rules mention advanced position sizing. I didn’t implement that (yet). I also implemented the simpler system 2, which uses a long-term channel breakout strategy using the 55-day price high and low. The entry rules for system 1 are a bit more complex, and while it wouldn’t be overly difficult to build it, I just didn’t feel like it right now 🙂
The rules
Human emotion is both the source of opportunity in trading
and the greatest challenge.
Master it and you will succeed.
Ignore it at your peril.
The original Turtles traded futures so obviously we will not be doing that and test it out on one of the currency pairs. These are the (admittedly, simplified) rules:
- Entry:
- buy when the price exceeds by a single tick the high of the previous 55 days.
- sell when the price goes by a single tick below the low of the previous 55 days.
- Stops: place stops at 1% of account equity
- Exit:
- close the trade if the price goes below the 20 day low for long positions
- close the trade if the price exceed the 20 day high for short positions
The Turtle Traders Expert Advisor
This is the EA I’ve built. There are lots of things lacking to make this an expert advisor I’d actually trade with, but it can help you understand what exactly happens in the process of creating expert advisors for MT4.
[includeme file=”wp-content/post-includes/test.php”]
#property copyright "Smart Forex Learning" #property link "https://smartforexlearning.com" #property description "EA for the original system 2 turtle strategy" /** * Note: This can best be traded on the D1 time frame * * All of the code below and the functionality of this EA is purely for educational purposes. * This should not be used on a live trading account. People are responsible for any losses that may incur if traded live. */ // External variables extern int Risk = 1; // 2% of available capital // Global variables double Lots = 1; double TakeProfit = 100000; double MinimumStopLoss = 1000; double MagicNumber = 25290428482; /** * Calculate the stop loss based on the account size, risk appetite and lot size */ double calculateStopLoss() { return MathMax(MinimumStopLoss, NormalizeDouble(AccountFreeMargin() * Risk / 100 / (Lots * MarketInfo(Symbol(), MODE_TICKVALUE)), 0)); } void OnTick(void) { int i, ticket, total; if (Bars < 55) { Print("bars less than 55"); return; } double highest = High[iHighest(NULL, 0, MODE_HIGH, 55, 1)]; double lowest = Low[iLowest(NULL, 0, MODE_LOW, 55, 1)]; double StopLoss = calculateStopLoss(); // The actual orders total = OrdersTotal(); if (total < 1) { if (Bid < lowest) { // Dont trade if we dont have enough margin if (AccountFreeMarginCheck(Symbol(), OP_SELL, Lots) <= 0 || GetLastError() == 134) { return; } // create the order ticket = OrderSend(Symbol(), OP_SELL, Lots, Bid, 3, Bid + StopLoss * Point, Bid - TakeProfit * Point, "my order", MagicNumber, 0, Red); if (ticket > 0) { if(OrderSelect(ticket, SELECT_BY_TICKET, MODE_TRADES)) { Print("SELL order opened : ",OrderOpenPrice()); } } else { Print("Error opening SELL order : ",GetLastError()); return; } } if (Ask > highest) { // Dont trade if we dont have enough margin if (AccountFreeMarginCheck(Symbol(), OP_BUY, Lots) <= 0 || GetLastError() == 134) { return; } // create the order ticket = OrderSend(Symbol(), OP_BUY, Lots, Ask, 3, Ask - StopLoss * Point, Ask + TakeProfit * Point, "my order", MagicNumber, 0, Green); if (ticket > 0) { if(OrderSelect(ticket, SELECT_BY_TICKET, MODE_TRADES)) { Print("BUY order opened : ",OrderOpenPrice()); } } else { Print("Error opening BUY order : ",GetLastError()); return; } } return; } // Check for exit conditions for (i = 0; i < total; i++) { if (!OrderSelect(i, SELECT_BY_POS, MODE_TRADES)) { continue; } if (OrderSymbol() == Symbol()) { if(OrderType() == OP_BUY) { // Buy order if (Bid < Low[iLowest(NULL, 0, MODE_LOW, 20, 1)]) { if (!OrderClose(OrderTicket(), OrderLots(), Bid, 3, Green)) { Print("OrderClose error ", GetLastError()); } } } else if (OrderType() == OP_SELL) { // Sell order if (Ask > High[iHighest(NULL, 0, MODE_HIGH, 20, 1)]) { if (!OrderClose(OrderTicket(), OrderLots(), Ask, 3, Green)) { Print("OrderClose error ", GetLastError()); } } } } } }
The results
I backtested this strategy on the EURUSD H4 timeframe from 2005-01-01 until 2010-01-01 using a $100.000 initial account and a fixed standard lot size of 1, for which it gave a positive, albeit kind of random result. The more advanced position sizing or even just using the system 1 (or a combination thereof) may yield better results. Also, 5 years is not enough data to confirm if a strategy works, usually I test my own automated strategies on at least 10 years of price data.
The result is below:
We’re not trying to make a profitable EA per sé. Rather, this was an exercise in building a simple expert advisor based on the foundation of the turtle trader rules. This could be used as the basis of a more advanced EA, as the main idea of using trend breakouts is still very valid in today’s forex markets.
Trade with an edge, manage risk, be consistent, and keep it simple.
The entire Turtle training, and indeed the basis of all successful trading,
can be summed up in these four core principles.
Download and test the Turtle Traders Expert Advisor
Here is a link to the MQL4 source code I’ve used to build this EA. If you want to improve this expert advisor, you can download a free PDF with the turtle rules so you can modify according to the official rules.
Have you tested this EA yourself? Let me know in the comments below!