OPEN-SOURCE SCRIPT
Session Auction State Engine (SASE)

Summary in one paragraph
Session Auction State Engine (SASE) is a session context indicator for liquid futures, FX, equities, and crypto on intraday to daily timeframes. It classifies the current session into one of four auction regimes, Balanced, Early trend, Trend continuation, or Failed auction, so you act only when multiple acceptance and expansion conditions align. It is original because it outputs a single interpretable auction state, not buy and sell signals, by combining time acceptance, range expansion, and return to value logic into a compact dashboard. Add it to a clean chart, read the table for Action and permissions, and use the optional markers and bands for quick visual context. Shapes can move while the bar is open and settle on close, for conservative workflows use alerts on bar close.
Scope and intent
• Markets. Major index futures, major FX pairs, large cap equities, liquid crypto
• Timeframes. 1 minute to daily
• Default demo used in the publication. ES1! on 5 minute
• Purpose. Prevent premature directional decisions by forcing regime confirmation before direction is considered actionable
• Limits. Indicator only. No backtest, no execution, no performance claims
Originality and usefulness
This is not a mashup of common indicators. It is a session auction classifier with an explicit decision hierarchy.
• Unique concept or fusion. A regime engine that gates trading by session auction state using Initial Balance, value acceptance, expansion, and return to value confirmation
• What failure mode it addresses. False starts in chop, early breakouts that never gain acceptance, and trend chasing inside balanced sessions
• Testability. Inputs expose each component and the table shows the state, direction, and pass or fail checklist so users can verify why a state appears and tune thresholds
• Portable yardstick. Expansion is normalized by an expected range unit (ATR based), so thresholds scale across symbols with different point values
Method overview in plain language
SASE runs inside a user defined session window. It builds an Initial Balance (IB), then evaluates whether the market is accepting prices outside value and outside IB, whether the session is expanding beyond IB, and whether price returns to value after a failed excursion.
Base measures
• Range basis. Value width is ATR of the chart timeframe over the Width ATR length, multiplied by Width ATR multiplier
• Normalization basis. Expected range is ATR, either daily or intraday based on Expected range mode, used to normalize session extension
Components
• Initial Balance (IB). High and low during the first IB minutes of the session. IB defines the first acceptance boundary
• Value anchor. A session anchored VWAP or TWAP (or auto) used as a value center
• Value width. ATR based band around value used to measure inside value and outside value
• Acceptance. Two acceptance channels are tracked, closes outside value in the breakout direction and closes outside IB in the breakout direction. An EMA plus a short streak score turns this into an acceptance strength metric
• Extension. Maximum distance beyond IB, normalized by expected range, measures range expansion
• Balance. An EMA of time spent inside the value band measures how rotational versus directional the session is
• Failed auction. Requires a real excursion outside value first, then a sustained return inside value, plus an acceptance collapse and a rebalance increase, optionally requiring price to be back inside IB
Fusion rule
SASE outputs exactly one state per bar inside the session.
• Balanced. No confirmed breakout from IB, or conditions indicate rotational trade, high balance, low acceptance, low extension
• Early trend. Breakout exists, but trend continuation checklist is not complete yet
• Trend continuation. All trend gates pass at once: enough time since breakout, acceptance above threshold, extension above threshold, and balance below threshold
• Failed auction. After an excursion outside value, price returns and holds inside value while acceptance collapses and balance rises, optionally requiring price back inside IB
Signal rule
This script does not issue trade signals. It outputs context.
• Direction is shown only when state is not Balanced
• The dashboard shows a Trend checklist (T, A, E). Trend continuation requires T pass, A pass, and E pass
• Early trend indicates direction may be forming but confirmation is incomplete
• Failed auction indicates the prior directional attempt was rejected and mean reversion conditions are stronger
What you will see on the chart
• Optional markers. Key markers appear on state transitions, typically when Trend continuation or Failed auction begins, depending on the Markers setting
• Optional reference levels. IB high and IB low lines, and value center plus value bands
• Optional background and bar color. Off by default for chart cleanliness
• Compact dashboard. A table showing state, direction, Action, permissions, IB progress, checklist, and component gauges
Table fields and quick reading guide
• State badge. Current auction state
• Direction. Up or Down when state is not Balanced, otherwise None
• Action. Plain language instruction for the current state
• Use. Two permissions, Trend and MeanRev, shown as ON or OFF
• IB. Progress and status, Wait until Complete
• Trend. Ready percent plus checklist T, A, E
• Accept. Acceptance strength and whether it meets the trend threshold
• Extend. Extension strength and whether it meets the trend threshold
• Balance. Balance score and whether it is low enough for trend continuation
• Fail. Excursion and return to value progress when relevant
Reading tip. Trend continuation is only intended when T, A, and E are all passing. If Balanced, do not force direction.
Inputs with guidance
Setup
• Session. Defines when the engine is active. Verify timezone and hours when changing symbol or venue
• Session timezone. Exchange or a named timezone
• Show last session snapshot when closed. When enabled, the table displays the last in session state after the session ends
Logic
• IB minutes. Typical 30 to 90. Higher reduces noise but delays classification
• Value anchor. Auto is recommended. VWAP requires reliable volume, TWAP is volume agnostic
• Value reference. Freeze at IB reduces value drift and makes acceptance and failed auction logic more stable
• Width ATR length. Typical 14 to 30. Higher smooths value width
• Width ATR multiplier. Typical 0.5 to 1.2. Higher widens value and increases Balanced time
• Breakout buffer as width fraction. Typical 0.1 to 0.4. Higher requires cleaner breakouts
• Acceptance EMA length. Typical 20 to 60. Higher reduces flicker
• Acceptance streak bars. Typical 4 to 10. Higher requires sustained acceptance
• Early trend acceptance threshold. Typical 0.25 to 0.45
• Trend continuation acceptance threshold. Typical 0.45 to 0.70
• Balance EMA length. Typical 30 to 80
• Trend continuation max balance. Typical 0.30 to 0.55. Lower makes trend continuation stricter
• Balanced min balance. Typical 0.55 to 0.80
• Trend continuation min bars since breakout. Typical 10 to 30
• Extension thresholds. Early 0.10 to 0.25, Trend 0.20 to 0.50, in expected range units
• Failed auction window bars. Typical 15 to 40. Larger windows require more sustained rejection
• Failed auction thresholds. Acceptance max 0.10 to 0.30, Balance min 0.55 to 0.80
• State change confirm bars. Typical 1 to 4
• Return to Balanced confirm bars. Typical 4 to 12
• Minimum bars to keep non Balanced state. Typical 6 to 20, increases stability
UI
• Theme. Dark or Light
• Dashboard position. Corner selection
• Markers. Off, Key only, or All changes
• Background tint and bar color. Off by default to keep charts readable
• Show IB lines and Show value bands. Off by default, enable for learning or debugging
Usage recipes
Intraday trend focus
• IB minutes 60
• Value reference Freeze at IB
• Breakout buffer 0.25
• Trend confirm bars 18
• Accept trend threshold 0.55
• Extend trend threshold 0.30
• Trend max balance 0.40
Goal. Trade only when Trend continuation is active and checklist is fully passing
Intraday mean reversion focus
• IB minutes 30 to 60
• Value reference Freeze at IB
• Wider value width, raise Width ATR multiplier to 0.9 to 1.2
• Raise Balanced min balance to 0.70
• Keep Markers on Key only
Goal. Focus on Balanced and Failed auction states, avoid early trend and trend continuation trades
Swing continuation
• Use 60 minute or 240 minute chart
• Expected range mode Daily ATR
• Trend confirm bars 12 to 30 depending on timeframe
• Raise Width ATR length to 30
Goal. Use Trend continuation as a higher level regime gate, then use your own entry timing tool inside that regime
Realism and responsible publication
• No performance claims. Past results never guarantee future outcomes
• Intrabar motion reminder. Shapes and table values can update while a bar forms and settle on close
• Session windows use the chart exchange time unless you override timezone. Verify hours when changing symbol or venue
Honest limitations and failure modes
• News releases and liquidity gaps can break normal auction behavior and can trigger rapid state transitions
• Symbols with unreliable volume may work better using TWAP or Auto rather than VWAP only
• Very quiet regimes can reduce contrast between Balanced and Early trend, consider longer windows or higher thresholds
• Non standard chart types can distort session and IB calculations, use standard candles for evaluation
Open source reuse and credits
None
Legal
Education and research only. Not investment advice. You are responsible for your decisions. Test on historical data and in simulation before any live use. Use realistic costs in any external testing workflow.
Session Auction State Engine (SASE) is a session context indicator for liquid futures, FX, equities, and crypto on intraday to daily timeframes. It classifies the current session into one of four auction regimes, Balanced, Early trend, Trend continuation, or Failed auction, so you act only when multiple acceptance and expansion conditions align. It is original because it outputs a single interpretable auction state, not buy and sell signals, by combining time acceptance, range expansion, and return to value logic into a compact dashboard. Add it to a clean chart, read the table for Action and permissions, and use the optional markers and bands for quick visual context. Shapes can move while the bar is open and settle on close, for conservative workflows use alerts on bar close.
Scope and intent
• Markets. Major index futures, major FX pairs, large cap equities, liquid crypto
• Timeframes. 1 minute to daily
• Default demo used in the publication. ES1! on 5 minute
• Purpose. Prevent premature directional decisions by forcing regime confirmation before direction is considered actionable
• Limits. Indicator only. No backtest, no execution, no performance claims
Originality and usefulness
This is not a mashup of common indicators. It is a session auction classifier with an explicit decision hierarchy.
• Unique concept or fusion. A regime engine that gates trading by session auction state using Initial Balance, value acceptance, expansion, and return to value confirmation
• What failure mode it addresses. False starts in chop, early breakouts that never gain acceptance, and trend chasing inside balanced sessions
• Testability. Inputs expose each component and the table shows the state, direction, and pass or fail checklist so users can verify why a state appears and tune thresholds
• Portable yardstick. Expansion is normalized by an expected range unit (ATR based), so thresholds scale across symbols with different point values
Method overview in plain language
SASE runs inside a user defined session window. It builds an Initial Balance (IB), then evaluates whether the market is accepting prices outside value and outside IB, whether the session is expanding beyond IB, and whether price returns to value after a failed excursion.
Base measures
• Range basis. Value width is ATR of the chart timeframe over the Width ATR length, multiplied by Width ATR multiplier
• Normalization basis. Expected range is ATR, either daily or intraday based on Expected range mode, used to normalize session extension
Components
• Initial Balance (IB). High and low during the first IB minutes of the session. IB defines the first acceptance boundary
• Value anchor. A session anchored VWAP or TWAP (or auto) used as a value center
• Value width. ATR based band around value used to measure inside value and outside value
• Acceptance. Two acceptance channels are tracked, closes outside value in the breakout direction and closes outside IB in the breakout direction. An EMA plus a short streak score turns this into an acceptance strength metric
• Extension. Maximum distance beyond IB, normalized by expected range, measures range expansion
• Balance. An EMA of time spent inside the value band measures how rotational versus directional the session is
• Failed auction. Requires a real excursion outside value first, then a sustained return inside value, plus an acceptance collapse and a rebalance increase, optionally requiring price to be back inside IB
Fusion rule
SASE outputs exactly one state per bar inside the session.
• Balanced. No confirmed breakout from IB, or conditions indicate rotational trade, high balance, low acceptance, low extension
• Early trend. Breakout exists, but trend continuation checklist is not complete yet
• Trend continuation. All trend gates pass at once: enough time since breakout, acceptance above threshold, extension above threshold, and balance below threshold
• Failed auction. After an excursion outside value, price returns and holds inside value while acceptance collapses and balance rises, optionally requiring price back inside IB
Signal rule
This script does not issue trade signals. It outputs context.
• Direction is shown only when state is not Balanced
• The dashboard shows a Trend checklist (T, A, E). Trend continuation requires T pass, A pass, and E pass
• Early trend indicates direction may be forming but confirmation is incomplete
• Failed auction indicates the prior directional attempt was rejected and mean reversion conditions are stronger
What you will see on the chart
• Optional markers. Key markers appear on state transitions, typically when Trend continuation or Failed auction begins, depending on the Markers setting
• Optional reference levels. IB high and IB low lines, and value center plus value bands
• Optional background and bar color. Off by default for chart cleanliness
• Compact dashboard. A table showing state, direction, Action, permissions, IB progress, checklist, and component gauges
Table fields and quick reading guide
• State badge. Current auction state
• Direction. Up or Down when state is not Balanced, otherwise None
• Action. Plain language instruction for the current state
• Use. Two permissions, Trend and MeanRev, shown as ON or OFF
• IB. Progress and status, Wait until Complete
• Trend. Ready percent plus checklist T, A, E
• Accept. Acceptance strength and whether it meets the trend threshold
• Extend. Extension strength and whether it meets the trend threshold
• Balance. Balance score and whether it is low enough for trend continuation
• Fail. Excursion and return to value progress when relevant
Reading tip. Trend continuation is only intended when T, A, and E are all passing. If Balanced, do not force direction.
Inputs with guidance
Setup
• Session. Defines when the engine is active. Verify timezone and hours when changing symbol or venue
• Session timezone. Exchange or a named timezone
• Show last session snapshot when closed. When enabled, the table displays the last in session state after the session ends
Logic
• IB minutes. Typical 30 to 90. Higher reduces noise but delays classification
• Value anchor. Auto is recommended. VWAP requires reliable volume, TWAP is volume agnostic
• Value reference. Freeze at IB reduces value drift and makes acceptance and failed auction logic more stable
• Width ATR length. Typical 14 to 30. Higher smooths value width
• Width ATR multiplier. Typical 0.5 to 1.2. Higher widens value and increases Balanced time
• Breakout buffer as width fraction. Typical 0.1 to 0.4. Higher requires cleaner breakouts
• Acceptance EMA length. Typical 20 to 60. Higher reduces flicker
• Acceptance streak bars. Typical 4 to 10. Higher requires sustained acceptance
• Early trend acceptance threshold. Typical 0.25 to 0.45
• Trend continuation acceptance threshold. Typical 0.45 to 0.70
• Balance EMA length. Typical 30 to 80
• Trend continuation max balance. Typical 0.30 to 0.55. Lower makes trend continuation stricter
• Balanced min balance. Typical 0.55 to 0.80
• Trend continuation min bars since breakout. Typical 10 to 30
• Extension thresholds. Early 0.10 to 0.25, Trend 0.20 to 0.50, in expected range units
• Failed auction window bars. Typical 15 to 40. Larger windows require more sustained rejection
• Failed auction thresholds. Acceptance max 0.10 to 0.30, Balance min 0.55 to 0.80
• State change confirm bars. Typical 1 to 4
• Return to Balanced confirm bars. Typical 4 to 12
• Minimum bars to keep non Balanced state. Typical 6 to 20, increases stability
UI
• Theme. Dark or Light
• Dashboard position. Corner selection
• Markers. Off, Key only, or All changes
• Background tint and bar color. Off by default to keep charts readable
• Show IB lines and Show value bands. Off by default, enable for learning or debugging
Usage recipes
Intraday trend focus
• IB minutes 60
• Value reference Freeze at IB
• Breakout buffer 0.25
• Trend confirm bars 18
• Accept trend threshold 0.55
• Extend trend threshold 0.30
• Trend max balance 0.40
Goal. Trade only when Trend continuation is active and checklist is fully passing
Intraday mean reversion focus
• IB minutes 30 to 60
• Value reference Freeze at IB
• Wider value width, raise Width ATR multiplier to 0.9 to 1.2
• Raise Balanced min balance to 0.70
• Keep Markers on Key only
Goal. Focus on Balanced and Failed auction states, avoid early trend and trend continuation trades
Swing continuation
• Use 60 minute or 240 minute chart
• Expected range mode Daily ATR
• Trend confirm bars 12 to 30 depending on timeframe
• Raise Width ATR length to 30
Goal. Use Trend continuation as a higher level regime gate, then use your own entry timing tool inside that regime
Realism and responsible publication
• No performance claims. Past results never guarantee future outcomes
• Intrabar motion reminder. Shapes and table values can update while a bar forms and settle on close
• Session windows use the chart exchange time unless you override timezone. Verify hours when changing symbol or venue
Honest limitations and failure modes
• News releases and liquidity gaps can break normal auction behavior and can trigger rapid state transitions
• Symbols with unreliable volume may work better using TWAP or Auto rather than VWAP only
• Very quiet regimes can reduce contrast between Balanced and Early trend, consider longer windows or higher thresholds
• Non standard chart types can distort session and IB calculations, use standard candles for evaluation
Open source reuse and credits
None
Legal
Education and research only. Not investment advice. You are responsible for your decisions. Test on historical data and in simulation before any live use. Use realistic costs in any external testing workflow.
Mã nguồn mở
Theo đúng tinh thần TradingView, tác giả của tập lệnh này đã công bố nó dưới dạng mã nguồn mở, để các nhà giao dịch có thể xem xét và xác minh chức năng. Chúc mừng tác giả! Mặc dù bạn có thể sử dụng miễn phí, hãy nhớ rằng việc công bố lại mã phải tuân theo Nội quy.
🔻Website: finaur.com/
🔻Strategies: finaur.com/lab/
🔻Blog: finaur.com/blog/
🔻Telegram : t.me/finaur_com/
🔻Trader Psychology Profile – thelumenism.com/
🔻Strategies: finaur.com/lab/
🔻Blog: finaur.com/blog/
🔻Telegram : t.me/finaur_com/
🔻Trader Psychology Profile – thelumenism.com/
Thông báo miễn trừ trách nhiệm
Thông tin và các ấn phẩm này không nhằm mục đích, và không cấu thành, lời khuyên hoặc khuyến nghị về tài chính, đầu tư, giao dịch hay các loại khác do TradingView cung cấp hoặc xác nhận. Đọc thêm tại Điều khoản Sử dụng.
Mã nguồn mở
Theo đúng tinh thần TradingView, tác giả của tập lệnh này đã công bố nó dưới dạng mã nguồn mở, để các nhà giao dịch có thể xem xét và xác minh chức năng. Chúc mừng tác giả! Mặc dù bạn có thể sử dụng miễn phí, hãy nhớ rằng việc công bố lại mã phải tuân theo Nội quy.
🔻Website: finaur.com/
🔻Strategies: finaur.com/lab/
🔻Blog: finaur.com/blog/
🔻Telegram : t.me/finaur_com/
🔻Trader Psychology Profile – thelumenism.com/
🔻Strategies: finaur.com/lab/
🔻Blog: finaur.com/blog/
🔻Telegram : t.me/finaur_com/
🔻Trader Psychology Profile – thelumenism.com/
Thông báo miễn trừ trách nhiệm
Thông tin và các ấn phẩm này không nhằm mục đích, và không cấu thành, lời khuyên hoặc khuyến nghị về tài chính, đầu tư, giao dịch hay các loại khác do TradingView cung cấp hoặc xác nhận. Đọc thêm tại Điều khoản Sử dụng.