Appearance

Personalize your experience

Mode
Accent Color
Direction
Variables Reference

Variables Reference

Reference

What can appear on either side of a condition — bar fields, earlier bars, higher timeframes, statistics, clock and calendar values, and formulas — and how each one resolves on a bar.

How an operand resolves

Each side of a condition is an operand: an indicator from the (bar fields such as Close are indicators too), its parameters, which output to read, how many bars ago, and optionally a higher timeframe. The engine computes the whole series once per run and reads one per bar. A value that does not exist yet — warm-up, or an offset before the first bar — is missing, and any comparison with a missing value is false.

FieldTypeDefaultDescription
indicator*string—A name: Close, , , BollingerBands, TimeOfDay, CustomFormula, …
paramsobjectcatalog defaultsOnly the indicator’s own parameters, within their ranges. Unknown keys are errors.
outputstringfirst outputFor multi-output indicators: BollingerBands upper / lower / middle / / percentB, MACD macd / signal / , line / direction, …
offsetinteger0Bars ago, counted in the signal’s own timeframe. with offset 1 is the previous bar’s RSI.
intervalstringsignal timeframeRead this operand on a higher timeframe (1h 50 on a 5m ). Only closed bars of that timeframe are used, so there is no .

The - side is a number, a bar field (close, open, high, low, hl2, hlc3, ohlc4, volume) read on the signal's own bars, or another operand.

Price fields

IndicatorWhat it measuresParameters (default, range)Outputs and value range
Close price.—value: price
OpenBar open price.—value: price
HighBar high price.—value: price
LowBar low price.—value: price
HL2(high + low) / 2.—value: price
HLC3(high + low + close) / 3.—value: price
OHLC4(open + high + low + close) / 4.—value: price
PriceChangeChange of the source over N bars, in price units.period = 1 (1…1000); source = close (close | open | high | low | hl2 | hlc3 | ohlc4 | volume)value: any value
★
Pro tip:Close > Highest(20, close) with offset 1 on the is the idiom for “a new 20-bar closing high”: the right side is the close of the 20 bars before this one. Without the offset the current close is part of the and the comparison can never be true.

Statistics

statistics over a turn a price series into something comparable across instruments — “two standard deviations from the mean” instead of “five rupees from the mean”.

IndicatorWhat it measuresParameters (default, range)Outputs and value range
StatMedian .period = 20 (1…1000); source = close (close | open | high | low | hl2 | hlc3 | ohlc4 | volume)value: price
StatVariance population variance.period = 20 (2…1000); source = close (close | open | high | low | hl2 | hlc3 | ohlc4 | volume)value: at least 0
StatZScoreStandard deviations of the source from its mean.period = 20 (2…1000); source = close (close | open | high | low | hl2 | hlc3 | ohlc4 | volume)value: any value
StatPercentRankPercent of the previous N values below the current .period = 100 (1…1000); source = close (close | open | high | low | hl2 | hlc3 | ohlc4 | volume)value: between 0 and 100
StatCorrelationPearson correlation between two bar fields.period = 20 (2…1000); source = close (close | open | high | low | hl2 | hlc3 | ohlc4 | volume); source2 = volume (close | open | high | low | hl2 | hlc3 | ohlc4 | volume)value: between -1 and 1
StatSkewness of the .period = 20 (3…1000); source = close (close | open | high | low | hl2 | hlc3 | ohlc4 | volume)value: any value
StatKurtosis excess (0 = normal).period = 20 (4…1000); source = close (close | open | high | low | hl2 | hlc3 | ohlc4 | volume)value: any value
StatLinRegSlopeSlope of the least-squares line, price units per bar.period = 20 (2…1000); source = close (close | open | high | low | hl2 | hlc3 | ohlc4 | volume)value: any value
StatLinReg of the least-squares line at the current bar.period = 20 (2…1000); source = close (close | open | high | low | hl2 | hlc3 | ohlc4 | volume)value: price
StatRSquaredGoodness of the linear fit, 0..1.period = 20 (2…1000); source = close (close | open | high | low | hl2 | hlc3 | ohlc4 | volume)value: between 0 and 1
Highest of the source over N bars (includes the current bar).period = 20 (1…1000); source = high (close | open | high | low | hl2 | hlc3 | ohlc4 | volume)value: price
Lowest of the source over N bars (includes the current bar).period = 20 (1…1000); source = low (close | open | high | low | hl2 | hlc3 | ohlc4 | volume)value: price
!
Caution:The length is a real parameter. Short windows are reactive and noisy, long ones stable and slow. Because it is easy to try twenty values and keep the best, it is also a common route to an overfitted — choose it from the timeframe and leave it alone.

Date and time

Clock and calendar values are whole numbers in the 's (symbol.utcOffsetMinutes: 330 for NSE, 0 for crypto). TimeOfDay is HHMM, so 09:30 is 930 and 14:05 is 1405.

IndicatorWhat it measuresParameters (default, range)Outputs and value range
MarketOpen1 on the first bar of each trading day.—value: 0 or 1
MarketClose1 on bars that end within N minutes of the close time.closeTime = 1530 (0…2359); minutesBefore = 0 (0…600)value: 0 or 1
DayOfWeek1 = Monday … 7 = Sunday.—value: between 1 and 7 (whole numbers)
HourOfDayLocal hour, 0..23.—value: between 0 and 23 (whole numbers)
MinuteOfHourLocal minute, 0..59.—value: between 0 and 59 (whole numbers)
TimeOfDayLocal bar open time as HHMM, e.g. 930 for 09:30.—value: between 0 and 2359 (whole numbers)
BarOfDay1 for the first bar of the day, 2 for the second, …—value: at least 1 (whole numbers)
!
Caution:Values that do not exist on the clock are : HourOfDay == 7.5, HourOfDay >= 24, TimeOfDay == 975 (there is no minute 75), DayOfWeek == 8, and windows with no whole hour inside them such as HourOfDay > 9 AND HourOfDay < 10.
session windows
TimeOfDay >= 930  AND  TimeOfDay <= 1430           # mid-session only
NOT (TimeOfDay >= 1130 AND TimeOfDay <= 1330)       # skip the lunch lull
DayOfWeek <= 5                                      # weekdays (crypto)
BarOfDay == 1                                       # the first bar of each day

Formulas

When no single indicator says what you mean, a CustomFormula operand computes it per bar. Use it for ratios and distances that would otherwise need two conditions.

KindAvailable
Bar fieldsopen, high, low, close, volume, hl2, hlc3, ohlc4
Functionsabs(), sqrt(), log(), exp(), ceil(), floor(), round(), pow(), min(), max(), sign(), clamp(), nz()
Operators+ - * / % ^ < > <= >= == != && || ! ?:
Indicatorsany catalog indicator as NAME(args).output[barsAgo], e.g. SMA(close, 20), BollingerBands(close, 20, 2).upper, RSI(close, 14)[1]
formula operands
(close - SMA(close, 20)) / ATR(14)        # stretch from the mean, in ATRs
abs(close - open) / max(high - low, 0.0001) # body as a share of the range (guarded)
volume / VolumeSMA(20)                     # relative volume
open / PrevClose() - 1                     # overnight gap
★
Pro tip:Guard every division whose denominator is a price difference — a bar whose high equals its low (halts, illiquid instruments) divides by zero. max(x, 0.0001) or nz() keeps the formula defined.

See also

Related articles

  • Condition Evaluator

    Automation / Strategy Builder / Reference

    How a condition becomes true on a bar: series computed up front, no value during warm-up, the exact cross and rising rules, and the order of work on each…

  • DSL Bots

    Automation / Strategy Builder / Reference

    The 49 ready-made strategy-DSL bots: where to find them, how to load and adapt one, the file format, and what every bot is tested for.

  • Indicator Reference

    Automation / Strategy Builder / Reference

    All 94 indicators the strategy engine computes, grouped as in the builder's picker, with their parameters, outputs and the range of values each output can take.

  • Pitfalls & Anti-Patterns

    Automation / Strategy Builder / Reference

    The failure modes that show up repeatedly, what each one looks like from inside the builder, and the change that actually fixes it.

  • Strategy Builder FAQ

    Automation / Strategy Builder / Reference

    The questions that come up most often, answered with what the engine actually does rather than what would be convenient.

  • Strategy DSL Format

    Automation / Strategy Builder / Reference

    The engine JSON a strategy saves as. The form, node and JSON editors all edit this one document, and the C++ engine runs it unchanged in backtests and live.

  • Mean Renko

    Charts / Chart Types / Special Charts

    Renko bricks built from an averaged price instead of the raw close, so single-bar spikes do not reverse the chart.

  • Step 0 — Particulars

    Automation / Strategy Builder / Wizard Steps

    Identity and metadata: the name, description, tags and visibility that make a strategy findable a year from now. Also where the immutable Strategy ID is minted.

  • Step 1 — Settings

    Automation / Strategy Builder / Wizard Steps

    Global behaviour that decides how entries and exits interact: whether the strategy builds a position in stages, which multi-entry model it follows, and how…

Browse all knowledge base articles →