Turtle Trading System on Metastock & AmiBroker

Turtle Trading System for AmiBroker and Metastock

Generally, futures traders are familiar with the name Richard Dennis. He was the founder of the Turtle Trading System. For many years the exact parameters of Dennis were kept a secret. Later he released some of them as the turtle strategy.

Dennis stepped into the stock market as a commodity trader. His trader life is quite inspiring. He started with $5000 and became more than $100 million gainers. The Turtle strategy generally applies to future trading. This article will cover What the turtle trading system is along with free Amibroker AFL codes.

The real-life story of him is really an inspiring one. His principle is anyone could be taught to trade the futures markets. The turtle trading strategy mainly works on future trading.


Does Turtle Trading System still work?

This is an old system. Turtles traded 100% mechanical using the specific system. Here the number of losers is more than the number of winners. But it has been seen that the winners are much bigger in terms of profit than the losers. Hence, this system still works very well if a trader can stick to the system.

What is Turtle Trading System?

The Turtle strategy was developed by Richard Dennis. The turtle experiment was based on the principle “anyone could be taught to trade”. It is a complete mechanical system that has specific entry and exit rules. The rule of buy entry is to buy a 20-day breakout. Similarly, the rule for short-selling is to sell a 20-day breakdown. After the introduction of the turtle experiment, Dennis was considered the most successful trader of that time.

Who were the original turtle traders?

The Turtle System was first introduced by Richard Dennis, a commodity trader. He introduced the system in 1983. Dennis was accompanied by William Eckhardt.

How the Turtle Trading System was Introduced?

Richard arranged a Turtle Program by placing an ad in The Wall Street Journal. Among thousands of candidates, only 14 traders would make it through the first program of Turtle Techniques. Though Dennis had not released the exact criteria of the particular strategy, still traders use it widely in trading the live markets.

The Turtle Trading Rules

The specific technique is based on buying a futures contract on a 20-day high(breakout) and selling on a 20-day low. The fundamental techniques guide the implementation of a trend-following strategy. It implies the reason for buying future breaking out to the upside of trading ranges and selling short downside breakouts. It indicates an entry signal buying new four-week highs.

Position Sizing

Position sizing includes a formula. Here the concept “N” represents the underlying volatility of a particular market. Simply N=20 days EMA (Exponential Moving Average) of the ATR (Average True Range). Therefore, N indicates the average price range that a particular market experiences in a single day. We can calculate the daily true range by maximum (H-L, H-PDC, PDC-L). Here PDC is the previous day’s close. Here we can always place the initial stop loss at 2N. (2xN) or 2% of the entire account equity.

Entering the position is the most significant point in trading. Turtle uses a simple entry strategy. Short-term based on a 20-day breakout and Long-term based 55-day breakout. The thumb rule is that if the first 20-day breakout stops out, don’t take the next 20-day breakout. Rather now wait for the long-term entry, i.e. the 55-day breakout.

Turtles were able to Find the Following Answers:

  • How much is the volatility of the market
  • What is the system orientation
  • How much is the risk
  • What is the state of the market?

The Result

In this strategy, the total winning amount is higher than the loss because this system always adds to the position of the winning trades. Suppose you lose in 1 lot, and gain on 5 lots, the average gaining opportunity becomes much higher.

Turtle Trading System on AmiBroker

turtle trading system

In the AmiBroker platform, traders can use this advanced trading strategy. Check the image above to know what the system looks like on the AmiBroker. Here I have provided a FREE download link to the Turtle trading system here.

If you are going to use my Turtle Trading System AFL on AmiBroker, remember this is not for intraday traders. Make sure that use an end-of-day chart. Also as the number of losers can be more than the number of winners, you must believe the system. You need nerves of steel to trade like turtles. Take each and every signal irrespective of what has happened in the last signal. I will love to hear your observations and your backtest. So do not forget to comment on your experiences.

Turtle Trading System on Metastock

Here is the code for Metastock users. You can create the indicator using the following code.

H > Ref (HHV(H, 20), -1) OR L < Ref (LLV(L, 20), -1);

H = Today’s high; L = Today’s low
HHV (H, 20) = Highest value that the high price (H) has reached in the previous 20 days.
LLV (L, 20) = Lowest value that the low price (L) has reached in the previous 20 days.
Ref (HHV(H, 20), -1) = The highest high price in the last 20 days refers to the last day.
Ref (LLV(L, 20), -1) = The lowest low price in the last 20 days refers to the last day.

Turtle Trading System Metastock

Back Testing of Turtle Trading System

Now, I am going to tell you about the backtesting of the Turtle Trading Strategy. I used software called Analyst’s Turtle Farm for that. This software follows the Turtle Strategy and Indian traders can also use it. The backtesting was started on 05-06-2013 in Nifty Futures.

Backtesting of Turtle Trading System

The backtesting image shows that the system has generated decent returns in the Turtle Trading System.

Turtle Trading with Zerodha Kite

Time needed: 5 minutes

How to Create a Turtle Trading System in Zerodha Kite?

  1. Login to Zerodha Kite and open your chart

    Firstly, log in to your Zerodha Kite account and open the stock or index you want to trade. Here I opened the Nifty index chart.

  2. Attach the Donchian Channel indicator

    Next, I attached the Donchian Channel indicator. I kept the default value, 20-day high period and 20-day low period. So this channel will plot lines at 20-day high and 20-day low levels.

  3. The trading rules

    We can take a buy trade if the price candle closes above the 20-period Donchian channel peak. Exit the buy trade if the price closes below the middle band. Similarly, we can take a short-sell trade if the price candle closes below the 20-period Donchian Channel trough. There is no fixed target, rather exit the short trade if the price closes above the middle band. Check the image below to know more.Turtle Trading In Zerodha Kite

Further Reading

The best book on this subject is Way of the Turtle: The Secret Methods that Turned Ordinary People into Legendary Traders written by Curtis M. Faith.

Curtis was one of the original students of Richard Dennis. He was one of the Turtles of the 1983 batch. So, this book is directly from the horse’s mouth. A must-read for those who want to know the mechanical system correctly.


In conclusion, the Turtle Trading System has proven to be a successful and resilient approach to trading. Both Metastock and AmiBroker platforms have comprehensive tools for writing codes and creating strategies based on these rules. With enhanced capabilities such as backtesting, risk measurement and portfolio analysis, they provide traders with all the necessary information needed to make correct decisions while investing in volatile markets. Overall, if used correctly, these systems can be a great choice if you are serious about your journey into stock market trading.

Visited 258 times, 1 visit(s) today

Author: Indrajit Mukherjee

Indrajit is a professional blogger and trading system developer. Amibroker expert, Wordpress expert, SEO expert and stock market analyst.Trading since 2002, he has started the journey of StockManiacs.net on 2008. He follows Indian and world stock markets closely. Nowadays, he is also taking help of artificial intelligence for writing valuable contents for his readers.

0 0 votes
Article Rating
Notify of

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Inline Feedbacks
View all comments
Would love your thoughts, please comment.x