Constant Node

The Constant node holds one fixed number: the 30 in RSI under 30, the 2 in twice the ATR. Why thresholds belong on their own node, and how Optimize sweeps them.

NodeBy AlgoLiftUpdated 1 min read
On this page 4How it worksSettingsWhen it doesn't behaveGoing further

Every threshold in a strategy is a number somebody picked. The 30 in "RSI under 30". The 1.5 in "volume at 1.5 times normal". A Constant puts one of those numbers on the canvas, where you can see it, wire it anywhere and sweep it.

Takes
Nothing
Gives
One fixed number, the same on every bar
Reach for it
A rule needs a threshold, a multiplier or any fixed value

How it works

Type a number into the node and wire its output wherever a number goes: the b of a Comparison, an input of a Math node, the line a Crossover watches. It holds that number for the whole run.

One Constant can feed several inputs, and that's worth doing on purpose. If a long and a short entry should always share a threshold, wire one Constant into both, and changing it moves both. If they should be free to differ, give each its own.

Settings

Value
Default 0
Any number from −999,999 to 999,999, with up to three decimals.

When it doesn't behave

My value turned into 0

The field was cleared, or left as a lone minus sign, when you clicked away, and an empty Constant becomes 0. Type the number again.

A sweep changed two rules at once

Both rules read the same Constant, so sweeping it moves both. That's right if they should move together. If not, split it into two Constants and sweep the one you mean.

Going further

In Optimize, every Constant on the canvas shows up as a parameter you can sweep, which is the best reason to keep thresholds on Constants rather than typed into other nodes. Sweep a range you could defend before seeing the results, in steps wide enough to mean something. RSI 28, 29, 30, 31 and 32 are five chances for noise to look like an edge, and every value you try counts against the project's search budget.

Or ask the copilot