Skip to main content

Entry conditions

Who it’s for
Anyone stating when a strategy should open a position
Assumes
You have read Indicators & data

An entry condition is the rule that must be true for a position to open. This page covers how they combine, when they are evaluated, and the four ways one can go wrong.


How they combine

Multiple entry conditions combine with AND. All must be true simultaneously, on the same bar.

RSI(14) > 60 AND EMA(9) > EMA(21) AND volume > 1.5 × AVG_VOLUME(20)

That is a deliberate default: an entry is a commitment of capital, so the conservative combination is the right one. If you want OR semantics on entry, say so explicitly and the builder expresses it. But be aware that each additional OR branch widens what triggers a trade.


When they are evaluated

At candle close. Not intra-candle, not on every tick.

Two consequences:

A condition true mid-candle and false at close never fires. If RSI touches 61 halfway through a 5-minute bar and closes at 58, no entry.

Your fill is at the close, not at the level. The condition tested a closing value, so the entry price is the price at which the condition became true. Not the level the indicator crossed.

This is also why the backtest cannot know the intra-candle path.


The vocabulary

Comparisons

RSI(14) > 60
CLOSE < BB_LOWER(20)
ADX(14) >= 25
CLOSE > PREV_DAY_HIGH

Crosses

These are directional and stateful: a cross fires on the bar the relationship changes, not on every bar it holds:

RSI(14) crosses above 55
EMA(9) crosses above EMA(21)
MACD_LINE crosses above MACD_SIGNAL
A cross and a comparison are different rules

RSI > 55 is true on every bar RSI stays above 55. RSI crosses above 55 is true on one bar.

The first will keep re-triggering entries while the condition holds, bounded only by your position and trade-count caps. The second fires once per crossing. Most of the time you mean the cross, and saying "crosses above" is what gets it.

Distance and proximity

CLOSE within 0.5% of EMA(20)
CLOSE > EMA(20) × 1.02

Always state the distance. "Near the 20 EMA" is a MISSING_THRESHOLD gap and the builder will ask. See AI limitations

Ratios against averages

VOLUME > 1.5 × AVG_VOLUME(20)
ATR(14) > 1.2 × ATR(50)

Ranges

RSI(14) between 40 and 70

The positive form of "unless above 70", and the one to reach for.

Named signals

Any of the thirty-one knowledge-base signals by name:

buy when supertrend turns bullish and we are within market hours

Patterns

buy on a confirmed bullish engulfing at a swing low
buy on a break of structure to the upside

Higher-timeframe gates

buy on the 5-minute RSI cross, but only when the daily trend is up

Every gate's condition must pass on its most recently closed higher-timeframe bar. See Advanced strategies.

Filters

Conditions whose job is to prevent entries rather than cause them. State them as part of the entry:

...and we are not near a circuit limit
...and it is not F&O expiry day
...and India VIX is below 16

The four ways an entry condition goes wrong

1. It is never true

The most common and most confusing failure: the backtest succeeds with zero trades and reports no error.

Validation catches the structural causes:

CauseCaught by
Contradictory AND clauses, RSI >= 70 AND RSI <= 30Satisfiability check
A reference to an indicator that does not existBare-identifier walk
A reference series with no named reference symbolBenchmark binding check
A trading window disjoint from the instrument's sessionGates-fit-market check

What validation cannot catch is a condition that is legal, coherent, and simply too tight. Four AND-ed clauses each true 20% of the time are jointly true rather less often than you might guess.

See Validation system.

2. It is true too often

The opposite failure, and less obvious because it produces plenty of trades. A comparison used where you meant a cross re-fires on every bar the condition holds. Symptoms: an enormous trade count, and a gross-to-net return gap that eats the whole edge.

See Reading results honestly.

3. It says something different from what you meant

The dangerous one, because everything works. Two sources:

Ambiguous scope. "Buy unless volume is falling" has two readings and the builder refuses to pick. It asks. Do not reword until something compiles; a rewording that means the opposite backtests just as happily. See AI limitations

Cross versus comparison. See above.

The defence is reading the assembled strategy's condition back before accepting it.

4. It cannot be evaluated on this instrument

A volume condition on an instrument with no usable volume series, or a fundamental metric with no coverage. The condition is legal and simply has no data behind it. See Asset Explorer.


Short entries

For a strategy that can go short, the short entry is a separate condition. A long_only strategy cannot short whatever its exit condition says, direction and legs must agree, and validation enforces it.

The builder can derive a short leg from a long one where the request implies symmetry, and it marks the leg as auto-derived when it does. Read it: a mirrored condition is not always the rule you would have written for the short side.


Worked examples

You sayIt becomes
"buy when RSI crosses above 55 and price is above the 20 EMA"RSI(14) crosses above 55 AND CLOSE > EMA(20)
"enter on a breakout of the 20-day high with 1.5× average volume"CLOSE > DONCHIAN_UPPER(20) AND VOLUME > 1.5 × AVG_VOLUME(20)
"buy the opening range breakout, only in market hours"opening_range_breakout AND within_market_hours
"long when the daily trend is up and the 5-minute MACD crosses up"5m: MACD_LINE crosses above MACD_SIGNAL, gated on a daily HTF trend condition
"buy oversold bounces but not near a circuit"RSI(14) < 30 AND not_near_circuit

A checklist

  • Every vague word has a number
  • I meant a cross where I said cross, and a comparison where I said comparison
  • Nothing is phrased with "unless", "except" or "other than"
  • The AND-ed clauses can be simultaneously true
  • Any reference series names its reference symbol
  • Volume conditions are on an instrument with usable volume
  • The trading window overlaps the instrument's session
  • I read the assembled condition back and it says what I meant

Next