Primitives

sessionRegime

Session Regime

sessionRegime (all)

Session Regime

Input parameters

PropTypeDefaultDescription
idstring-Optional unique identifier for the regime instance, useful when multiple are used
resistancenumber-Static resistance override (ignored when swing resistance is enabled)
useSwingResistanceboolean-Use streaming swing resistance instead of static resistance
swingLookbacknumber1000Optional lookback for swing resistance (default 1000, 0 = full session)
useRecentNetboolean-Use recentNet only for direction (faster flips)
weakThresholdnumber-Lower bound for trend strength before considering a regime
strongThresholdnumber-Upper bound for trend strength to label as TREND
confidenceSmoothingnumber-EMA smoothing factor for confidence (0..1)
srcstring-Streaming input source for regime detection (close, ema, rma, sma, wma, vwma, swma, alma, dema, tema, lsma, zlema, hma, kama)
srcLennumber-Length used by src adapters like ema, sma, and dema
emaPeriodnumber-Legacy alias for src="ema" with srcLen
intervalnumber-Minimum time between regime updates in milliseconds (0 = every tick)
intervalResnumber-Minimum time between resistance updates in milliseconds (0 = every tick)
historyRetentionSecondsnumber-How long to retain regime direction history for dirRes aggregation
plotboolean-Whether to plot the regime on the chart
useArrowbooleanfalsePlot only directional flip arrows instead of a continuous regime line
arrowSizestringmdArrow marker size when useArrow is enabled (sm, md, lg)
arrowLongColorstring-Long arrow color override when useArrow is enabled
arrowShortColorstring-Short arrow color override when useArrow is enabled
plotNamestring-Name of the plot series
plotPaddingnumber-Padding to subtract from price for plotting, positive above bar, negative below bar
plotWidthnumber-Width of the plot line
plotRecentWindowMsnumber-How long non-memory plot points stay raw before compaction in milliseconds
plotHistoryIntervalMsnumber-Bucket size for compacted non-memory plot history in milliseconds
accelerationbooleanfalseTrack regime-local bucket acceleration and reset it on regime switches

SQL example

IF sessionRegime id="net" useSwingResistance=true interval=1000 intervalRes=5000 historyRetentionSeconds=21600 useRecentNet=true
        -- score filter
        TICK dirResScore WITH id="net" interval=20 > 0.25 THEN order SET action="buy", transmit=true
        TICK dirResScore WITH id="net" interval=20 < -0.25 THEN order SET action="sell", transmit=true
        -- dominant bias vs recent bias alignment
        TICK dirResDir WITH id="net" interval=20 = "buy" AND dirResRecent WITH id="net" interval=20 = "buy" THEN order SET action="buy", transmit=true
        TICK dirResDir WITH id="net" interval=20 = "sell" AND dirResRecent WITH id="net" interval=20 = "sell" THEN order SET action="sell", transmit=true
        POS posSide != dirResDir WITH id="net" interval=20 THEN FINAL close

On this page