Loading...

Plus+ Python

Implementing Turtle Soup Plus One Trading Strategy with Bitcoin and Python

Implementing Turtle Soup Plus One Trading Strategy with Bitcoin  and Python


Strategy Description
The "Turtle Soup Plus One" trading strategy is a concept detailed in the book "Street Smarts: High Probability Short-Term Trading Strategies" by Laurence A. Connors and Linda Bradford Raschke. This strategy is a reversal play and attempts to capitalize on the market's tendency to reverse after making new 20 period highs (or lows). The original "Turtle Soup" strategy was initially a intraday strategy that tries to identify and exploit false breakouts or failed moves. One variation of that strategy is the Turtle Soup Plus One, which triggers on the following day and aims to capitalize on situations where traders who followed the original breakout get trapped when the market reverses, creating a swift counter-move. We will implement the Turtle Soup Plus One trading strategy using our own CryptoDataDownload historical OHLCV data for Bitcoin and Binance data.

Strategy Rules and Conditions
  • The market makes a new 20day high or low and the previous high/low marker must have been at least 3 trading sessions prior. The close of the new high/low must be greater than (beyond) the previous high/low price marker.
  • Buy entry is placed on the next day at the previous 20 day high/low watermark
  • Stop entries for failed trades are placed below the latest high/low that triggered the signal
  • Profits/exits should be taken within 2-6 candlestick intervals


  • The Code
    We will implement this strategy in Python and using our own OHLCV historical data for Bitcoin (BTC) from Binance exchange. We will use functional programming (script will be composed of multiple function calls vs an "object oriented" approach). The main function will load the data, which is flexible enough to load data for any exchange CSV and pair we host on the site. We include two helper functions called "get_idx_of_max" and "get_idx_of_min" in the file that allow us to determine where in the Pandas Dataframe (which index position) a certain value occurs as we use a rolling window function to determine the high or low over a 20 period rolling window. In addition to the OHLC columns, we will have a 20_day_high & 20_day_low column, these represent the rolling high and lows over each 20 day window. Then the 20_day_high_idx and low_idx; these are the indexed positions of where the high/low occurs in the dataframe. The last 2 numeric columns are index_diff_high and index_diff_lows which represent the number of days since the previous 20 day high or low in the window. The remaining columns are all Boolean (True/False) and act as the triggers for the final buy or sell signal: new_20_day_high or new_20_day_low represent whether or not a new high or low occurred. Index_high_condition and index_low_condition represent whether or not the new high or low occurred at least 3 days after the previous high or low set. Buy_close_condition and sell_close_condition are the final prerequisite which define whether or not the close of the price was less than the previous day low (for buys) or greater than the previous 20 period high (for sells). The strategy generates a "Buy" or "Sell" signal in the Buy_signal or Sell_signal columns using the previous booleans and conditions outlined in the strategy. It is important to remember that this strategy does not trigger on the closing price of the next day, but whether or not the next days' range breaks outside of/through the previously calculated 20 day high or low (in the opposite direction). All columns and data are ultimately saved in a CSV called "turtle_soup_plus_one_results.csv" The resulting file will have signals in it for entries & exits, but full back testing is not performed in this code. As always, every line of code is commented for your understanding. Feel free to modify to fit your purposes!

    Plus+ membership required

    Create a Plus+ account to view the live codebase.

    This article has a fully working, notebook-ready code block. Sign up for Plus+ to access it and the rest of the 20+ premium articles.

    Subscribe to Plus+ Browse Plus+ articles