Loading...

Plus+ Python

Range Contraction NR4 Breakout Trading Strategy: Python

Range Contraction NR4 Breakout Trading Strategy: Python


Strategy Description
According to the book "Street Smarts: High Probability Short-Term Trading Strategies" by Laurence A. Connors and Linda Bradford Raschke, this strategy identifies certain days that meet "contraction" criteria and anticipates a breakout in one of the directions (it could be either) for a momentum trade. The strategy focuses on inside days and whether or not the days' range is the smallest out of a rolling window. If those conditions are met, then a breakout signal is generated once the following day begins to trade above the signal high or low extremes. A breakout leads to a momentum move where stops are meant to be trailed.

Strategy Rules and Conditions
  • Inside day is defined as a day with a higher low than the previous days' low and a lower high than the previous days' high
  • NR4 or "Narrow range 4" days are defined as the smallest change in daily range out of the last 4. So in effect, this is a rolling window of Highs-Lows (the range), and identifies if day #4 is the smallest (most contracted) out of the window
  • Signals are generated once the following day trades above or below the signal day high or low


  • The Code
    The code applies the above ruleset to BTCUSDT from Binance on CryptoDataDownload. New columns are added to the Pandas DataFrame that set Boolean logic for whether or not the strategy conditions are met. If they are met, the "buy_signal" or "sell_signal" columns will show "TRUE", meaning a signal was generated. The file saves a CSV at the end with all of the columns and titles it "NR4_volatility_strategy.csv"

    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