From our research notebook

Turning SMC and Price Action into Deterministic Code

We describe how we translated chart-reading ideas into repeatable rules for swings, breaks, zones and the timing of confirmation.

In our price-action development work, a marked chart was often a useful starting point. It was not yet a complete rule. A person can ignore a minor swing or prefer a cleaner zone without saying why; we needed to make those choices explicit.

We began with how a swing becomes known

We asked which candles confirm a swing, how equal highs or lows are handled and when a candidate becomes final. If confirmation needs later candles, the system cannot use that confirmed swing at an earlier time. This was an important part of keeping the coded interpretation faithful to the information available.

We gave each break and zone a lifecycle

A wick through a level and a close beyond it are different events. We defined what BOS or CHoCH meant for the chosen method, then considered how a zone was created, touched, ranked, expired or invalidated. Those rules let us revisit why a particular label appeared.

We compared interpretation before discussing performance

We use chart marks together with event records to inspect normal signals and awkward cases such as equal levels, missing bars and changing higher-timeframe context. First we want to know whether the same observations produce the same interpretation. That gives subsequent strategy research a stable starting point.

Explore the technical detailOpen the full method, worked examples and implementation questions. We have kept this material here so you can follow the reasoning as far as you need.

SMC and price action are usually taught on charts. A trader can ignore a minor swing, favour a cleaner zone, or reinterpret structure after new candles arrive. Code cannot use that silent discretion. It needs one repeatable answer for the same historical state.

Twenty-two projects in our public-safe archive fall primarily into price action and market structure. Their recurring challenge was definition: how a swing is confirmed, which break matters, how zones are created and invalidated, and how higher-timeframe context reaches the entry timeframe without using future information.

Engineering note · ENG-05

From chart language to a decision

Each layer answers one question and passes a finished state to the next layer.

  1. 01
    StructureDefine confirmed swings and the hierarchy of external and internal structure.
  2. 02
    EventState the exact close or price condition that qualifies as BOS or CHoCH.
  3. 03
    ZoneCreate, rank, age, and invalidate supply or demand areas consistently.
  4. 04
    PermissionCombine context, trigger, risk, session, spread, and position limits once.

Define structure

The first task is to define a swing without choosing the attractive points afterwards. A rule may use a fixed number of neighbouring candles, confirmed pivots, displacement, or another explicit condition. It also needs a policy for equal highs and lows, nested structure, and the moment a candidate swing becomes final.

Name the event

A wick beyond a level, a candle close beyond it, and a close with minimum displacement are different events. BOS and CHoCH must therefore be operational definitions rather than chart labels. The system should record the broken level, source timeframe, confirmation candle, direction, and the state that existed immediately before the event.

Control timeframes

Higher-timeframe context should be read from a defined current or closed bar and mapped to the lower-timeframe decision without leakage. The EA also needs to decide how long that context remains valid, what invalidates it, and whether a lower-timeframe setup may survive a higher-timeframe update.

Validate interpretation

Testing should compare logs and marked charts, not only profit. A useful review samples normal trades, missed trades, blocked trades, restarts, equal levels, rapidly changing structure, and incomplete history. The goal is to prove that the coded interpretation is stable before judging whether the trading idea is useful.

  • Use exact candle and swing definitions.
  • Separate candidate structure from confirmed structure.
  • Record the source time of every higher-timeframe state.
  • Define zone expiry and invalidation before entry.
  • Compare decision logs with chart evidence on unseen data.

Questions you may have

Can SMC be automated without indicators?

Yes, if every candle, swing, break, zone, timing, and reset rule is explicitly defined. Automation does not require a visual indicator.

Why can two SMC tools mark different structures?

They may use different swing confirmation, break, hierarchy, or invalidation rules. The label alone does not define the algorithm.

Make market-structure labels reproducible

Scroll the diagram horizontally or open it at full size.

Make market-structure labels reproducible
Educational design example — values and states are not live performance.

Synthetic candles; the same input is shown twice. Level and close rule are explicit.

Open full diagram ↗

Make market-structure labels reproducible

This constructed sequence uses numbered completed candles. A swing high needs two lower highs on each side, so candle 3 cannot be confirmed as a swing until candle 5 closes. Definition A calls a break when a candle closes beyond the confirmed swing. Definition B also requires the close to exceed it by 0.10 and the candle body to exceed 0.60.

One price sequence, two valid definitions
Candle High / low / close Known after close Definition A Definition B
1 100.0 / 98.8 / 99.6 No swing Wait Wait
2 101.0 / 99.2 / 100.5 No swing Wait Wait
3 102.0 / 100.0 / 101.6 Possible high Wait Wait
4 101.5 / 99.8 / 100.4 Right side 1 Wait Wait
5 101.2 / 99.5 / 100.8 C3 swing high confirmed Level 102.0 Level 102.0
6 102.3 / 100.6 / 102.05 Close above swing BOS valid Rejected: tolerance/body
7 103.1 / 101.0 / 102.8 Strong close Already broken BOS valid

A bullish state can move from neutral to BOS only after the selected break rule passes. A CHoCH requires the prior state to be bearish and a break of its named opposing swing; the label cannot be inferred from the same price without the prior state. A demand zone created from the last bearish candle before a valid bullish break is ‘fresh’, becomes ‘touched’ on first return and is invalid when a completed close passes its far boundary. Creation, touch and invalidation all store candle IDs and confirmation times.

Both definitions are deterministic and can disagree on candle 6. Software certainty means the chosen rule is repeated faithfully; it does not establish that either interpretation of SMC predicts returns better.

What to verify

  • Freeze the numbered candles and ask two reviewers and the program to label swings, breaks and zones.
  • Include equal highs, wick-only breaks, nested structure and a zone invalidated before entry.
  • Record the prior market state and confirmation time with every BOS or CHoCH event.

Limits of this example

This example defines one implementable vocabulary. Other definitions are possible, but mixing them after seeing outcomes destroys a fair comparison.

Editorial ownership and primary references

Reviewed by POLARIS Research

Evidence scope

This is an educational design and validation analysis. It explains testable failure modes; it is not evidence that a strategy will be profitable.

Primary references

These references support platform behaviour or research concepts. They do not validate POLARIS performance and do not guarantee future results.

Explore the next relevant layer

Move between focused research, system engineering and portfolio construction without losing the context of this page.

Contact POLARIS on WhatsApp