Raw data inputs — bar prices, tick prices, position state, time constants. Source blocks have no inputs.
Latest tick bid/ask/mid prices from live data. Only available when the graph timeframe is set to TICKS. For bar-based graphs use Source.Bar.Current instead.
Outputs
bidNumber — use for SHORT entries
midNumber — use for indicators
askNumber — use for LONG entries
The bar that just closed. The primary data source for bar-based graphs. Not available for tick data (use Tick Price → Aggregator instead).
Outputs
barBar — closed OHLCV bar
Unix-millisecond timestamp of the current bar's close. Wire into Gate.Session directly, or compare against Source.Constant.DateTime for time-conditional logic.
Outputs
timeDateTime — Unix ms
A fixed number that does not change bar-to-bar. Mark as tunable to expose to PSO — the optimizer will search the range you specify.
Outputs
valueNumber
Parameters
valuenumber default 0tunable
A fixed time-of-day in CET (e.g. 09:00). Useful for comparing against Source.Time.Now to build custom session filters.
Outputs
valueDateTime
Parameters
hourinteger 0–23, default 9
minuteinteger 0–59, default 0
A fixed true or false value. Useful for temporarily disabling a gate branch without rewiring.
Outputs
valueBoolean
Parameters
valueboolean default true
Extracts a single numeric field from a Bar object. Use to feed a specific price field (e.g. close) into a Math or Compare block.
Inputs
barBar
Outputs
valueNumber
Parameters
fieldenum open | high | low | close | volume | bid | ask, default close
Number of bars elapsed since the current position was opened. Returns −1 when flat, 0 on the entry bar, 1 on the next bar, etc. Use with Compare.GTE for time-based exits.
Outputs
valueNumber — −1 when flat
Tracks the maximum bar.high seen since the position opened. Returns 0 when flat. Classic use: HighSinceEntry − (ATR × mult) → Sink.UpdateStop for a Chandelier trailing stop on longs.
Outputs
valueNumber — 0 when flat
Tracks the minimum bar.low seen since the position opened. Returns 0 when flat. Mirror of High Since Entry for short positions: LowSinceEntry + (ATR × mult) → trailing stop.
Outputs
valueNumber — 0 when flat
The fill price of the currently open position. Returns 0 when flat. Use to compute distance-from-entry for profit-target or breakeven logic.
Outputs
valueNumber — 0 when flat
The current stop-loss price level of the open position. Returns 0 when flat. Use as the lower bound in trailing logic: Math.Max(PositionStopLoss, newTrail) prevents the stop moving away.
Outputs
valueNumber — 0 when flat
Unrealised PnL in price points: close − entry for longs, entry − close for shorts. Returns 0 when flat. Use with Compare.GT to gate trailing stop activation (e.g. only trail after +20 pts profit).
Outputs
valueNumber — 0 when flat
Timeframe resampling. All aggregators emit the last fully closed bar — no partial bars, no lookahead. A bar is held stable until the next one closes.
Technical indicators computed on closed-bar data. All return 0 until enough history is available. Formulas shown use standard notation: N = period, t = current bar.
Exponential Moving Average. Weights recent closes more heavily than older ones. The smoothing factor α determines the decay rate.
α = 2 / (N + 1)
EMA[t] = close[t] × α + EMA[t-1] × (1 - α)
Seed: EMA[N-1] = SMA of first N closes
Inputs / Outputs / Params
bar →Bar
value ←Number
periodinteger 2–500, default 20tunable
Simple Moving Average. Arithmetic mean of the last N closes. Slower to react than EMA — good for stable trend filters and Bollinger Band midlines.
SMA[t] = (close[t] + close[t-1] + … + close[t-N+1]) / N
Inputs / Outputs / Params
bar →Bar
value ←Number
periodinteger 2–500, default 20tunable
Average True Range. Direction-free volatility measure. The True Range captures the largest of the current candle range, the gap-up, and the gap-down relative to the prior close. ATR is the Wilder-smoothed average.
TR[t] = max(high[t] − low[t],
|high[t] − close[t-1]|,
|low[t] − close[t-1]|)
ATR[t] = (ATR[t-1] × (N-1) + TR[t]) / N (Wilder smoothing)
Seed: ATR[N-1] = mean(TR[0..N-1])
Inputs / Outputs / Params
bar →Bar
value ←Number
periodinteger 2–200, default 14
Relative Strength Index (0–100). Measures momentum by comparing average gains to average losses using Wilder smoothing. Classic thresholds: <30 oversold (long signal), >70 overbought (short signal).
ΔC[t] = close[t] − close[t-1]
Gain[t] = max(ΔC, 0), Loss[t] = max(−ΔC, 0)
AvgGain / AvgLoss: Wilder EMA(N) of Gain / Loss
RS = AvgGain / AvgLoss
RSI = 100 − 100 / (1 + RS)
Inputs / Outputs / Params
bar →Bar
value ←Number 0–100
periodinteger 2–100, default 14
Average Directional Index (0–100). Measures trend strength irrespective of direction. ADX >25 = strong trend; ADX <20 = no trend / range. Internally computes +DI and −DI but only exposes ADX.
+DM = high[t] − high[t-1] if > 0 else 0 (and > −DM)
−DM = low[t-1] − low[t] if > 0 else 0 (and > +DM)
Smooth +DM, −DM, TR with Wilder EMA(N)
+DI = 100 × Smooth(+DM) / ATR(N)
−DI = 100 × Smooth(−DM) / ATR(N)
DX = 100 × |+DI − −DI| / (+DI + −DI)
ADX = Wilder EMA(DX, N)
Inputs / Outputs / Params
bar →Bar
value ←Number 0–100
periodinteger 2–100, default 14
Volume-Weighted Average Price. Resets each trading session (UTC+1 midnight). Represents the "fair value" price of the day weighted by transaction volume. Reverts to 0 at session open until first bar arrives.
TP[t] = (high[t] + low[t] + close[t]) / 3
VWAP[t] = Σ(TP[i] × vol[i], i=session_start..t)
/ Σ(vol[i], i=session_start..t)
Resets: daily at UTC+1 midnight
Inputs / Outputs
bar →Bar
value ←Number
Stochastic oscillator (0–100). %K measures where the close sits within the recent high-low range; %D smooths %K. Extremes (<20 oversold, >80 overbought) signal reversals; %K/%D crossovers signal momentum shifts.
%K[t] = 100 × (close[t] − Lowest(low, k_period))
/ (Highest(high, k_period) − Lowest(low, k_period))
%D[t] = SMA(%K, d_period)
Inputs / Outputs / Params
bar →Bar
k ←Number fast stochastic 0–100
d ←Number signal line 0–100
k_periodinteger 2–100, default 14
d_periodinteger 1–50, default 3
Volatility envelope: SMA ± σ standard deviations. Price touching the lower band = statistically extreme (long entry for MR). Squeeze (narrow bands) = volatility compression, often precedes breakout.
Middle = SMA(close, N)
σ_std = population std dev of close over N bars
Upper = Middle + sigma × σ_std
Lower = Middle − sigma × σ_std
Inputs / Outputs / Params
bar →Bar
upper / middle / lower ←Number
periodinteger 2–500, default 20
sigmanumber 0.1–5.0, default 2.0
Rolling maximum of a specified bar field over the last N bars (current bar inclusive). Use for Donchian-style breakout levels or resistance detection.
Highest[t] = max(field[t], field[t-1], …, field[t-N+1])
Inputs / Outputs / Params
bar →Bar
value ←Number
periodinteger 2–500, default 20
fieldenum open|high|low|close, default high
Rolling minimum of a specified bar field over the last N bars. Mirror of Highest(N) — use for Donchian support levels or entry triggers below recent lows.
Lowest[t] = min(field[t], field[t-1], …, field[t-N+1])
Inputs / Outputs / Params
bar →Bar
value ←Number
periodinteger 2–500, default 20
fieldenum open|high|low|close, default low
Counts the current streak of consecutive higher-close or lower-close bars. The opposite counter resets to 0 on a direction change. Use for streak-reversal entries: e.g. 4+ down bars → long fade.
if close[t] > close[t-1]:
up_count += 1; down_count = 0
elif close[t] < close[t-1]:
down_count += 1; up_count = 0
Inputs / Outputs
bar →Bar
up_count ←Number resets to 0 on a down bar
down_count ←Number resets to 0 on an up bar
Identifies confirmed pivot highs using an N-bar fractal: bar[t].high must be the maximum of the surrounding 2N+1 bars. Because the right-side N bars must close before confirmation, the signal fires N bars after the actual pivot — no lookahead bias. The price output holds the most recent confirmed pivot high level.
Pivot at bar[p] if:
high[p] = max(high[p-N .. p+N])
Confirmed at bar[p+N] (right side complete)
price = high[p] (held until next pivot)
Inputs / Outputs / Params
bar →Bar
price ←Number most recent swing-high level
confirmed ←Boolean true only on confirmation bar
lookbackinteger 1–50, default 5tunable
Mirror of Swing High for pivot lows. Fires N bars after the actual low point once the right-side N bars have confirmed the minimum. Use price as a structural stop anchor or confirmed as a counter-trend entry trigger.
Pivot at bar[p] if:
low[p] = min(low[p-N .. p+N])
Confirmed at bar[p+N]
price = low[p] (held until next pivot)
Inputs / Outputs / Params
bar →Bar
price ←Number most recent swing-low level
confirmed ←Boolean true only on confirmation bar
lookbackinteger 1–50, default 5tunable
Moving Average Convergence Divergence. Classic momentum indicator: the MACD line measures the gap between a fast and slow EMA. The signal line is an EMA of the MACD. The histogram makes divergences visible bar-to-bar.
MACD[t] = EMA(close, fast) − EMA(close, slow)
signal[t] = EMA(MACD, signal_period)
histogram[t] = MACD[t] − signal[t]
Positive histogram → upward momentum building
Inputs / Outputs / Params
bar →Bar
macd ←Number MACD line
signal ←Number signal line
histogram ←Number MACD − signal
fast_periodinteger 2–200, default 12
slow_periodinteger 5–500, default 26
signal_periodinteger 2–100, default 9
Kaufman Efficiency Ratio. Divides the net price displacement over N bars by the total path length (sum of absolute bar-to-bar changes). ER → 1.0 = trending cleanly; ER → 0.0 = choppy noise. DAX research: 78.5% of days have ER < 0.15.
direction = |close[t] − close[t-N]|
noise = Σ |close[i] − close[i-1]| for i = t-N+1 .. t
ER[t] = direction / noise (range 0.0–1.0)
Returns 0 until N+1 bars available
Inputs / Outputs / Params
bar →Bar
value ←Number 0.0–1.0
periodinteger 2–500, default 20tunable
ATR-based envelope around an EMA. Unlike Bollinger Bands (standard deviation), the channel width scales with true-range volatility, so it stays tighter in ranging markets. Classic squeeze signal: Bollinger Bands contracting inside the Keltner channel predicts a volatility expansion.
middle = EMA(close, ema_period)
upper = middle + mult × ATR(atr_period)
lower = middle − mult × ATR(atr_period)
Inputs / Outputs / Params
bar →Bar
upper / middle / lower ←Number
ema_periodinteger 2–500, default 20tunable
atr_periodinteger 2–200, default 14
multnumber 0.1–10.0, default 2.0tunable
Rolling statistical z-score of close relative to its recent mean and standard deviation. Measures how many standard deviations price is from its recent average. Z < −2 = statistically cheap (long MR entry); Z > +2 = statistically expensive (short MR entry).
mean[t] = SMA(close, N)
std[t] = population std dev of close over N bars
Z[t] = (close[t] − mean[t]) / std[t]
Returns 0 until N bars available. std=0 → Z=0.
Inputs / Outputs / Params
bar →Bar
value ←Number typical range ±1.5 to ±3.0
periodinteger 2–500, default 20tunable
Classic floor-trader pivot points computed from the prior day's high, low, and close (UTC+1). All 7 levels update once per day and are stable intraday. Returns 0 for all outputs until the first complete trading day passes.
P = (prev_H + prev_L + prev_C) / 3
R1 = 2P − prev_L
R2 = P + (prev_H − prev_L)
R3 = prev_H + 2 × (P − prev_L)
S1 = 2P − prev_H
S2 = P − (prev_H − prev_L)
S3 = prev_L − 2 × (prev_H − P)
Inputs / Outputs
bar →Bar
p ←Number pivot point
r1, r2, r3 ←Number resistance levels 1–3
s1, s2, s3 ←Number support levels 1–3
Composite structural level detector. Combines pivot fractals, session extremes, prior-day high/low, overnight range, weekly extremes, opening range, and round numbers into a unified support/resistance model. Levels within merge_zone_pts are merged. Proximity gates use ATR multiples to define the "touch zone".
Inputs: bar + atr_value
Level sources:
• N-bar pivot fractal highs/lows (pivot_lookback)
• Session high/low (reset at session_open_hour)
• Previous calendar day H/L
• Overnight range H/L (22:00–overnight_end_hour CET)
• Weekly Mon–Fri H/L
• Opening range H/L (first or_duration_minutes)
• Round numbers (every round_number_step pts)
Merge: levels within merge_zone_pts → single level
at_support = dist_support ≤ touch_zone_atr_mult × ATR
Inputs
barBar
atr_valueNumber from Indicator.ATR
Key Outputs
support / resistanceNumber nearest level price
dist_support / dist_resistanceNumber ATR units
at_support / at_resistanceBoolean proximity gate
session_high, session_lowNumber
prev_day_high, prev_day_lowNumber
overnight_high, overnight_lowNumber
weekly_high, weekly_lowNumber
or_high, or_lowNumber opening range
or_completeBoolean OR window closed
Parameters
pivot_lookbackinteger 3–50, default 10tunable
touch_zone_atr_multnumber 0.1–2.0, default 0.5tunable
merge_zone_ptsnumber 1–50, default 5tunable
round_number_stepnumber 10–1000, default 100
session_open_hourinteger 0–23, default 8
session_open_minuteinteger 0–59, default 0
or_duration_minutesinteger 5–120, default 30tunable
overnight_end_hourinteger 0–12, default 9
Fires when price makes its second approach to a level after having pulled back cleanly by at least pullback_min_atr ATRs. The first touch flushes weak longs/shorts; the second is statistically stronger. Wire a SupportResistance.support price into level.
State machine per level:
IDLE → TOUCHING (close within touch_zone)
TOUCHING → PULLED_BACK (moved away ≥ pullback_min_atr)
PULLED_BACK → TOUCHING (second approach)
→ is_second_attempt = true (fires once)
attempt_count increments on each approach
max_bars_between: resets state if too much time passes
Inputs / Outputs / Params
bar →Bar
level →Number e.g. SupportResistance.support
atr →Number
is_second_attempt ←Boolean
attempt_count ←Number
is_supportboolean default true
pullback_min_atrnumber 0.1–3.0, default 0.5tunable
max_bars_betweeninteger 3–100, default 20tunable
Detects a clean level break then waits for a pullback retest. A break is confirmed when close is beyond the level by break_atr_mult × ATR. Once broken, is_breakout stays true until a retest is detected or max_retest_bars expires. Retesting the broken level from the new side fires is_retest_long or is_retest_short once.
Break confirmed: close > level + break_atr_mult × ATR (upward)
→ is_breakout = true, broken_level = level
Retest (long): close < broken_level + touch_zone_atr_mult × ATR
→ is_retest_long = true (fires once)
State resets if max_retest_bars exceeded
Inputs / Outputs / Params
bar →Bar
level →Number
atr →Number
is_breakout ←Boolean true while waiting for retest
is_retest_long ←Boolean fires once on long retest
is_retest_short ←Boolean fires once on short retest
broken_level ←Number
break_atr_multnumber 0.1–2.0, default 0.3tunable
touch_zone_atr_multnumber 0.1–2.0, default 0.5tunable
max_retest_barsinteger 3–60, default 15tunable
Filters that block or allow entry based on time, trend, volatility, or regime. Wire Gate outputs into Logic.And with your entry conditions. All gates are permissive until warmed up.
True iff the current bar's timestamp falls within the configured CET window. Use to restrict entries to the main trading session and avoid low-liquidity periods (pre-market, post-close).
Inputs / Outputs / Params
bar →Bar
allowed ←Boolean
start_hourinteger 0–23, default 7
start_minuteinteger 0–59, default 0
end_hourinteger 0–23, default 20
end_minuteinteger 0–59, default 0
use_cetboolean default true
Blocks LONG entries when the ATR-normalised EMA slope is more negative than the threshold. Intended for mean-reversion strategies that should not fade a strong downtrend. The slope output is available for further gating or plotting.
slope[t] = (EMA[t] − EMA[t − slope_lookback])
/ (ATR[t] × slope_lookback) (ATR-normalised)
allow_long = slope[t] ≥ block_long_below_slope
Inputs / Outputs / Params
bar →Bar
allow_long ←Boolean
slope ←Number + = uptrend, − = downtrend
ema_periodinteger 5–500, default 50
atr_periodinteger 2–200, default 14
slope_lookbackinteger 2–200, default 12
block_long_below_slopenumber −5.0–5.0, default −0.5tunable
Blocks all entries when current ATR is in an extreme percentile of recent history. Prevents trading during abnormal volatility spikes (e.g. flash crashes, macro data releases). The percentile output shows the rolling rank 0–1.
atr_history = rolling window of ATR(atr_period) values
percentile[t] = rank of ATR[t] in atr_history
/ len(atr_history) (0=lowest, 1=highest)
allow_entry = percentile[t] ≤ block_above_percentile
Inputs / Outputs / Params
bar →Bar
allow_entry ←Boolean
percentile ←Number 0–1 ATR rank
atr_periodinteger 2–200, default 14
percentile_windowinteger 100–20000, default 2000
block_above_percentilenumber 0.0–1.0, default 0.80tunable
Classifies the current market into four mutually-exclusive regimes using a multi-signal model. Each regime is exposed as a Boolean output so you can gate different strategy logic to the regime where it performs best.
Inputs used:
EMA(fast) / EMA(slow) slope + separation
ATR percentile (rolling)
Range compression ratio (recent vs historical)
Regimes:
TRENDING = |slope| ≥ min_slope AND separation ≥ min_sep
AND ATR ≥ min_atr_for_trending
MEAN_REVERTING = |slope| ≤ max_slope AND atr_pct ≤ max_pct
BREAKOUT = range_compression ≤ bo_min_range_compression
AND ATR ≥ min_atr_for_breakout
NEUTRAL = none of the above
All require min_bars_in_regime consecutive bars
Inputs / Outputs
bar →Bar
is_trending ←Boolean
is_mean_reverting ←Boolean
is_breakout ←Boolean
is_neutral ←Boolean
Parameters (key tunable ones)
ema_fast_periodinteger default 20
ema_slow_periodinteger default 50
atr_periodinteger default 14
trending_min_ema_slopenumber default 0.3tunable
trending_min_ema_separationnumber default 0.15tunable
mr_max_ema_slopenumber default 0.15tunable
mr_max_atr_percentilenumber default 0.4tunable
min_atr_for_trendingnumber default 15.0tunable
min_atr_for_breakoutnumber default 12.0tunable
Numeric comparison operators. Two Number inputs → one Boolean output. No parameters except Compare.EQ which has an epsilon tolerance.
Boolean logic gates for combining conditions. AND/OR/NOT have no parameters. IF-THEN-ELSE bridges Boolean conditions into numeric values.
Arithmetic operations on Number streams. Most have two Number inputs and one Number output. Crossover blocks output Boolean. Rolling blocks operate over a history window.
Output blocks that interact with the position manager. Sinks have no outputs — they cause side effects (opening positions, closing them, moving stops).