Range Levels Node

The Range Levels node gives you the levels at chosen ratios between a high and a low (Fibonacci retracements, the midpoint, extensions), the range's width, and where a value sits inside it.

NodeBy AlgoLiftUpdated 4 min read
On this page 7How it worksExample: buy the bottom quarter of yesterday's rangeSettingsOutputsUse something else whenWhen it doesn't behaveGoing further

Fibonacci retracements, the middle of yesterday's range, "premium" and "discount": they're all levels at fixed ratios between a high and a low. The Range Levels node takes any high and low you wire in and returns those levels, the range's midpoint and width, and where a value sits inside it.

Takes
A high and a low, plus an optional value to place
Gives
A level per ratio, the midpoint, the width, and the value's position
Reach for it
Retracements, midpoints and “where in the range is price” rules

How it works

Wire the top of the range into High and the bottom into Low. They can be any two numbers: yesterday's high and low from Price History, the opening range, two indicator values. Each ratio becomes a level. Measured From the low, 0 is the low, 1 is the high, and 0.618 sits 61.8% of the way up. The ports are labelled as percentages, so that one reads 61.8%.

Ratios outside 0 to 1 are extensions: 1.618 sits above the high, −0.272 below the low. You can have up to six, each from −5 to 5.

From the high turns the scale over, so 0 is the high and the ratios count down. That's how a retracement of a rally is usually drawn: 0.382 From the high is a shallow pullback from the top, 0.618 a deep one.

Wire a value, usually Current Price, into Value, and Position tells you where it is: 0 at the end you measure from, 1 at the other, 0.5 in the middle. It runs below 0 and above 1 once the value leaves the range.

Everything here is arithmetic on the inputs, recomputed on every trade, so it follows live price exactly. The cost is that it isn't a column the engine stores per bar. A modifier can't read it, and a Bracket Order can't measure a stop or target from it.

A Crossover can read a level, though: it rebuilds the line inside its own arithmetic, so "price crosses back above the 61.8% level" is one Crossover.

Example: buy the bottom quarter of yesterday's range

You trade ES 15m and want your long setups to fire only near the bottom of yesterday's range, aiming for its middle.

Add two Price History nodes on Window Session, Prior: one reading High into High, one reading Low into Low. Wire Current Price into Value. A Comparison then checks Position Less Than 0.25, the bottom quarter. AND it with your signal through a Logic node into a long Entry.

For the target, add a third Price History (Session, Prior, Midpoint), set the Bracket Order's target to measure from a Level, and wire it into the level input with a distance of 0.

One catch. Position keeps falling below 0 when price trades under yesterday's low, so this rule also buys breakdowns. If you only want trades inside the range, add Position Greater Than 0 to the AND. The node library's Patterns section has the first half ready as Prior day levels.

Settings

Ratios
Default 0.382, 0.5, 0.618
One to six, each from −5 to 5. Below 0 and above 1 are extensions.
Measured
Default From the low
From the low (0 is the low) or From the high (0 is the high).

Outputs

One level per ratio
Number
The level at each ratio, in the order you listed them, labelled by percentage (38.2%, 50% and 61.8% by default).
Midpoint
Number
The middle of the range, whichever way it's measured.
Width
Number
High minus low.
Position
Number
Where Value sits: 0 at the end you measure from, 1 at the other. Empty with nothing in Value, or when high and low are equal.

Use something else when

You only need yesterday's midpoint
Session, Prior, Midpoint is one node, and unlike Range Levels it can be a bracket's level.
Pivot points
Classic, Camarilla and Woodie levels from the prior period, formulas included.
Lines at multiples of a width around a center
The 20 EMA ± 2 ATR, or the open ± the average range, is Bands, not ratios of a range.

When it doesn't behave

The Bracket Order won't take my 50% level as its target

A bracket's level has to be a value the engine stores per bar, and Range Levels is worked out live. Use the value it's built from: Price History's Midpoint field for the middle of a period, or a level that's already a column.

My 61.8% level is below my 38.2% level

That's From the high doing its job, counting down from the top. If you meant From the low, switch it. If the direction is already From the low, check that High and Low aren't wired the wrong way round.

Position is always empty

Nothing is wired into Value, or the range has no width because high and low are the same number.

Going further

Optimize doesn't sweep the ratios, and that's no great loss. Trying 0.382, 0.5, 0.618 and 0.786 by hand until one of them shows a bounce is close to a textbook case of fitting noise. Decide which retracement your idea is about first, and if you do test several, count it as the search it is.

Position is also a handy oscillator in its own right. Fed the opening range's high and low, it reads where price sits in the opening range, from 0 at its low to 1 at its high, beyond either end once the range breaks.

Or ask the copilot