Skip to content
StatePath
Tool Atlascalc.cross

Tool

Cross

calc.cross

CalculationCross

Inputs

series_aBuffer (time series)

The first number line (e.g. a fast moving average).

series_bBuffer (time series)

The second number line (e.g. a slow moving average or a level).

start_offsetBuffer (time series)

First bar of the scan window (windowed_count mode).

end_offsetBuffer (time series)

Last bar of the scan window (windowed_count mode).

Outputs

Boolean

A boolean that is true on each bar the chosen cross event occurs.

Cross watches two lines and fires true on every bar where the relationship you picked happens. It's the workhorse for crossover strategies: a fast line crossing a slow line, a price touching a level, or two lines pulling apart.

Cross overview diagram

How it works

You wire two number lines (series_a and series_b) plus a start and end bar for the scan window, choose a mode, and Cross checks each bar for that event. Pick one of nine events with the mode picker and the inspector greys out the settings that don't apply, so you only see the knobs that matter.

Modes

Mode options

Instant crossinstant_cross

Fires on the exact bar the two lines cross.

Instant cross diagram

When to use: The classic crossover trigger — a fast line crossing a slow line.

Recent crossrecent_cross

Fires if a cross happened within the last few bars.

Recent cross diagram

When to use: Catch a cross you may have missed by one or two bars.

Windowed countwindowed_count

Counts how many crosses fall inside a bar window.

Windowed count diagram

When to use: Gate on 'at least N crosses' (or 'no crosses') over a span.

Confirmed crossconfirmed_cross

Fires only after the new side holds for `dwell` bars.

Confirmed cross diagram

When to use: Filter out fake-outs that immediately cross back.

Threshold crossthreshold_cross

Fires once the lines separate by `min_gap` after crossing.

Threshold cross diagram

When to use: Require a real break, not a hairline touch.

Touchtouch

Fires when the lines come within `epsilon` of each other.

Touch diagram

When to use: Detect a test of a level without a full cross.

Touch and rejecttouch_and_reject

Fires when the lines touch then pull apart.

Touch and reject diagram

When to use: Bounce / rejection setups off a moving average or level.

Convergenceconvergence

Fires while the gap between the lines is shrinking.

Convergence diagram

When to use: Anticipate a cross as two lines close in.

Divergencedivergence

Fires while the gap between the lines is widening.

Divergence diagram

When to use: Confirm a trend as the lines spread apart.

Direction options

Upup

Only when series_a rises through series_b.

Up diagram

When to use: Long-only crossover entries.

Downdown

Only when series_a falls through series_b.

Down diagram

When to use: Short-only crossover entries.

Anyany

Either direction fires.

Any diagram

When to use: Symmetric setups that trade both sides.

Bar alignment options

Closed barsclosed

Evaluates only finished bars — never repaints.

Closed bars diagram

When to use: The safe default for backtests and live trading.

Live barlive

Reacts inside the forming bar in tick mode.

Live bar diagram

When to use: Only when you knowingly want intra-bar reaction.

Gap unit options

Priceprice

min_gap / epsilon are raw price differences.

Price diagram

When to use: Single symbol where absolute distance is meaningful.

Percentpercent

min_gap / epsilon are a percent of the midpoint.

Percent diagram

When to use: Portable thresholds across symbols of different scale.

Equality policy options

Treat as crosstreat_as_cross

A move off exact equality counts as a cross.

Treat as cross diagram

When to use: The recommended, most intuitive behavior.

Ignoreignore

A move off equality is suppressed.

Ignore diagram

When to use: Avoid double-counting flat ties.

Hold statehold_state

Carries the prior side forward through equality.

Hold state diagram

When to use: Keep a stable bias across flat patches.

Configuration

modeenum

Picks which crossing event to detect: instant_cross, recent_cross, windowed_count, confirmed_cross, threshold_cross, touch, touch_and_reject, convergence, or divergence.

Choices:instant_crossrecent_crosswindowed_countconfirmed_crossthreshold_crosstouchtouch_and_rejectconvergencedivergence
directionenum

Which side fires the signal — 'up' when series_a rises through series_b, 'down' when it falls through, or 'any' for both.

Choices:updownany
bar_alignmentenum

'Closed' (recommended) evaluates only finished bars so nothing repaints; 'live' reacts inside the current bar in tick mode but can flip before the bar closes.

Choices:closedlive
lookbackscalar

How many bars back the event may have happened and still count; 1 means this bar only, larger values accept later entries.

lookback diagram
forwardscalar

When on, searches future bars instead of past ones — safe only with indicators already plotted into the future; leave off for normal indicators.

windowscalar

How many bars in a row the gap must shrink (convergence) or widen (divergence) to fire; larger values trigger rarely but with more conviction.

window diagram
min_countscalar

The smallest number of crossings the window must contain to fire; 1 is the classic 'at least one cross' gate.

max_countscalar

The largest number of crossings the window may contain; -1 means no upper cap, and Min and Max both at 0 makes a 'no crosses allowed' gate.

absolutescalar

Off (recommended) slides the window bar-by-bar so each bar gets its own answer; on fixes the window in time for legacy Shayan setups.

dwellscalar

How many bars the new trend must hold before a confirmed cross fires; higher gives later but more reliable entries.

min_gapscalar

How far the lines must separate after a threshold cross before it fires; a re-cross before this distance cancels the pending signal.

epsilonscalar

How close the lines must be to count as touching; 0 requires exact equality, a small positive value means 'close enough'.

gap_unitenum

Units for min_gap and epsilon — 'price' uses the raw difference, 'percent' uses percent of the midpoint so it scales across symbols.

Choices:pricepercent
equality_policyenum

What to do when the lines were exactly equal last bar — 'treat_as_cross' (recommended) counts the move off equality, 'ignore' blocks it, 'hold_state' carries the prior side forward.

Choices:treat_as_crossignorehold_state
recross_suppressscalar

After a cross fires, ignore further crosses for this many bars to stop rapid back-and-forth signals; 0 disables it.

recross_suppress diagram

Connects to

Reads from
Feeds into

Examples

  • Signal trigger: in instant_cross mode with direction 'up', fire a long when a fast EMA crosses above a slow EMA (a golden cross).
  • Filter: in touch mode, gate entries to only the bars where price comes within a pip of a moving average.

Common mistakes

  • Turning on 'forward' with raw price — it peeks into future bars and produces unrealistic backtests; only use it with indicators already drawn into the future like Ichimoku's Senkou lines.
  • Leaving direction on 'any' when you only want one side, so death crosses fire your long entry too.

See also