@pgnio/helios-mcp 0.0.0-stage → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +44 -2
- package/dist/chunk-NWGWXYTS.mjs +2964 -0
- package/dist/cli.d.mts +1 -0
- package/dist/cli.d.ts +1 -0
- package/dist/cli.js +2946 -0
- package/dist/cli.mjs +24 -0
- package/dist/index.d.mts +2137 -0
- package/dist/index.d.ts +2137 -0
- package/dist/index.js +3021 -0
- package/dist/index.mjs +52 -0
- package/docs/ai-agent-indicators/00_index.txt +210 -0
- package/docs/ai-agent-indicators/activity_ratio.txt +166 -0
- package/docs/ai-agent-indicators/activity_zscore.txt +166 -0
- package/docs/ai-agent-indicators/bayesian_overbought.txt +134 -0
- package/docs/ai-agent-indicators/directional_efficiency.txt +134 -0
- package/docs/ai-agent-indicators/hfi.txt +172 -0
- package/docs/ai-agent-indicators/hfi_weights.txt +124 -0
- package/docs/ai-agent-indicators/hmi.txt +305 -0
- package/docs/ai-agent-indicators/hmi_velocity.txt +155 -0
- package/docs/ai-agent-indicators/hurst_exponent.txt +136 -0
- package/docs/ai-agent-indicators/macd_divergence.txt +133 -0
- package/docs/ai-agent-indicators/macd_histogram.txt +145 -0
- package/docs/ai-agent-indicators/macd_signal.txt +119 -0
- package/docs/ai-agent-indicators/market_structure.txt +201 -0
- package/docs/ai-agent-indicators/poc.txt +131 -0
- package/docs/ai-agent-indicators/poc_distance.txt +129 -0
- package/docs/ai-agent-indicators/regime.txt +225 -0
- package/docs/ai-agent-indicators/rsi_divergence.txt +145 -0
- package/docs/ai-agent-indicators/squeeze_duration.txt +115 -0
- package/docs/ai-agent-indicators/squeeze_energy.txt +128 -0
- package/docs/ai-agent-indicators/support_resistance.txt +169 -0
- package/docs/ai-agent-indicators/tf_alignment.txt +165 -0
- package/docs/ai-agent-indicators/trend_interpretation.txt +98 -0
- package/docs/ai-agent-indicators/trend_strength.txt +134 -0
- package/docs/ai-agent-indicators/value_area_position.txt +142 -0
- package/docs/ai-agent-indicators/volatility_clustering.txt +160 -0
- package/docs/ai-agent-indicators/volatility_squeeze.txt +169 -0
- package/docs/ai-agent-indicators/volume_change_point.txt +151 -0
- package/docs/ai-agent-indicators/vwap.txt +133 -0
- package/docs/ai-agent-indicators/vwap_zscore.txt +154 -0
- package/docs/ai-agent-indicators/weighted_rsi.txt +148 -0
- package/docs/ai-agent-mcp/00_index.txt +110 -0
- package/docs/ai-agent-mcp/01_auth/00_overview.txt +51 -0
- package/docs/ai-agent-mcp/01_auth/01_tools.txt +94 -0
- package/docs/ai-agent-mcp/01_auth/02_data_contracts.txt +38 -0
- package/docs/ai-agent-mcp/01_auth/03_decision_rules.txt +25 -0
- package/docs/ai-agent-mcp/01_auth/04_failures_and_recovery.txt +46 -0
- package/docs/ai-agent-mcp/02_account/00_overview.txt +29 -0
- package/docs/ai-agent-mcp/02_account/01_tools.txt +67 -0
- package/docs/ai-agent-mcp/02_account/02_data_contracts.txt +34 -0
- package/docs/ai-agent-mcp/02_account/03_decision_rules.txt +17 -0
- package/docs/ai-agent-mcp/02_account/04_failures_and_recovery.txt +17 -0
- package/docs/ai-agent-mcp/03_market/00_overview.txt +27 -0
- package/docs/ai-agent-mcp/03_market/01_tools.txt +102 -0
- package/docs/ai-agent-mcp/03_market/02_data_contracts.txt +39 -0
- package/docs/ai-agent-mcp/03_market/03_decision_rules.txt +22 -0
- package/docs/ai-agent-mcp/03_market/04_failures_and_recovery.txt +18 -0
- package/docs/ai-agent-mcp/04_trading/00_overview.txt +25 -0
- package/docs/ai-agent-mcp/04_trading/01_tools.txt +123 -0
- package/docs/ai-agent-mcp/04_trading/02_data_contracts.txt +42 -0
- package/docs/ai-agent-mcp/04_trading/03_decision_rules.txt +30 -0
- package/docs/ai-agent-mcp/04_trading/04_failures_and_recovery.txt +25 -0
- package/docs/ai-agent-mcp/05_ledger/00_overview.txt +31 -0
- package/docs/ai-agent-mcp/05_ledger/01_tools.txt +80 -0
- package/docs/ai-agent-mcp/05_ledger/02_data_contracts.txt +46 -0
- package/docs/ai-agent-mcp/05_ledger/03_decision_rules.txt +44 -0
- package/docs/ai-agent-mcp/05_ledger/04_failures_and_recovery.txt +24 -0
- package/package.json +66 -3
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
================================================================================
|
|
2
|
+
INDICATOR: POC — POINT OF CONTROL (VOLUME PROFILE)
|
|
3
|
+
================================================================================
|
|
4
|
+
id: poc
|
|
5
|
+
data_field: indicators.poc
|
|
6
|
+
type: PRICE LEVEL (same units as current price)
|
|
7
|
+
range: Positive real number; located within recent price range
|
|
8
|
+
precision: Asset tick size
|
|
9
|
+
update_rate: per_tick (updates with each new 1m candle)
|
|
10
|
+
latency_profile: SLOW (computed from rolling candle history)
|
|
11
|
+
|
|
12
|
+
--------------------------------------------------------------------------------
|
|
13
|
+
CONSTRUCT
|
|
14
|
+
--------------------------------------------------------------------------------
|
|
15
|
+
POC (Point of Control) is the price level with the highest trading volume
|
|
16
|
+
over the observation window.
|
|
17
|
+
|
|
18
|
+
Computation:
|
|
19
|
+
1. Determine price range: rangeLow to rangeHigh over all available candles.
|
|
20
|
+
2. Divide price range into 50 equal-width buckets.
|
|
21
|
+
3. For each candle: distribute its volume to buckets proportionally by
|
|
22
|
+
overlap between the candle's [low, high] range and each bucket.
|
|
23
|
+
4. POC = midpoint of the bucket with the highest accumulated volume.
|
|
24
|
+
|
|
25
|
+
Also computed from the same volume bucket pass:
|
|
26
|
+
Value Area: the 70% volume zone centered on/around POC (greedy expansion)
|
|
27
|
+
→ indicators.value_area_high = upper edge of Value Area
|
|
28
|
+
→ indicators.value_area_low = lower edge of Value Area
|
|
29
|
+
(See value_area_position.txt for Value Area documentation.)
|
|
30
|
+
|
|
31
|
+
POC represents the "fairest price" by volume — the level where the market
|
|
32
|
+
has spent the most transactional effort over the observed history. It acts
|
|
33
|
+
as a powerful gravitational magnet attracting price back to it from extremes,
|
|
34
|
+
and also as a pivot level that, once broken with confidence, becomes a barrier.
|
|
35
|
+
|
|
36
|
+
--------------------------------------------------------------------------------
|
|
37
|
+
INTERPRETATION: POC AS A PRICE LEVEL
|
|
38
|
+
--------------------------------------------------------------------------------
|
|
39
|
+
price ≈ POC (within 1% or one standard deviation)
|
|
40
|
+
Price is near the high-volume node. This is the price level where the
|
|
41
|
+
most historical trading occurred. Strong balance and institutional anchoring.
|
|
42
|
+
Expect responsive price behavior — continuation breaks from POC require
|
|
43
|
+
volume conviction; fades often occur from POC during range-bound conditions.
|
|
44
|
+
|
|
45
|
+
price > POC
|
|
46
|
+
Price is trading above the highest-activity zone. Buyers who accumulated
|
|
47
|
+
near POC are in profit. POC acts as potential support if price returns.
|
|
48
|
+
|
|
49
|
+
price < POC
|
|
50
|
+
Price is below the highest-activity zone. Sellers who distributed near POC
|
|
51
|
+
are in profit. POC may act as resistance if price returns from below.
|
|
52
|
+
|
|
53
|
+
Price far from POC (see poc_distance):
|
|
54
|
+
The further price is from POC, the more likely POC will exert gravitational
|
|
55
|
+
pull. However, breaking far from POC with sustained momentum suggests
|
|
56
|
+
new price discovery and potential creation of a new POC at the new level.
|
|
57
|
+
|
|
58
|
+
--------------------------------------------------------------------------------
|
|
59
|
+
RELATED FIELDS
|
|
60
|
+
--------------------------------------------------------------------------------
|
|
61
|
+
indicators.poc_distance
|
|
62
|
+
The % distance from current price to POC. See poc_distance.txt.
|
|
63
|
+
Positive = price above POC. Negative = price below POC.
|
|
64
|
+
|
|
65
|
+
indicators.value_area_high
|
|
66
|
+
indicators.value_area_low
|
|
67
|
+
Upper and lower edges of the Value Area (70% volume zone).
|
|
68
|
+
See value_area_position.txt.
|
|
69
|
+
|
|
70
|
+
indicators.value_area_position
|
|
71
|
+
Categorical: "ABOVE VA" | "IN VA" | "BELOW VA"
|
|
72
|
+
|
|
73
|
+
--------------------------------------------------------------------------------
|
|
74
|
+
INDICATOR RELATIONSHIPS
|
|
75
|
+
--------------------------------------------------------------------------------
|
|
76
|
+
indicators.poc_distance | REQUIRED_COMPANION
|
|
77
|
+
poc (price level) must be read with poc_distance (deviation %) to be
|
|
78
|
+
actionable. poc_distance normalizes the raw price-to-POC gap into
|
|
79
|
+
percentage terms for cross-asset comparison.
|
|
80
|
+
|
|
81
|
+
indicators.vwap | CONTEXT
|
|
82
|
+
VWAP = time-volume weighted average. POC = highest-volume node.
|
|
83
|
+
These often coincide in balanced markets. When they diverge:
|
|
84
|
+
- POC > VWAP: more recent volume at higher prices (even if time-avg is lower)
|
|
85
|
+
- POC < VWAP: older/higher volume transactions below current VWAP
|
|
86
|
+
|
|
87
|
+
IF price between POC and VWAP: price is in a zone of intense historical
|
|
88
|
+
volume AND near cost basis. Strongest structural support/resistance zone.
|
|
89
|
+
|
|
90
|
+
indicators.support / indicators.resistance | AMPLIFIES
|
|
91
|
+
Support or resistance levels that coincide with POC are the highest-
|
|
92
|
+
probability levels in the entire indicator set. Two independent methods
|
|
93
|
+
(volume distribution + price pivot analysis) identifying the same level
|
|
94
|
+
amplifies the significance substantially.
|
|
95
|
+
|
|
96
|
+
indicators.vwap_zscore | CONTEXT
|
|
97
|
+
IF poc_distance > 3% AND vwap_zscore > 2.0
|
|
98
|
+
→ Price well above both POC and VWAP. Extended from two separate
|
|
99
|
+
volume-anchored references simultaneously. Magnitude of extension
|
|
100
|
+
is more significant when both agree.
|
|
101
|
+
|
|
102
|
+
--------------------------------------------------------------------------------
|
|
103
|
+
DEPENDENCY ORDER
|
|
104
|
+
--------------------------------------------------------------------------------
|
|
105
|
+
1 Read poc (price level); note price vs poc direction.
|
|
106
|
+
2 Read poc_distance for normalized deviation.
|
|
107
|
+
3 Read value_area_position for coarser zone context.
|
|
108
|
+
4 Compare poc to active support/resistance levels.
|
|
109
|
+
5 Compare poc to vwap level.
|
|
110
|
+
|
|
111
|
+
--------------------------------------------------------------------------------
|
|
112
|
+
INVALIDATION CONDITIONS
|
|
113
|
+
--------------------------------------------------------------------------------
|
|
114
|
+
IF no candle history available: POC cannot be computed.
|
|
115
|
+
|
|
116
|
+
IF recent extreme price move has expanded range significantly
|
|
117
|
+
→ The 50-bucket grid will have re-bucketed. POC may shift suddenly.
|
|
118
|
+
Monitor poc_distance for discontinuities that indicate range recompute.
|
|
119
|
+
|
|
120
|
+
--------------------------------------------------------------------------------
|
|
121
|
+
ANTI-PATTERNS — DETECTABLE MISUSE CONDITIONS
|
|
122
|
+
--------------------------------------------------------------------------------
|
|
123
|
+
IF poc is treated as support on its own without volume confirmation
|
|
124
|
+
→ INCOMPLETE. POC indicates high volume at a level; it does not
|
|
125
|
+
guarantee the level will hold. Check the Bayesian strength
|
|
126
|
+
from the support/resistance indicator for hold probability.
|
|
127
|
+
|
|
128
|
+
IF POC is used to predict short-term price targets
|
|
129
|
+
→ POC is a gravitational anchor, not a directional predictor.
|
|
130
|
+
Price can trade far from POC for extended periods during breakout
|
|
131
|
+
regimes. POC-based mean-reversion logic should be gated by regime.
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
================================================================================
|
|
2
|
+
INDICATOR: POC_DISTANCE — DISTANCE FROM POINT OF CONTROL
|
|
3
|
+
================================================================================
|
|
4
|
+
id: poc_distance
|
|
5
|
+
data_field: indicators.poc_distance
|
|
6
|
+
type: NUMERIC (percentage)
|
|
7
|
+
range: Unbounded; positive = above POC, negative = below
|
|
8
|
+
precision: 2 decimal places
|
|
9
|
+
update_rate: per_tick
|
|
10
|
+
latency_profile: SLOW (inherits POC computation)
|
|
11
|
+
|
|
12
|
+
--------------------------------------------------------------------------------
|
|
13
|
+
CONSTRUCT
|
|
14
|
+
--------------------------------------------------------------------------------
|
|
15
|
+
poc_distance measures the percentage distance of the current price from the
|
|
16
|
+
Point of Control (the highest-volume price level over the observation window).
|
|
17
|
+
|
|
18
|
+
Formula:
|
|
19
|
+
poc_distance = ((currentPrice - poc) / poc) × 100
|
|
20
|
+
|
|
21
|
+
Positive: price is trading ABOVE the POC.
|
|
22
|
+
Negative: price is trading BELOW the POC.
|
|
23
|
+
Zero: price is exactly at the POC.
|
|
24
|
+
|
|
25
|
+
This normalizes the raw price-to-POC gap into percentage terms, enabling
|
|
26
|
+
comparison across assets with different price levels.
|
|
27
|
+
|
|
28
|
+
--------------------------------------------------------------------------------
|
|
29
|
+
RANGE INTERPRETATION
|
|
30
|
+
--------------------------------------------------------------------------------
|
|
31
|
+
value > 5.0
|
|
32
|
+
Price is more than 5% above the highest-activity historical level.
|
|
33
|
+
Far above the volume equilibrium zone. Upside price discovery in progress.
|
|
34
|
+
The asset is trading in a thin volume area above its most-traded level.
|
|
35
|
+
|
|
36
|
+
value > 2.0 AND value <= 5.0
|
|
37
|
+
Price is moderately extended above POC. Above the main value zone.
|
|
38
|
+
Volume support exists below at POC level but price has moved away.
|
|
39
|
+
|
|
40
|
+
value > 0.5 AND value <= 2.0
|
|
41
|
+
Price is near POC on the upside. Minimal extension. Trading within
|
|
42
|
+
normal distance from the high-volume anchor.
|
|
43
|
+
|
|
44
|
+
value >= -0.5 AND value <= 0.5
|
|
45
|
+
Price is essentially AT the POC. Highest historical volume zone.
|
|
46
|
+
Strong two-way order flow expected. Price is in the "fairest value" zone.
|
|
47
|
+
|
|
48
|
+
value >= -2.0 AND value < -0.5
|
|
49
|
+
Price is near POC on the downside. Minimal extension below.
|
|
50
|
+
|
|
51
|
+
value >= -5.0 AND value < -2.0
|
|
52
|
+
Price is moderately extended below POC.
|
|
53
|
+
|
|
54
|
+
value < -5.0
|
|
55
|
+
Price is more than 5% below the highest-activity level. Far below volume
|
|
56
|
+
equilibrium. Downside price discovery in progress.
|
|
57
|
+
|
|
58
|
+
--------------------------------------------------------------------------------
|
|
59
|
+
POC MEAN-REVERSION THESIS
|
|
60
|
+
--------------------------------------------------------------------------------
|
|
61
|
+
# The key use of poc_distance is assessing mean-reversion probability toward POC.
|
|
62
|
+
# This thesis only applies when regime does NOT support continuation.
|
|
63
|
+
|
|
64
|
+
Conditions that support POC mean-reversion:
|
|
65
|
+
|poc_distance| > 3.0 (price far from equilibrium)
|
|
66
|
+
AND regime IN [CHOP, CONSOL, RANGING, EXHAUST_UP, EXHAUST_DN]
|
|
67
|
+
AND trend_interpretation IN [WEAK, RANGING_CHOPPY]
|
|
68
|
+
AND |vwap_zscore| > 1.5 (also extended from VWAP)
|
|
69
|
+
|
|
70
|
+
Conditions that reduce POC mean-reversion probability:
|
|
71
|
+
regime IN [CASCADE, BREAKOUT, PARABOLIC] (trend is sustaining extension)
|
|
72
|
+
AND activity_ratio >= 1.5 (high-volume breakout)
|
|
73
|
+
→ Extended poc_distance in these conditions is a breakout signal,
|
|
74
|
+
not a mean-reversion signal. POC is being left behind.
|
|
75
|
+
|
|
76
|
+
--------------------------------------------------------------------------------
|
|
77
|
+
INDICATOR RELATIONSHIPS
|
|
78
|
+
--------------------------------------------------------------------------------
|
|
79
|
+
indicators.poc | REQUIRED_COMPANION
|
|
80
|
+
poc_distance is meaningless without knowing the absolute poc price level.
|
|
81
|
+
Always read poc (level) and poc_distance (deviation) together.
|
|
82
|
+
|
|
83
|
+
indicators.value_area_position | CONTEXT
|
|
84
|
+
IF value_area_position = "IN VA" AND |poc_distance| < 1.5
|
|
85
|
+
→ Price is both within the 70% value area AND near the POC specifically.
|
|
86
|
+
Maximum historical volume anchor engagement.
|
|
87
|
+
|
|
88
|
+
IF value_area_position = "ABOVE VA" AND poc_distance > 3.0
|
|
89
|
+
→ Price is outside the value area AND far from POC. Double extension.
|
|
90
|
+
|
|
91
|
+
indicators.vwap_zscore | AMPLIFIES
|
|
92
|
+
IF poc_distance > 3.0 AND vwap_zscore > 2.0
|
|
93
|
+
→ Price extended above both POC and VWAP simultaneously. Strongest
|
|
94
|
+
compound mean-reversion precondition.
|
|
95
|
+
|
|
96
|
+
indicators.regime | GATE
|
|
97
|
+
Gate ALL POC mean-reversion logic on regime. In trending (CASCADE/BREAKOUT)
|
|
98
|
+
regimes, large poc_distance is EXPECTED and self-reinforcing.
|
|
99
|
+
|
|
100
|
+
--------------------------------------------------------------------------------
|
|
101
|
+
DEPENDENCY ORDER
|
|
102
|
+
--------------------------------------------------------------------------------
|
|
103
|
+
1 Read poc_distance (percentage deviation).
|
|
104
|
+
2 Sign: positive = above POC, negative = below.
|
|
105
|
+
3 Regime gate: in trending regimes (CASCADE/BREAKOUT), large poc_distance
|
|
106
|
+
is continuation context, not mean-reversion signal.
|
|
107
|
+
4 Cross-reference with value_area_position and vwap_zscore.
|
|
108
|
+
|
|
109
|
+
--------------------------------------------------------------------------------
|
|
110
|
+
INVALIDATION CONDITIONS
|
|
111
|
+
--------------------------------------------------------------------------------
|
|
112
|
+
IF poc is unavailable: poc_distance is unavailable. Discard.
|
|
113
|
+
|
|
114
|
+
IF |poc_distance| changes by > 2% in a single tick
|
|
115
|
+
→ May indicate POC level recomputed due to price range expansion.
|
|
116
|
+
Treat as potentially stale until next stable reading.
|
|
117
|
+
|
|
118
|
+
--------------------------------------------------------------------------------
|
|
119
|
+
ANTI-PATTERNS — DETECTABLE MISUSE CONDITIONS
|
|
120
|
+
--------------------------------------------------------------------------------
|
|
121
|
+
IF poc_distance > 3.0 is used as a short signal in a trending market
|
|
122
|
+
→ INCORRECT. In BREAKOUT/CASCADE/PARABOLIC: large poc_distance is
|
|
123
|
+
confirmation of the move, not reversal signal. The POC may follow
|
|
124
|
+
price higher as new volume accumulates at higher levels.
|
|
125
|
+
|
|
126
|
+
IF poc_distance is compared without considering sign direction
|
|
127
|
+
→ poc_distance can be +3 or -3. For assessing "how far from POC"
|
|
128
|
+
without directional context, use |poc_distance|. For directional
|
|
129
|
+
assessment (above vs below), use the signed value.
|
|
@@ -0,0 +1,225 @@
|
|
|
1
|
+
================================================================================
|
|
2
|
+
INDICATOR: REGIME — MARKET REGIME CLASSIFIER
|
|
3
|
+
================================================================================
|
|
4
|
+
id: regime
|
|
5
|
+
data_field: indicators.regime
|
|
6
|
+
type: CATEGORICAL
|
|
7
|
+
values: CASCADE_UP, CASCADE_DOWN, PARABOLIC, CRASH, BREAKOUT,
|
|
8
|
+
BREAKDOWN, REVERSAL, ROLLOVER, TREND_UP, TREND_DN,
|
|
9
|
+
GRIND_UP, BLEED, SPIKE_UP, SPIKE_DN, EXHAUST_UP,
|
|
10
|
+
EXHAUST_DN, CHOP, CONSOL, RANGING
|
|
11
|
+
update_rate: per_tick (with 15-second dwell anti-flap protection)
|
|
12
|
+
latency_profile: COINCIDENT
|
|
13
|
+
|
|
14
|
+
--------------------------------------------------------------------------------
|
|
15
|
+
CONSTRUCT
|
|
16
|
+
--------------------------------------------------------------------------------
|
|
17
|
+
Regime classifies the current overall market state from 12 timeframe change
|
|
18
|
+
values. It is computed using a multi-condition scoring system: every eligible
|
|
19
|
+
regime receives a score, and the regime with the highest score wins. A 15-second
|
|
20
|
+
dwell timer prevents rapid flapping between regimes on ambiguous ticks.
|
|
21
|
+
|
|
22
|
+
Inputs used:
|
|
23
|
+
- Raw % change across all 12 timeframes (1m through 24h)
|
|
24
|
+
- Timeframe clusters: micro [1m,3m,5m], short [15m,30m,1h],
|
|
25
|
+
medium [2h,4h,6h], macro [8h,12h,24h]
|
|
26
|
+
- Derived: microAvg, shortAvg, mediumAvg, macroAvg
|
|
27
|
+
- Derived: totalStrength (avg absolute change across all 12 TFs)
|
|
28
|
+
- Derived: positiveTFs, negativeTFs (counts of TFs in each direction)
|
|
29
|
+
- Derived: avgAccel (weighted acceleration across clusters)
|
|
30
|
+
- Derived: activity_ratio, volc_confidence (for REVERSAL/ROLLOVER gate)
|
|
31
|
+
|
|
32
|
+
Key computed thresholds:
|
|
33
|
+
veryStrong = totalStrength > 3
|
|
34
|
+
strong = totalStrength > 2
|
|
35
|
+
moderate = totalStrength > 1
|
|
36
|
+
fullAlignment = all 12 TFs agree on direction
|
|
37
|
+
strongAlignment = 10+ TFs agree on direction
|
|
38
|
+
moderateAlignment = 8+ TFs agree on direction
|
|
39
|
+
strongAcceleration = avgAccel > 0.5
|
|
40
|
+
strongDeceleration = avgAccel < -0.5
|
|
41
|
+
cascade (upward) = microAvg > shortAvg > mediumAvg > 0
|
|
42
|
+
(momentum STARTING from micro and propagating outward)
|
|
43
|
+
|
|
44
|
+
--------------------------------------------------------------------------------
|
|
45
|
+
REGIME DEFINITIONS — EXACT CONDITIONS
|
|
46
|
+
--------------------------------------------------------------------------------
|
|
47
|
+
# Listed in descending score priority order.
|
|
48
|
+
# Each is fully self-contained.
|
|
49
|
+
|
|
50
|
+
CASCADE_UP (base score ~95+)
|
|
51
|
+
All 12 TFs aligned upward (fullAlignment or strongAlignment).
|
|
52
|
+
Momentum is largest at micro (1m-5m) and decreasing toward macro —
|
|
53
|
+
the move is starting from the shortest timeframes and propagating outward.
|
|
54
|
+
Total strength is veryStrong. Acceleration is strongly positive.
|
|
55
|
+
This is the highest-conviction upside regime. The move is self-sustaining
|
|
56
|
+
and expanding across the timeframe stack.
|
|
57
|
+
|
|
58
|
+
CASCADE_DOWN (base score ~95+)
|
|
59
|
+
Mirror of CASCADE_UP with all clusters negative.
|
|
60
|
+
microAvg is most negative, becoming less negative toward macroAvg.
|
|
61
|
+
Momentum is starting from shortest TFs and cascading outward in the
|
|
62
|
+
downside direction.
|
|
63
|
+
|
|
64
|
+
PARABOLIC (base score ~90+)
|
|
65
|
+
All 12 TFs aligned upward (fullAlignment required).
|
|
66
|
+
Every cluster is contributing with high magnitude.
|
|
67
|
+
Strong acceleration present.
|
|
68
|
+
Does NOT require cascade structure — differs from CASCADE_UP in that
|
|
69
|
+
ALL timeframes are extreme simultaneously, not sequentially propagating.
|
|
70
|
+
|
|
71
|
+
CRASH (base score ~90+)
|
|
72
|
+
Mirror of PARABOLIC. All TFs extreme negative simultaneously.
|
|
73
|
+
|
|
74
|
+
BREAKOUT (base score ~85+)
|
|
75
|
+
10+ TFs aligned upward (strongAlignment). TotalStrength is veryStrong.
|
|
76
|
+
Strong acceleration present.
|
|
77
|
+
The breakout is confirmed across short and medium TFs but may not have
|
|
78
|
+
fully reached macro TFs yet. An additional +5 score if aligned TF count >= 10.
|
|
79
|
+
|
|
80
|
+
BREAKDOWN (base score ~85+)
|
|
81
|
+
Mirror of BREAKOUT. 10+ TFs aligned downward with strong acceleration.
|
|
82
|
+
|
|
83
|
+
REVERSAL (base score ~72+, PARTICIPATION GATED)
|
|
84
|
+
Gate requirements — ALL must be true:
|
|
85
|
+
activity_ratio >= 1.0 (volume must be above normal)
|
|
86
|
+
volc_confidence >= 1.05 (volume clustering must be active)
|
|
87
|
+
Core conditions:
|
|
88
|
+
macroAvg <= -1.25 (macro TFs still significantly negative)
|
|
89
|
+
microAvg >= 0.9 (short TFs strongly positive and reversing)
|
|
90
|
+
2+ micro TFs positive
|
|
91
|
+
microAvg > shortAvg (micro recovery leading short TFs)
|
|
92
|
+
This regime identifies a genuine directional shift from down to up,
|
|
93
|
+
distinguished from a SPIKE_UP by requiring volume participation and
|
|
94
|
+
structural macro alignment against which micro is recovering.
|
|
95
|
+
|
|
96
|
+
ROLLOVER (base score ~72+, PARTICIPATION GATED)
|
|
97
|
+
Mirror of REVERSAL. macroAvg positive, micro turning strongly negative.
|
|
98
|
+
Same gate requirements (activity + volc).
|
|
99
|
+
|
|
100
|
+
TREND_UP (base score ~65+)
|
|
101
|
+
8+ TFs aligned upward (moderateAlignment). TotalStrength is strong.
|
|
102
|
+
Less extreme than BREAKOUT — not all TFs agree and/or acceleration
|
|
103
|
+
is not exceptional. Established upward trend with broad but not full
|
|
104
|
+
consensus.
|
|
105
|
+
|
|
106
|
+
TREND_DN (base score ~65+)
|
|
107
|
+
Mirror of TREND_UP. 8+ TFs negative, strong aggregate.
|
|
108
|
+
|
|
109
|
+
SPIKE_UP (base score ~60+)
|
|
110
|
+
Micro TFs (1m-5m) are strongly positive (|microAvg| > 3).
|
|
111
|
+
Macro TFs are near zero (|macroAvg| < 1).
|
|
112
|
+
Short-TF move with NO macro confirmation. The move is isolated to
|
|
113
|
+
shortest timeframes only. Continuation probability is low unless
|
|
114
|
+
BREAKOUT or TREND regimes follow.
|
|
115
|
+
|
|
116
|
+
SPIKE_DN (base score ~60+)
|
|
117
|
+
Mirror of SPIKE_UP. Micro strongly negative, macro flat.
|
|
118
|
+
|
|
119
|
+
GRIND_UP (base score ~55+)
|
|
120
|
+
Moderate aggregate (totalStrength > 1) but NOT moderateAlignment.
|
|
121
|
+
No strong acceleration or deceleration.
|
|
122
|
+
Low-conviction upward drift. TFs partially agree on direction but
|
|
123
|
+
without the breadth or magnitude of TREND_UP.
|
|
124
|
+
|
|
125
|
+
BLEED (base score ~55+)
|
|
126
|
+
Mirror of GRIND_UP. Moderate downside drift without strong alignment.
|
|
127
|
+
|
|
128
|
+
EXHAUST_UP (base score ~45-50+)
|
|
129
|
+
Either: strong aggregate (totalStrength > 2) WITH strong deceleration
|
|
130
|
+
(avgAccel < -0.5).
|
|
131
|
+
Or: |macroAvg| > 2 AND momentumDecay < 0.3 (micro has given up < 30%
|
|
132
|
+
of macro momentum — macro is strong but micro is nearly exhausted).
|
|
133
|
+
This regime indicates macro TFs are still bullish but micro TFs are
|
|
134
|
+
weakening. The trend infrastructure is intact but the short-TF engine
|
|
135
|
+
has stalled. Probability of continued upside is reduced.
|
|
136
|
+
|
|
137
|
+
EXHAUST_DN (base score ~45-50+)
|
|
138
|
+
Mirror of EXHAUST_UP. Macro still bearish, micro recovering or stalling.
|
|
139
|
+
|
|
140
|
+
CHOP (base score 30)
|
|
141
|
+
No moderateAlignment, no cascade, no strongAlignment.
|
|
142
|
+
Timeframes are actively disagreeing. No dominant direction. This is
|
|
143
|
+
the worst regime for directional inference — do not use HMI, hmi_velocity,
|
|
144
|
+
or any momentum-derived indicators when regime = CHOP.
|
|
145
|
+
|
|
146
|
+
CONSOL (base score 25)
|
|
147
|
+
All timeframes have near-zero changes.
|
|
148
|
+
totalStrength < 0.5 AND |avgAccel| < 0.2.
|
|
149
|
+
Price is consolidating / compressing. Momentum-based indicators carry
|
|
150
|
+
no information in this state. Volatility squeeze indicators are most
|
|
151
|
+
relevant here.
|
|
152
|
+
|
|
153
|
+
RANGING (base score 20+, fallback)
|
|
154
|
+
Always computed as a fallback option. Wins only if no other regime scores
|
|
155
|
+
higher. Low-activity, low-conviction state with minimal participation.
|
|
156
|
+
|
|
157
|
+
--------------------------------------------------------------------------------
|
|
158
|
+
INDICATOR RELATIONSHIPS
|
|
159
|
+
--------------------------------------------------------------------------------
|
|
160
|
+
indicators.hmi | CROSS_VALIDATE
|
|
161
|
+
Regime and HMI are computed from the same underlying TF data but via
|
|
162
|
+
different methods. When they agree, both signals are higher confidence.
|
|
163
|
+
When they conflict, reduce weight on both.
|
|
164
|
+
See hmi.txt INDICATOR RELATIONSHIPS section for full conflict rules.
|
|
165
|
+
|
|
166
|
+
indicators.hmi_velocity | CONTEXT
|
|
167
|
+
EXHAUST_UP / EXHAUST_DN regimes should be confirmed by negative/positive
|
|
168
|
+
hmi_velocity respectively. If regime shows exhaustion but hmi_velocity
|
|
169
|
+
disagrees, treat both as lower confidence.
|
|
170
|
+
|
|
171
|
+
indicators.activity_ratio | PREREQUISITE FOR REVERSAL/ROLLOVER
|
|
172
|
+
REVERSAL and ROLLOVER regimes require activity_ratio >= 1.0.
|
|
173
|
+
If activity_ratio is below this threshold, REVERSAL/ROLLOVER cannot
|
|
174
|
+
be active by construction. If data shows otherwise, treat as stale data.
|
|
175
|
+
|
|
176
|
+
indicators.volatility_squeeze.value | CONTEXT FOR CONSOL
|
|
177
|
+
CONSOL regime co-occurring with low volatility_squeeze.value (< 0.5)
|
|
178
|
+
indicates maximum compression. Treat as highest-priority squeeze setup.
|
|
179
|
+
|
|
180
|
+
indicators.tf_alignment | AMPLIFIES
|
|
181
|
+
CASCADE and BREAKOUT regimes imply high tf_alignment by construction.
|
|
182
|
+
If data shows CASCADE_UP with tf_alignment < 70, check for data freshness.
|
|
183
|
+
|
|
184
|
+
--------------------------------------------------------------------------------
|
|
185
|
+
DEPENDENCY ORDER
|
|
186
|
+
--------------------------------------------------------------------------------
|
|
187
|
+
1 Read regime value.
|
|
188
|
+
2 IF CHOP, CONSOL, or RANGING: momentum-derived indicators are invalid in this state.
|
|
189
|
+
EXHAUST_UP/EXHAUST_DN: flag as peak warning; confirm with hmi_velocity.
|
|
190
|
+
3 Cross-validate with HMI direction; apply conflict rules from INDICATOR RELATIONSHIPS.
|
|
191
|
+
4 Apply regime to amplify or discount other indicator readings.
|
|
192
|
+
|
|
193
|
+
--------------------------------------------------------------------------------
|
|
194
|
+
INVALIDATION CONDITIONS
|
|
195
|
+
--------------------------------------------------------------------------------
|
|
196
|
+
Regime itself is not invalidated by other indicators — it is an INPUT
|
|
197
|
+
that invalidates others. See each indicator file for regime-based gates.
|
|
198
|
+
|
|
199
|
+
# The one internal limitation:
|
|
200
|
+
IF tick data is stale (updatedAt timestamp > 30 seconds old)
|
|
201
|
+
→ The 15-second dwell timer means the displayed regime may be 1-2
|
|
202
|
+
transitions behind current market state. Treat as lower confidence.
|
|
203
|
+
|
|
204
|
+
--------------------------------------------------------------------------------
|
|
205
|
+
ANTI-PATTERNS — DETECTABLE MISUSE CONDITIONS
|
|
206
|
+
--------------------------------------------------------------------------------
|
|
207
|
+
IF EXHAUST_UP is being used as a short entry signal
|
|
208
|
+
→ INCOMPLETE USE. EXHAUST_UP means macro is still bullish and micro
|
|
209
|
+
is weakening. It is an early warning, not a confirmed reversal.
|
|
210
|
+
Wait for ROLLOVER or BREAKDOWN regime to confirm the turn.
|
|
211
|
+
|
|
212
|
+
IF SPIKE_UP is being treated equivalently to BREAKOUT
|
|
213
|
+
→ INCORRECT USE. SPIKE_UP explicitly means macro TFs are NOT
|
|
214
|
+
confirming the move. It is an unconfirmed short-TF impulse.
|
|
215
|
+
Macro TFs (8h-24h) must be monitored for follow-through.
|
|
216
|
+
|
|
217
|
+
IF REVERSAL regime is used without checking activity_ratio
|
|
218
|
+
→ DATA INTEGRITY CHECK REQUIRED. REVERSAL requires activity_ratio >= 1.0
|
|
219
|
+
by construction. If you see REVERSAL with low activity, the data feed
|
|
220
|
+
may be supplying stale activity values.
|
|
221
|
+
|
|
222
|
+
IF CHOP regime is active AND any momentum indicator is being used for direction
|
|
223
|
+
→ INVALIDATION NOT APPLIED. Under CHOP: HMI, hmi_velocity, MACD,
|
|
224
|
+
Weighted RSI, TF Alignment — all should be discarded. Their values
|
|
225
|
+
reflect TF noise, not directional state.
|
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
================================================================================
|
|
2
|
+
INDICATOR: RSI_DIVERGENCE — OBOS RSI DIVERGENCE
|
|
3
|
+
================================================================================
|
|
4
|
+
id: rsi_divergence
|
|
5
|
+
data_field: indicators.rsi_divergence
|
|
6
|
+
type: CATEGORICAL
|
|
7
|
+
values: BULLISH_DIVERGENCE | BEARISH_DIVERGENCE | NONE
|
|
8
|
+
update_rate: per_tick
|
|
9
|
+
latency_profile: LAGGING (computed over 20-bar slope window)
|
|
10
|
+
|
|
11
|
+
--------------------------------------------------------------------------------
|
|
12
|
+
CONSTRUCT
|
|
13
|
+
--------------------------------------------------------------------------------
|
|
14
|
+
IMPORTANT: rsi_divergence is NOT a standalone computed indicator. It is
|
|
15
|
+
produced by the detectDivergence() function embedded within the weighted RSI
|
|
16
|
+
(OBOS) system. It is emitted alongside indicators.weighted_rsi.
|
|
17
|
+
|
|
18
|
+
Computation:
|
|
19
|
+
lookback window: 20 bars
|
|
20
|
+
|
|
21
|
+
Price slope proxy (multi-TF weighted):
|
|
22
|
+
priceSlope = change1m × 0.5 + change3m × 0.3 + change5m × 0.2
|
|
23
|
+
(normalized 0-1 range before slope comparison)
|
|
24
|
+
|
|
25
|
+
OBOS slope:
|
|
26
|
+
slope of indicators.weighted_rsi values over the same 20-bar window
|
|
27
|
+
|
|
28
|
+
Slope threshold: 0.15 (normalized)
|
|
29
|
+
|
|
30
|
+
BULLISH_DIVERGENCE:
|
|
31
|
+
priceSlope < -0.15 (price trending downward)
|
|
32
|
+
AND
|
|
33
|
+
obsSlope > 0.15 (weighted_rsi trending upward)
|
|
34
|
+
→ Price is making lower lows but RSI is making higher lows.
|
|
35
|
+
Downside momentum is weakening relative to price.
|
|
36
|
+
|
|
37
|
+
BEARISH_DIVERGENCE:
|
|
38
|
+
priceSlope > 0.15 (price trending upward)
|
|
39
|
+
AND
|
|
40
|
+
obsSlope < -0.15 (weighted_rsi trending downward)
|
|
41
|
+
→ Price is making higher highs but RSI is making lower highs.
|
|
42
|
+
Upside momentum is weakening relative to price.
|
|
43
|
+
|
|
44
|
+
NONE: neither condition met.
|
|
45
|
+
|
|
46
|
+
--------------------------------------------------------------------------------
|
|
47
|
+
STATE DEFINITIONS
|
|
48
|
+
--------------------------------------------------------------------------------
|
|
49
|
+
BULLISH_DIVERGENCE
|
|
50
|
+
Over the last 20 bars, price has moved downward while weighted_rsi has
|
|
51
|
+
moved upward. This means the downside price movement is not accompanied
|
|
52
|
+
by strong selling momentum — RSI is improving despite lower prices.
|
|
53
|
+
Associated with potential momentum exhaustion in a downtrend or with
|
|
54
|
+
price nearing a local bottom that RSI has already turned from.
|
|
55
|
+
|
|
56
|
+
BEARISH_DIVERGENCE
|
|
57
|
+
Over the last 20 bars, price has moved upward while weighted_rsi has moved
|
|
58
|
+
downward. Upside price movement is not accompanied by building momentum.
|
|
59
|
+
RSI is deteriorating despite higher prices. Associated with potential
|
|
60
|
+
momentum exhaustion in an uptrend.
|
|
61
|
+
|
|
62
|
+
NONE
|
|
63
|
+
No meaningful divergence slope condition. Either slopes agree, or one
|
|
64
|
+
or both are below the 0.15 threshold (insufficient trend in either).
|
|
65
|
+
|
|
66
|
+
--------------------------------------------------------------------------------
|
|
67
|
+
IMPORTANT CONSTRAINT
|
|
68
|
+
--------------------------------------------------------------------------------
|
|
69
|
+
# Divergence is only informative when weighted_rsi is near extremes.
|
|
70
|
+
# Divergence detected when weighted_rsi is between 40 and 60 is meaningless.
|
|
71
|
+
# Threshold filter:
|
|
72
|
+
|
|
73
|
+
IF rsi_divergence = BULLISH_DIVERGENCE AND weighted_rsi > 40
|
|
74
|
+
→ Divergence detected in neutral RSI territory. Not meaningful.
|
|
75
|
+
RSI was not oversold when the divergence formed.
|
|
76
|
+
|
|
77
|
+
IF rsi_divergence = BEARISH_DIVERGENCE AND weighted_rsi < 60
|
|
78
|
+
→ Divergence detected in neutral RSI territory. Not meaningful.
|
|
79
|
+
|
|
80
|
+
VALID BULLISH DIVERGENCE: rsi_divergence = BULLISH AND weighted_rsi <= 35
|
|
81
|
+
VALID BEARISH DIVERGENCE: rsi_divergence = BEARISH AND weighted_rsi >= 65
|
|
82
|
+
|
|
83
|
+
--------------------------------------------------------------------------------
|
|
84
|
+
INDICATOR RELATIONSHIPS
|
|
85
|
+
--------------------------------------------------------------------------------
|
|
86
|
+
indicators.weighted_rsi | REQUIRED_COMPANION
|
|
87
|
+
rsi_divergence has no meaning without the current weighted_rsi level.
|
|
88
|
+
Apply the extreme-zone filter above before treating any divergence as valid.
|
|
89
|
+
|
|
90
|
+
indicators.bayesian_overbought | AMPLIFIES
|
|
91
|
+
IF rsi_divergence = BEARISH AND bayesian_overbought > 0.85
|
|
92
|
+
→ RSI diverging bearish AND current RSI is historically extreme.
|
|
93
|
+
Both conditions strengthen the momentum-fade reading.
|
|
94
|
+
IF rsi_divergence = BULLISH AND bayesian_overbought < 0.15
|
|
95
|
+
→ RSI diverging bullish AND current RSI is historically bottomed.
|
|
96
|
+
Both conditions strengthen the momentum-recovery reading.
|
|
97
|
+
|
|
98
|
+
indicators.macd_divergence | CROSS_VALIDATE
|
|
99
|
+
macd_divergence is computed independently from MACD histogram peaks.
|
|
100
|
+
IF rsi_divergence and macd_divergence agree on the same direction
|
|
101
|
+
→ Higher confidence divergence signal, two independent methods
|
|
102
|
+
both detecting momentum-price separation.
|
|
103
|
+
|
|
104
|
+
indicators.hmi_velocity | CONTEXT
|
|
105
|
+
IF rsi_divergence = BEARISH AND hmi_velocity < -2.0
|
|
106
|
+
→ Momentum fade confirmed by both RSI path and raw HMI deceleration.
|
|
107
|
+
|
|
108
|
+
--------------------------------------------------------------------------------
|
|
109
|
+
DEPENDENCY ORDER
|
|
110
|
+
--------------------------------------------------------------------------------
|
|
111
|
+
1 Read weighted_rsi value first.
|
|
112
|
+
2 Apply extreme-zone filter: BULLISH valid only if weighted_rsi <= 35;
|
|
113
|
+
BEARISH valid only if weighted_rsi >= 65. Discard otherwise.
|
|
114
|
+
3 Read rsi_divergence state.
|
|
115
|
+
4 Cross-validate with bayesian_overbought and macd_divergence.
|
|
116
|
+
|
|
117
|
+
--------------------------------------------------------------------------------
|
|
118
|
+
INVALIDATION CONDITIONS
|
|
119
|
+
--------------------------------------------------------------------------------
|
|
120
|
+
IF weighted_rsi is not at an extreme (not <= 35 for BULLISH, not >= 65
|
|
121
|
+
for BEARISH): divergence is NOT valid. Explicitly discard.
|
|
122
|
+
|
|
123
|
+
IF activity_ratio < 0.5: underlying RSI slopes are noise. Discard.
|
|
124
|
+
|
|
125
|
+
IF fewer than 20 bars of OBOS history are available
|
|
126
|
+
→ Slope computation requires 20 bars. Output NONE is expected behavior
|
|
127
|
+
on startup. Do not treat as a signal.
|
|
128
|
+
|
|
129
|
+
--------------------------------------------------------------------------------
|
|
130
|
+
ANTI-PATTERNS — DETECTABLE MISUSE CONDITIONS
|
|
131
|
+
--------------------------------------------------------------------------------
|
|
132
|
+
IF rsi_divergence is treated as a standalone reversal trigger
|
|
133
|
+
→ INCORRECT USE. Divergence indicates weakening momentum, not confirmed
|
|
134
|
+
reversal. Price can continue in the divergence direction for many ticks
|
|
135
|
+
after divergence is detected. Additional confirmation required.
|
|
136
|
+
|
|
137
|
+
IF rsi_divergence = BULLISH_DIVERGENCE is used regardless of RSI level
|
|
138
|
+
→ INCORRECT. Bullish divergence detected when RSI is at 55 means
|
|
139
|
+
nothing — RSI was never oversold. Only divergences forming at
|
|
140
|
+
extremes are statistically meaningful.
|
|
141
|
+
|
|
142
|
+
IF rsi_divergence is expected to reset on each tick
|
|
143
|
+
→ INCORRECT EXPECTATION. Divergence is computed from 20-bar slope.
|
|
144
|
+
It persists across ticks until price or RSI slopes change
|
|
145
|
+
significantly. It is a continuous condition assessment, not a one-time event.
|