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.
From chart language to a decision
Each layer answers one question and passes a finished state to the next layer.
- 01StructureDefine confirmed swings and the hierarchy of external and internal structure.
- 02EventState the exact close or price condition that qualifies as BOS or CHoCH.
- 03ZoneCreate, rank, age, and invalidate supply or demand areas consistently.
- 04PermissionCombine 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.