Narrow Range

The Narrow Range indicator marks the bars whose range is the smallest of the last four (NR4) or seven (NR7) bars. A narrow range is a compression: volatility contracted, and the breakout of that bar's range is the trade the formation is usually used for.

Role in the strategy

SlotAvailableRole
Entry PointNo—
Entry RuleYesFilters entries: allows or denies opening a position.
Exit PointNo—
Exit RuleYesTriggers exits: allows or denies closing a position.

The formation produces a condition, not an order price: as an entry rule it is ANDed with the entry point and the other entry rules, as an exit rule it is ORed with the other exit rules. See Indicators for the slot semantics.

Logic rules

RuleLong signal is 1 whenShort signal is 1 when
There is a narrow range formationthe read bar's range is the smallest of the formationthe read bar's range is the smallest of the formation

Both directions carry the same signal. The formation (NR4 or NR7) is the Formation parameter, not a separate rule line: the two share every line of code, and a parameter is what the Generator can vary.

The line is an event: the formation completes on isolated bars, which makes it a single-bar trigger for the Generator.

Parameters

ParameterTypeDefaultRangePurpose
FormationselectNR4NR4, NR7How many bars the range is compared with (four or seven)

Calculation

  1. Every bar carries its range, high − low.
  2. The read bar is narrow when its range is strictly smaller than the range of each of the three (NR4) or six (NR7) bars before it.

The bar range in points is drawn as a histogram in its own pane below the price chart (separatedChart), so the compression is visible on the chart.

Backtesting

  • The rule is evaluated on the previous (closed) bar behind a Bar Open point and on the current bar behind a Bar Close point, so only completed bars are compared.
  • Strict comparison: an equal range is not a narrow range.
  • The indicator never changes the entry or exit order price; the level comes from the point indicator.