Patterns & Conditions

The heart of every strategy: candle patterns, the three-section model, and the full condition syntax.

The three-section model

SectionPurposeCandle PeriodPatterns allowed
Pre Entry optional Setup conditions that must occur before an entry is even considered (e.g. "a swing high then a swing low formed in the last hour"). You set it — scans the last N candles. Auto-updates to match the number of pre-entry patterns you add. Any number of candle patterns, matched in order.
Entry required The trigger. When the entry pattern matches and the entry condition is true, the trade is placed. Always 1 (locked). Entry is decided on a single candle. Exactly one candle pattern (validated at save).
Exit optional Pattern/condition-based exits, evaluated while the trade is open (in addition to SL and target). You set it — auto-updates with the number of exit patterns. Any number of candle patterns.
Why is the entry period always 1? Entries must be unambiguous: one specific candle triggers the trade, and that candle's Open/High/Low/Close become your entry variables for stoploss and exits. Multi-candle setups belong in the Pre-Entry section.

Candle pattern indicators

Each pattern you add in a section is a named Candle indicator with three settings:

SettingOptionsWhat it does
Candle Color Green / Red / (blank = any) The matched candle must close up (Green), down (Red), or either (blank).
Candle Gap integer (e.g. 0, 4, 60) Maximum number of candles allowed between this pattern's match and the next event in the sequence. 0 = must be immediately adjacent. See Candle Gap explained.
Candle Position most_recent / last_closed_candle / higher_high / lower_low How the candle is located: the most recent matching candle, the last fully closed candle, the candle making the highest High in the window, or the lowest Low.

The pattern's name becomes a variable in conditions, exposing the matched candle's values: name['Open'], name['High'], name['Low'], name['Close'], name['Volume'], name['Time'].

Candle Gap (max_gap) explained

When a section has multiple patterns, they must match sequentially. The gap on each pattern limits how far apart consecutive matches may be:

Pre-entry: candle_high (gap 60) → candle_low (gap 4) → ENTRY

candles:  [H]· · · · · · · · · ·[L]· · ·[E]
               ≤ 60 candles      ≤ 4 candles
Choosing gaps Small gaps (0–5) demand tight sequences and fewer signals. Large gaps (30–60) allow loose setups. Gap 0 forces strictly adjacent candles.

Conditions

Each section has one condition string built with the Condition Builder popup — either by dragging tokens (parentheses, indicators, operators, numbers, time, AND/OR) or by typing the expression directly and clicking Build Condition.

Available variables by section

Writing a condition in…You can reference…
Pre EntryCommon indicators + pre-entry pattern names
EntryCommon indicators + pre-entry + entry pattern names
ExitCommon indicators + pre-entry + entry + exit pattern names

This scoping is what lets an exit condition compare against the entry candle: exitC['Close'] < entry['Low'].

Indicators are columns on a candle Every indicator you add becomes a column on each candle, just like OHLC. So you always read it through a candle reference — entry['rsi14'], candle_high['bb_middleband'] — never as a bare rsi14. A bare indicator name is undefined and the condition will fail.

Syntax reference

ConstructSyntaxExample
Candle attributename['Field']entry['Close'], candle_high['High']
Indicator (single output)candle['name']entry['rsi14'], entry['vwap1']
Indicator (multi output)candle['name_suffix']entry['bb_upperband'], entry['macd1_Signal']
Comparison> < >= <= == !=entry['rsi14'] > 60
Logical AND&&A && B
Logical OR||A || B
Arithmetic+ - * / %entry['High'] - entry['Low']
Grouping( )(A && B) || C
Numbersplain numerals0.5, 100
Percent of a valuemultiplycandle_high['High'] * 0.01 (1%)
Time of dayHH:MM compared to name['Time']entry['Time'] > 09:30
Validation The builder checks balanced parentheses and complete expressions before accepting a condition, and every condition is validated again when you save the strategy. Stick to your declared pattern/indicator names, numbers, operators, and times — anything else is rejected.

Running candle options

ToggleEffect
Use Running Candle (Entry)Entry pattern/condition is evaluated on the live forming candle instead of waiting for it to close. Faster entries, but the candle's final values may differ from what triggered.
Use Running Candle (Exit)Same idea for exit patterns — exits can trigger mid-candle.

Worked examples

Example 1 — Bollinger Band reclaim (simple entry)

Setup: common indicator bb (Bollinger Bands 20/2); entry pattern entry = Green candle, gap 0.

# Entry condition
(entry['Low'] < entry['bb_middleband']) && (entry['Close'] > entry['bb_middleband'])

A green candle that wicks below the middle band but closes back above it.

Example 2 — Swing range then breakout (pre-entry + entry)

Pre-entry patterns: candle_high (position higher_high, gap 60) and candle_low (position lower_low, gap 4). Candle period 60.

# Pre-entry condition: at least a 1% high→low range, high formed first
(candle_high['High'] - candle_low['Low']) >= (candle_high['High'] * 0.01)
  && (candle_high['Time'] < candle_low['Time'])

# Entry condition: green candle reclaiming the BB midline
(entry['Low'] < entry['bb_middleband']) && (entry['Close'] > entry['bb_middleband'])

Because candle_low has gap 4, the entry must fire within 4 candles of the swing low — otherwise the whole setup re-arms.

Example 3 — Time-filtered momentum entry

# Only after the opening 15 minutes, with trend strength
entry['Time'] > 09:30 && entry['adx1'] > 25 && entry['Close'] > entry['vwap1']

Example 4 — Pattern-based exit

Exit pattern: exitC = Red candle, gap 0.

# Exit when a red candle closes below the entry candle's low
exitC['Close'] < entry['Low']

This works because exit conditions can see the entry pattern variable.

Checklist before saving