Skip to content
Strategy logic / reference guide

Wave Modifier and Sequential Monitoring

How historical comparisons and ordered checkpoints work together to control entry eligibility.

Strategy builder referenceFeature behavior, formulas, and examples
RULE FLOW SETTLED CANDLE X
01Feature 01
Wave Left[X] OP Right[X − offset] current left · historical right
02Feature 02
Monitoring ordered checkpoints · remembered state
AND
completed monitoring gatestandard entry condition
ENTRY
permission

Start here

The clean mental model

Wave Modifier changes one comparison by looking backward across candles.

Sequential Monitoring changes the timing of entry conditions by requiring checkpoints to occur in order. They can be combined: a monitoring stage may contain a Wave-modified condition.

Feature 01

Wave asks: “Which historical value should the right operand use?”

The left side stays on the latest fully closed candle. Only the right indicator or price operand moves backward.

Feature 02

Monitoring asks: “Did these events happen in the required order?”

The chain remembers completed stages across evaluation cycles, then acts as a gate for the ordinary entry condition.

A completed monitoring chain does not create a trade by itself.

Historical comparison

1. Wave Modifier

Wave is a precise rewrite of one comparison. It does not shift the whole strategy or search for a chart pattern; it changes the historical point used by the right operand.

Normal comparison vs. Wave comparison

Canonical rewriteWithout Wave: Left[X] OP Right[X] With Wave: Left[X] OP (Right[X − offset] × multiplier) X = latest fully closed candle · forming candle is not used

The left operand remains at X. X − offset is an exact number of closed candles before X. The operator keeps its normal meaning: >, <, >=, <=, ==, or !=.

Simple example

Suppose Close[X] > EMA20[X]. If Close[X] = 105 and EMA20[X] = 106, the normal condition fails. With offsets = [5] and multiplier = 1.0, the engine checks Close[X] > EMA20[X − 5]. If that historical EMA was 102, then 105 > 102 is true.

What this means

Wave can pass while current price is below the current EMA. It is comparing current price with a historical EMA level, not claiming that current price is above today’s EMA.

Wave does not soften an operator. 100 > 100 is false, 100 >= 100 is true, and 100 == 100 is true within the engine’s numeric tolerance.

Multiple offsets use OR

With offsets = [3, 8, 13], the engine evaluates the same current left value against EMA[X − 3], EMA[X − 8], and EMA[X − 13]. Only one usable offset needs to pass. These are alternative historical comparisons — not sequential monitoring stages.

Example: Close[X] = 105, operator is >, multiplier is 1.0
OffsetHistorical EMA20ComparisonResult
3107105 > 107Fail
8103105 > 103Pass — Wave passes
13101Not needed after the first passShort-circuited

The multiplier changes the threshold

The multiplier scales the historical right-hand value before the operator runs. It is not a percentage field: 1.05 means 105% of the historical value; 5 means five times the value.

Close[X] = 103 and EMA20[X − 8] = 100
MultiplierRight thresholdComparison
0.95100 × 0.95 = 95103 > 95 → pass
1.00100 × 1.00 = 100103 > 100 → pass
1.05100 × 1.05 = 105103 > 105 → fail

For a > comparison with positive values, a multiplier above 1 generally makes the condition harder and a multiplier below 1 generally makes it easier. For a < comparison, that practical effect is reversed because the threshold rises as the multiplier rises.

Try the Wave comparison

One passing offset is enough. Change the multiplier to see the threshold move.

1.00×
Choose offsets
105 > 107 × 1.00 = false · 105 > 103 × 1.00 = true · 105 > 101 × 1.00 = trueWAVE PASSES

RSI example

RSI14[X] > RSI14[X − offset] × 1.10 with offsets [5, 10] asks whether current RSI is at least 10% above any selected historical point. At RSI = 61, RSI[X − 5] = 58 fails because 61 > 63.8 is false; RSI[X − 10] = 52 passes because 61 > 57.2 is true.

History, warmup, and validation

The engine needs enough closed history for both the indicator and the largest Wave offset. Conceptually, required history ≈ operand warmup + largest offset. EMA50 with offsets [10, 40] needs more history than an ordinary EMA50 comparison. Missing history must wait through warmup — never fabricate zero, reuse the current candle, or treat missing data as a pass.

Contract limits

At least one unique positive integer offset is required; each offset is 1–100; there are at most 20 offsets; the multiplier must be finite and at least 0.01. Wave applies to plain comparisons with indicator or price operands, not crossover nodes such as “crosses above.” Builder defaults: offsets [11, 21, 31], multiplier 1.0.

Wave is not Elliott Wave analysis, pattern recognition, a rolling average, an AND across offsets, a time sequence, a left-operand shift, or a comparison against the forming candle.

Ordered checkpoints

2. Sequential Monitoring Mode

Sequential Monitoring remembers that checkpoints happened in order. It is an ordered state machine, not a simultaneous Boolean expression.

Why ordinary AND is different

An ordinary group requires every condition to be true on the same evaluation candle. A setup like RSI < 30 AND Close > EMA20 AND MACD histogram > 0 may never align. Monitoring lets RSI become oversold first, waits for price recovery, then waits for positive momentum.

The entry gatemonitoring chain completed AND standard LONG or SHORT entry condition currently true = entry permission
It is a gate, not an entry generator

A monitoring chain does not replace the standard LONG or SHORT entry condition. A monitored direction must have its corresponding standard entry rule; invalid configurations fail closed and do not trade.

The states

IDLE → Stage 1 passes

The direction becomes armed and starts waiting for Stage 2.

ARMED → next expected stage

Only the currently expected stage is evaluated. Earlier or later stages do not receive retroactive credit.

COMPLETED → gate armed

The final stage passes. The monitoring gate stays ready even if the standard entry is still false.

ENTRY SIGNAL → reset

When the standard entry condition passes, the gate is consumed and the direction returns to IDLE.

Stages are evaluated in order

If Stage 2 becomes true before Stage 1, it does nothing. If Stage 1 and Stage 2 are both true on candle 100, candle 100 completes Stage 1 and Stage 2 is first evaluated on candle 101. One stage advances per settled base-timeframe evaluation.

Play the monitoring chain

The final stage may coincide with the standard entry, but stages cannot collapse onto one candle.

Stage 1
Stage 2
Stage 3
Entry
Candle 100 · Stage 1 passes → waiting for Stage 2

Conditions inside a stage

A stage can contain one condition or a nested condition tree. RSI14 < 30 AND Close < Lower Bollinger Band requires both checks; RSI14 < 30 OR Stochastic K < 20 lets either check complete the stage. The whole tree resolves to one result: stage_passed = true or false.

Keep active

Internally: lock_until_next_stage. Once the stage passes, its achievement is remembered while later stages are evaluated.

  • Oversold event
  • Volatility spike
  • Touch of support

Reset if false

Internally: reset_if_condition_false. While the chain is progressing, the condition must remain valid; if it turns false, the entire direction resets to Stage 1.

  • Market remains above EMA200
  • Volatility stays below a limit
  • Trend regime remains bullish

Subtle but important: a later reset-if-false stage becomes active as soon as the prior stage passes. If it is false on its first evaluation candle, the chain resets instead of waiting indefinitely.

Expiry limits the wait

expiry_candles = N counts base-timeframe candles after the preceding stage completes. If Stage 1 completes at A and Stage 2 allows 3 candles, Stage 2 may pass at A+1, A+2, or A+3; at A+4 it expires before evaluation. expiry_minutes uses candle timestamps: with activation at 10:00 and a 30-minute window, timestamps before 10:30 may pass, while 10:30 or later expire first. Configure minutes OR candles, not both. Expiry matters for Stage 2 and later; while idle, Stage 1 has no preceding activation point and can wait.

With no expiry, an armed chain can remain active indefinitely until a successful gated entry, reset-if-false behavior, a manual reset, a strategy-version change, bot stop/reset handling, or a data-integrity safeguard clears it. That can be useful, but it can also make an old setup authorize a much later entry.

Candle A

Stage 1 completes.

A + 1

Stage 2 waits.

A + 3

Last inclusive candle window.

A + 4

Expiry resets before evaluation.

After the final stage completes

The gate latches as COMPLETED. Monitoring stages are no longer re-evaluated, reset-if-false is no longer checked, and pre-completion expiry no longer applies. If the standard entry is false, the gate remains armed across later candles until a valid entry consumes it or a reset/version/data-integrity event clears it.

Entry can happen on the final-stage candle. The standard entry is evaluated on the candle, the chain advances, and if both the standard entry and final stage are true, the combined gate can signal on that candle.

LONG and SHORT are independent

Each direction has separate enable switches, stages, indexes, expiry windows, reset state, and completed gate. A LONG reset does not reset SHORT. A Wave rule inside a LONG stage stays scoped to that LONG chain.

Live-candle protections

In live TS1 evaluation, duplicate or out-of-order settled candles should be ignored. If settled base candles were missed, a direction with an active candle-expiry window resets fail-closed; without an active candle window, it may preserve its chain. Backtests use ordered candles and count expiry by index. The execution plane remains authoritative over displayed status.

Layered logic

3. Combined example: Wave inside Sequential Monitoring

Imagine a LONG strategy with a normal entry condition of Close[X] > EMA20[X]. Its monitoring chain remembers an oversold event, confirms price against a historical EMA level using Wave, and then waits for positive momentum.

Stage 2 is a Wave conditionClose[X] > EMA50[X − 5] × 1.02 OR Close[X] > EMA50[X − 10] × 1.02
One possible timeline
CandleImportant valuesState transition
100RSI = 27Stage 1 completes
101Both Wave offsets failWait for Stage 2
102Offset 5 fails; offset 10 passesStage 2 completes
103MACD histogram = −0.2Stage 3 resets the chain
110RSI = 28Stage 1 completes again
111Wave offset 5 passesStage 2 completes
112MACD histogram = 0.15Gate armed; current EMA20 entry still false
113Close rises above current EMA20LONG entry signal
The division of responsibility

Stage 1 remembers the oversold event. Stage 2 uses Wave to compare current price with historical EMA levels. Stage 3 confirms momentum. The normal entry condition decides the final timing. Risk controls, cooldowns, sizing, exchange feasibility, and order handling can still prevent an actual order.

Builder guidance

Which feature should you use?

  • Use Wave when the question is: “How does the current value compare with this indicator or price several candles ago?”
  • Use Sequential Monitoring when the question is: “Did these events occur in the required order, even if they were not simultaneously true?”
  • Use both when event A must happen, then a historical comparison must confirm it, then event C must happen before the normal entry rule may fire.
  • Choose Keep active for one-time events that may disappear. Choose Reset if false for conditions that must remain continuously valid.
  • Add expiry when an old setup should not remain relevant forever. Remember that a completed gate remains latched until consumed or reset.
  • Keep a real standard entry condition for every monitored direction. Monitoring establishes eligibility; it does not decide the trade on its own.
Educational disclaimer

This guide explains deterministic strategy behavior for educational purposes. It is not financial, investment, legal, tax, or trading advice. Backtests and rule systems do not guarantee live results; risk, slippage, fees, exchange conditions, and execution failures still matter.

Frequently asked questions

Can Wave make a trade happen by itself?
No. Wave only changes one comparison. A standard entry condition and any required monitoring gate still have to pass.
Do multiple Wave offsets need to pass in order?
No. Offsets are alternatives on the same evaluation candle and use OR semantics. One usable offset passing is enough.
Does a monitoring stage need to stay true after it passes?
Only when that stage uses Reset if false. Keep active remembers the stage’s achievement while the chain waits for the next checkpoint.
Can the final monitoring stage and entry happen on the same candle?
Yes. Stages still advance one per evaluation cycle, but the final stage and the currently true standard entry condition may coincide.
What is the difference between candle and minute expiry?
Candle expiry counts settled base-timeframe evaluation steps and is inclusive at the last allowed candle. Minute expiry compares timestamps and expires when the timestamp is equal to or later than the boundary.
Where is the behavior defined?
The Wave contract is in backend/app/contracts/wave_contract.py and the evaluator is in services/backtest-engine/packages/strategy/wave.go. Monitoring validation and entry application are in services/backtest-engine/packages/execution/validation.go and packages/backtest/worker.go, with parity pinned in the shared monitoring fixture.