Loading...

Plus+ Python

Combining NR4 Inside Days & Historical Volatility to Produce Trading Signals

Combining NR4 Inside Days & Historical Volatility to Produce Trading Signals


Strategy Description
Described in the book "Street Smarts: High Probability Short-Term Trading Strategies" by Laurence A. Connors and Linda Bradford Raschke, this strategy is an extension of the NR4 Contraction Momentum Trading Setup that we covered previously. The biggest difference is that historical volatility is used as a filter on the day. Specifically, the 6 day realized volatility is compared as a ratio to the 100 day realized volatility, and if below a certain threshold, a condition is satisfied. Then the strategy uses NR4 identification to wait for a momentum breakout in either direction.

Strategy Rules and Conditions
  • Historical volatility ratio of 6period to 100period is less than 0.50 (50%)
  • Inside Range day and smallest range day out of the last 4 must occur
  • Breakouts happen above the NR4 day's high or below the low on the following day


  • The Code
    This code loads historical Bitcoin trading data from Binance using CryptoDataDownload, and applies a technical trading strategy. It calculates short-term (6-day) and long-term (100-day) realized volatilities, and forms a ratio to create a volatility indicator. The script identifies the smallest daily price range in the last four days and detects 'inside days' where the price range is within the previous day's range. Combining these factors, it generates buy and sell signals based on volatility and price range conditions. Finally, the processed data, along with the signals, is saved to a CSV file for further analysis. All code (EVERY LINE) is fully commented! Feel free to modify to fit your purpose

    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