@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.
Files changed (68) hide show
  1. package/README.md +44 -2
  2. package/dist/chunk-NWGWXYTS.mjs +2964 -0
  3. package/dist/cli.d.mts +1 -0
  4. package/dist/cli.d.ts +1 -0
  5. package/dist/cli.js +2946 -0
  6. package/dist/cli.mjs +24 -0
  7. package/dist/index.d.mts +2137 -0
  8. package/dist/index.d.ts +2137 -0
  9. package/dist/index.js +3021 -0
  10. package/dist/index.mjs +52 -0
  11. package/docs/ai-agent-indicators/00_index.txt +210 -0
  12. package/docs/ai-agent-indicators/activity_ratio.txt +166 -0
  13. package/docs/ai-agent-indicators/activity_zscore.txt +166 -0
  14. package/docs/ai-agent-indicators/bayesian_overbought.txt +134 -0
  15. package/docs/ai-agent-indicators/directional_efficiency.txt +134 -0
  16. package/docs/ai-agent-indicators/hfi.txt +172 -0
  17. package/docs/ai-agent-indicators/hfi_weights.txt +124 -0
  18. package/docs/ai-agent-indicators/hmi.txt +305 -0
  19. package/docs/ai-agent-indicators/hmi_velocity.txt +155 -0
  20. package/docs/ai-agent-indicators/hurst_exponent.txt +136 -0
  21. package/docs/ai-agent-indicators/macd_divergence.txt +133 -0
  22. package/docs/ai-agent-indicators/macd_histogram.txt +145 -0
  23. package/docs/ai-agent-indicators/macd_signal.txt +119 -0
  24. package/docs/ai-agent-indicators/market_structure.txt +201 -0
  25. package/docs/ai-agent-indicators/poc.txt +131 -0
  26. package/docs/ai-agent-indicators/poc_distance.txt +129 -0
  27. package/docs/ai-agent-indicators/regime.txt +225 -0
  28. package/docs/ai-agent-indicators/rsi_divergence.txt +145 -0
  29. package/docs/ai-agent-indicators/squeeze_duration.txt +115 -0
  30. package/docs/ai-agent-indicators/squeeze_energy.txt +128 -0
  31. package/docs/ai-agent-indicators/support_resistance.txt +169 -0
  32. package/docs/ai-agent-indicators/tf_alignment.txt +165 -0
  33. package/docs/ai-agent-indicators/trend_interpretation.txt +98 -0
  34. package/docs/ai-agent-indicators/trend_strength.txt +134 -0
  35. package/docs/ai-agent-indicators/value_area_position.txt +142 -0
  36. package/docs/ai-agent-indicators/volatility_clustering.txt +160 -0
  37. package/docs/ai-agent-indicators/volatility_squeeze.txt +169 -0
  38. package/docs/ai-agent-indicators/volume_change_point.txt +151 -0
  39. package/docs/ai-agent-indicators/vwap.txt +133 -0
  40. package/docs/ai-agent-indicators/vwap_zscore.txt +154 -0
  41. package/docs/ai-agent-indicators/weighted_rsi.txt +148 -0
  42. package/docs/ai-agent-mcp/00_index.txt +110 -0
  43. package/docs/ai-agent-mcp/01_auth/00_overview.txt +51 -0
  44. package/docs/ai-agent-mcp/01_auth/01_tools.txt +94 -0
  45. package/docs/ai-agent-mcp/01_auth/02_data_contracts.txt +38 -0
  46. package/docs/ai-agent-mcp/01_auth/03_decision_rules.txt +25 -0
  47. package/docs/ai-agent-mcp/01_auth/04_failures_and_recovery.txt +46 -0
  48. package/docs/ai-agent-mcp/02_account/00_overview.txt +29 -0
  49. package/docs/ai-agent-mcp/02_account/01_tools.txt +67 -0
  50. package/docs/ai-agent-mcp/02_account/02_data_contracts.txt +34 -0
  51. package/docs/ai-agent-mcp/02_account/03_decision_rules.txt +17 -0
  52. package/docs/ai-agent-mcp/02_account/04_failures_and_recovery.txt +17 -0
  53. package/docs/ai-agent-mcp/03_market/00_overview.txt +27 -0
  54. package/docs/ai-agent-mcp/03_market/01_tools.txt +102 -0
  55. package/docs/ai-agent-mcp/03_market/02_data_contracts.txt +39 -0
  56. package/docs/ai-agent-mcp/03_market/03_decision_rules.txt +22 -0
  57. package/docs/ai-agent-mcp/03_market/04_failures_and_recovery.txt +18 -0
  58. package/docs/ai-agent-mcp/04_trading/00_overview.txt +25 -0
  59. package/docs/ai-agent-mcp/04_trading/01_tools.txt +123 -0
  60. package/docs/ai-agent-mcp/04_trading/02_data_contracts.txt +42 -0
  61. package/docs/ai-agent-mcp/04_trading/03_decision_rules.txt +30 -0
  62. package/docs/ai-agent-mcp/04_trading/04_failures_and_recovery.txt +25 -0
  63. package/docs/ai-agent-mcp/05_ledger/00_overview.txt +31 -0
  64. package/docs/ai-agent-mcp/05_ledger/01_tools.txt +80 -0
  65. package/docs/ai-agent-mcp/05_ledger/02_data_contracts.txt +46 -0
  66. package/docs/ai-agent-mcp/05_ledger/03_decision_rules.txt +44 -0
  67. package/docs/ai-agent-mcp/05_ledger/04_failures_and_recovery.txt +24 -0
  68. package/package.json +66 -3
package/dist/index.mjs ADDED
@@ -0,0 +1,52 @@
1
+ import {
2
+ FileAgentSessionStore,
3
+ HOSTED_RECONNECT_MESSAGE,
4
+ HeliosAgentMcpAccountService,
5
+ HeliosAgentMcpAuthService,
6
+ HeliosAgentMcpDocsService,
7
+ HeliosAgentMcpLedgerService,
8
+ HeliosAgentMcpMarketService,
9
+ HeliosAgentMcpProviderService,
10
+ HeliosAgentMcpTradingService,
11
+ MemoryAgentMcpSessionStore,
12
+ createHeliosAccountToolDefinitions,
13
+ createHeliosAgentMcpServer,
14
+ createHeliosAuthToolDefinitions,
15
+ createHeliosDocsToolDefinitions,
16
+ createHeliosLedgerToolDefinitions,
17
+ createHeliosMarketToolDefinitions,
18
+ createHeliosProviderToolDefinitions,
19
+ createHeliosTradingToolDefinitions,
20
+ formatHeliosLoginPrompt,
21
+ getDefaultHeliosAgentMcpDocsRoot,
22
+ getDefaultHeliosAgentMcpSessionPath,
23
+ pendingAgentLoginSchema,
24
+ retryAfterUnauthorizedRefresh,
25
+ toolAnnotations
26
+ } from "./chunk-NWGWXYTS.mjs";
27
+ export {
28
+ FileAgentSessionStore,
29
+ HOSTED_RECONNECT_MESSAGE,
30
+ HeliosAgentMcpAccountService,
31
+ HeliosAgentMcpAuthService,
32
+ HeliosAgentMcpDocsService,
33
+ HeliosAgentMcpLedgerService,
34
+ HeliosAgentMcpMarketService,
35
+ HeliosAgentMcpProviderService,
36
+ HeliosAgentMcpTradingService,
37
+ MemoryAgentMcpSessionStore,
38
+ createHeliosAccountToolDefinitions,
39
+ createHeliosAgentMcpServer,
40
+ createHeliosAuthToolDefinitions,
41
+ createHeliosDocsToolDefinitions,
42
+ createHeliosLedgerToolDefinitions,
43
+ createHeliosMarketToolDefinitions,
44
+ createHeliosProviderToolDefinitions,
45
+ createHeliosTradingToolDefinitions,
46
+ formatHeliosLoginPrompt,
47
+ getDefaultHeliosAgentMcpDocsRoot,
48
+ getDefaultHeliosAgentMcpSessionPath,
49
+ pendingAgentLoginSchema,
50
+ retryAfterUnauthorizedRefresh,
51
+ toolAnnotations
52
+ };
@@ -0,0 +1,210 @@
1
+ ================================================================================
2
+ HELIOS INDICATOR INDEX — AI AGENT REFERENCE
3
+ ================================================================================
4
+ # One entry per indicator. Format: file | data_field | type | range | purpose
5
+ # All fields accessed via: indicators.<data_field>
6
+
7
+ --------------------------------------------------------------------------------
8
+ MOMENTUM / DIRECTION
9
+ --------------------------------------------------------------------------------
10
+ hmi.txt
11
+ indicators.hmi | NUMERIC | -100..100
12
+ Weighted cross-timeframe momentum composite (12 TFs, Kalman/Bayesian).
13
+ REQUIRED_COMPANION: hmi_velocity. INVALIDATED BY: activity_ratio < 0.5, regime = CHOP/CONSOL.
14
+
15
+ hmi_velocity.txt
16
+ indicators.hmi_velocity | NUMERIC | unbounded (practical: -15..+15)
17
+ EMA of HMI delta (alpha=0.15). Resolves direction at ambiguous HMI levels (15..40).
18
+ REQUIRED_COMPANION: hmi. Meaningless if hmi IN -15..15.
19
+
20
+ regime.txt
21
+ indicators.regime | CATEGORICAL
22
+ 19-state market regime classifier (e.g. CASCADE_UP, CHOP, REVERSAL).
23
+ PRIMARY GATE: invalidates all momentum indicators when CHOP/CONSOL/RANGING.
24
+
25
+ tf_alignment.txt
26
+ indicators.tf_alignment | NUMERIC | 0..100
27
+ % of short-TF (1m-2h) movement aligned with macro (4h-24h) direction.
28
+ Breadth complement to HMI magnitude.
29
+
30
+ directional_efficiency.txt
31
+ indicators.directional_efficiency | NUMERIC | -1..1
32
+ Kaufman efficiency ratio: net directional movement / total movement across all TFs.
33
+ Measures cleanliness not direction. Cluster sub-fields available.
34
+
35
+ hurst_exponent.txt
36
+ indicators.hurst_exponent | NUMERIC | 0..1
37
+ R/S analysis on 1m returns. > 0.6 = trending persistence. < 0.4 = mean-reverting.
38
+ Exactly 0.5 = insufficient data (< 16 returns). Slow/lagging.
39
+
40
+ --------------------------------------------------------------------------------
41
+ TREND STRENGTH
42
+ --------------------------------------------------------------------------------
43
+ trend_strength.txt
44
+ indicators.trend_strength | NUMERIC | 0..100
45
+ DX-style directional index. Directional imbalance across weighted TF clusters.
46
+ Direction-agnostic — pair with hmi or regime for direction.
47
+
48
+ trend_interpretation.txt
49
+ indicators.trend_interpretation | CATEGORICAL | STRONG / MODERATE / WEAK / RANGING_CHOPPY
50
+ Categorical alias of trend_strength (same computation, fixed thresholds).
51
+ Use for state-based branching; use trend_strength for numeric precision.
52
+
53
+ --------------------------------------------------------------------------------
54
+ OSCILLATORS / RSI
55
+ --------------------------------------------------------------------------------
56
+ weighted_rsi.txt
57
+ indicators.weighted_rsi | NUMERIC | 0..100
58
+ Multi-TF EWMA RSI blended across 12 TFs (1m-dominant, alpha=0.3).
59
+ REQUIRED_COMPANION: bayesian_overbought. Invalidated if activity_ratio < 0.5.
60
+
61
+ bayesian_overbought.txt
62
+ indicators.bayesian_overbought | NUMERIC | 0..1
63
+ Beta-Binomial posterior: P(current RSI >= historical 60-obs window).
64
+ Contextualizes weighted_rsi in historical percentile terms.
65
+
66
+ rsi_divergence.txt
67
+ indicators.rsi_divergence | CATEGORICAL | BULLISH_DIVERGENCE / BEARISH_DIVERGENCE / NONE
68
+ Slope divergence between price and weighted_rsi over 20-bar window.
69
+ Valid only at RSI extremes: BULLISH when RSI <= 35; BEARISH when RSI >= 65.
70
+
71
+ --------------------------------------------------------------------------------
72
+ MACD
73
+ --------------------------------------------------------------------------------
74
+ macd_histogram.txt
75
+ indicators.macd_histogram | NUMERIC | unbounded (normalize by price)
76
+ Standard MACD(12,26,9) histogram, normalized by close price.
77
+ Growing/shrinking vs zero direction is more informative than absolute level.
78
+
79
+ macd_signal.txt
80
+ indicators.macd_signal | CATEGORICAL | BULLISH_CROSS / BEARISH_CROSS / BULLISH / BEARISH / NEUTRAL
81
+ State-encoded MACD direction from same computation as histogram.
82
+ CHOP gate: all states unreliable in CHOP regime.
83
+
84
+ macd_divergence.txt
85
+ indicators.macd_divergence | CATEGORICAL | BULLISH / BEARISH / "" (empty = none)
86
+ Peak/trough swing divergence: price vs MACD histogram peaks over rolling window.
87
+ Peak-based; requires 2 completed swings. Independent of rsi_divergence.
88
+
89
+ --------------------------------------------------------------------------------
90
+ VOLUME PROFILE
91
+ --------------------------------------------------------------------------------
92
+ vwap.txt
93
+ indicators.vwap | PRICE LEVEL
94
+ 7-day rolling VWAP (cumulative TPV / volume). NOT session VWAP.
95
+ REQUIRED_COMPANION: vwap_zscore. Bands at ±1σ and ±2σ also available.
96
+
97
+ vwap_zscore.txt
98
+ indicators.vwap_zscore | NUMERIC | unbounded (typical: -4..+4)
99
+ z-score of (price - vwap) / volumeWeightedStdDev. Modulated by volatility_clustering.
100
+ FAR_ABOVE (> 2.0) meaning changes under different volatility_clustering conditions.
101
+
102
+ poc.txt
103
+ indicators.poc | PRICE LEVEL
104
+ Highest-volume price level from 50-bucket volume profile over rolling history.
105
+ REQUIRED_COMPANION: poc_distance. VA boundaries also emitted.
106
+
107
+ poc_distance.txt
108
+ indicators.poc_distance | NUMERIC | unbounded (typical: -10..+10, %)
109
+ % distance from current price to POC. Positive = above. Negative = below.
110
+ Mean-reversion thesis only when regime is non-trending.
111
+
112
+ value_area_position.txt
113
+ indicators.value_area_position | CATEGORICAL | ABOVE VA / IN VA / BELOW VA
114
+ Price position relative to 70% volume zone (VA). Requires regime for interpretation.
115
+ ABOVE VA = mean-reversion in CHOP; continuation in CASCADE/BREAKOUT.
116
+
117
+ support_resistance.txt
118
+ indicators.support | ARRAY of level objects
119
+ indicators.resistance | ARRAY of level objects
120
+ Hybrid EMA+ATR + pivot clustering + KDE, Bayesian Beta-Binomial hold probability.
121
+ Fields: price, distance%, touches, weightedTouches, strength (STRONG/MODERATE/WEAK),
122
+ source, bayesianStrength. Never assume array is non-empty.
123
+
124
+ --------------------------------------------------------------------------------
125
+ DERIVATIVES FLOW
126
+ --------------------------------------------------------------------------------
127
+ hfi.txt
128
+ indicators.hfi | NUMERIC | -100..100
129
+ Helios Flow Index: Bayesian composite of funding rate, OI delta, CVD slope.
130
+ REQUIRED_COMPANION: hfi_weights. Measures derivatives sentiment, not price direction.
131
+
132
+ hfi_weights.txt
133
+ indicators.hfi_weights | OBJECT | { funding, oi, cvd } each [0..1], sum=1
134
+ Real-time Bayesian component weights for HFI computation.
135
+ Any weight < 0.10 = that data source is degraded.
136
+
137
+ --------------------------------------------------------------------------------
138
+ VOLATILITY / SQUEEZE
139
+ --------------------------------------------------------------------------------
140
+ volatility_squeeze.txt
141
+ indicators.volatility_squeeze | NUMERIC | [0, ∞); typical [0.1, 1.5]
142
+ Short/long GARCH(1,1) ratio. LOWER = MORE compressed (< 0.8 = in squeeze).
143
+ Counterintuitive scale: value 0.2 = maximum squeeze, NOT minimum.
144
+
145
+ squeeze_duration.txt
146
+ indicators.squeeze_duration | INTEGER | [0, ∞)
147
+ Count of consecutive ticks with volatility_squeeze < 0.8. Resets to 0 on break.
148
+
149
+ squeeze_energy.txt
150
+ indicators.squeeze_energy | NUMERIC | [0, ∞)
151
+ Integrated compression: squeeze_duration × (0.8 - volatility_squeeze).
152
+ Summary measure of pent-up energy. Zero = no active squeeze.
153
+
154
+ volatility_clustering.txt
155
+ indicators.volatility_clustering | NUMERIC | [0.7, 1.5] ← NOT [0, 1]
156
+ Weighted average of 6-TF log-volume z-scores as a confidence multiplier.
157
+ 1.0 = neutral baseline. < 0.9 = below-norm. > 1.1 = above-norm.
158
+ Adjusts vwap_zscore thresholds internally.
159
+
160
+ volume_change_point.txt
161
+ indicators.volatility_clustering.change_point_probability | NUMERIC | [0, 1]
162
+ Embedded sub-field of volatility_clustering (BOCPD algorithm).
163
+ P(volume regime just shifted this tick). > 0.5 is notable; > 0.7 is strong.
164
+
165
+ --------------------------------------------------------------------------------
166
+ MARKET STRUCTURE
167
+ --------------------------------------------------------------------------------
168
+ market_structure.txt
169
+ indicators.market_structure | CATEGORICAL
170
+ Values: RANGING / CONSOL / BREAKING_UP / BREAKING_DOWN /
171
+ CONFIRMED_BREAK_UP / CONFIRMED_BREAK_DOWN / TEST_RS / FAILED_BREAK
172
+ 9-state HMM + ATR. CONFIRMED requires 3 consecutive ticks above/below S/R.
173
+ SUB-FIELD: indicators.market_structure.transitionConfidence [0..1] — HMM posterior.
174
+
175
+ --------------------------------------------------------------------------------
176
+ VOLUME / ACTIVITY
177
+ --------------------------------------------------------------------------------
178
+ activity_ratio.txt
179
+ indicators.activity_ratio | NUMERIC | [0, ∞); 1.0 = baseline
180
+ Recent 5-candle volume vs time-of-day normalized 1-day baseline.
181
+ PRIMARY INVALIDATION GATE for all other indicators at ratio < 0.5.
182
+ SUB-FIELD: indicators.activity_ratio.active [BOOLEAN] = true if ratio >= 0.5.
183
+ REVERSAL and ROLLOVER regimes require ratio >= 1.0.
184
+
185
+ activity_zscore.txt
186
+ indicators.activity_zscore | NUMERIC | log-normal; typical -3..+4
187
+ Log-normal z-score of current tick volume vs same-hour 1-day baseline.
188
+ Single-tick detector (not 5-candle window). Companion to activity_ratio.
189
+
190
+ ================================================================================
191
+ DEPENDENCY MAP — KEY RELATIONSHIPS
192
+ ================================================================================
193
+ # Read bottom-up: left depends on right being valid first.
194
+
195
+ ALL INDICATORS → activity_ratio (< 0.5 invalidates most momentum signals)
196
+ hmi → hmi_velocity (required for hmi IN -30..30)
197
+ hmi_velocity → hmi (parent; has no meaning without it)
198
+ weighted_rsi → bayesian_overbought (raw RSI needs percentile context)
199
+ rsi_divergence → weighted_rsi (extremes gate: valid only at RSI <= 35 / >= 65)
200
+ macd_signal → macd_histogram (state without magnitude is incomplete)
201
+ macd_divergence → macd_signal (divergence leads; cross confirms)
202
+ hfi → hfi_weights (composite without component split is opaque)
203
+ squeeze_energy → volatility_squeeze + squeeze_duration (derived from both)
204
+ vwap_zscore → vwap + volatility_clustering (both required for interpretation)
205
+ poc_distance → poc (normalized deviation requires knowing the level)
206
+ value_area_position → regime (same state is opposite signal in different regimes)
207
+ volatility_clustering → (modulates vwap_zscore internally at computation time)
208
+ volume_change_point → volatility_clustering (embedded sub-field, not standalone)
209
+ market_structure → support/resistance (uses S/R levels for BREAKING/TEST states)
210
+ regime → (no upstream dependency; invalidates downstream indicators)
@@ -0,0 +1,166 @@
1
+ ================================================================================
2
+ INDICATOR: ACTIVITY_RATIO — VOLUME ACTIVITY RATIO
3
+ ================================================================================
4
+ id: activity_ratio
5
+ data_field: indicators.activity_ratio
6
+ type: NUMERIC
7
+ range: [0, ∞); 1.0 = exactly at baseline
8
+ precision: 3 decimal places
9
+ update_rate: per_tick
10
+ latency_profile: COINCIDENT
11
+
12
+ ADDITIONAL FIELD:
13
+ indicators.activity_ratio.active
14
+ type: BOOLEAN
15
+ value: true if activity_ratio >= 0.5, false if < 0.5
16
+
17
+ --------------------------------------------------------------------------------
18
+ CONSTRUCT
19
+ --------------------------------------------------------------------------------
20
+ activity_ratio compares the recent 5-candle volume average against a time-of-day
21
+ normalized 1-day baseline, producing a ratio that reflects how active the market
22
+ is currently vs its typical activity at this time of day.
23
+
24
+ Recent window:
25
+ recent = average volume of the last 5 candles (1m each = 5 minutes)
26
+
27
+ Baseline construction:
28
+ 1. Collect all candles from the last 1 day (~1440 1m candles).
29
+ 2. IF the time-of-day group (matching UTC hour) has >= 10 candles available:
30
+ baseline = average volume of candles in the SAME UTC HOUR over the past day.
31
+ (Time-of-day normalized — compares against same-hour behavior.)
32
+ 3. ELSE:
33
+ baseline = average volume of ALL candles in the past 1 day.
34
+ (Falls back to all-day average if insufficient same-hour history.)
35
+
36
+ ratio = recent / baseline
37
+
38
+ Time-of-day normalization is important because:
39
+ - Asian session typically has lower volume than US session
40
+ - Comparing current volume against the same-hour baseline prevents
41
+ falsely labeling Asian session volume as "dead" just because it's
42
+ lower than a full-day average
43
+
44
+ --------------------------------------------------------------------------------
45
+ RANGE INTERPRETATION
46
+ --------------------------------------------------------------------------------
47
+ value >= 1.5
48
+ Volume is significantly above the typical rate for this time of day.
49
+ Very active market. High participation. Data quality for all indicators
50
+ is at its best. Price moves in this state are better sustained and
51
+ represent genuine market conviction.
52
+
53
+ value >= 1.0 AND value < 1.5
54
+ Volume at or above baseline. Active conditions. Price action is supported
55
+ by at least typical participation. Directional signals are reliable.
56
+ REVERSAL and ROLLOVER regimes require value >= 1.0.
57
+
58
+ value >= 0.5 AND value < 1.0
59
+ Below-baseline but not dead. Volume is 50%-100% of the typical rate.
60
+ activity_ratio.active = true.
61
+ Directional signals should be used with moderate caution. Some signals
62
+ will be lower quality but not completely unreliable.
63
+
64
+ value < 0.5
65
+ Very low volume. Dead market conditions.
66
+ activity_ratio.active = false.
67
+ ALL directional indicators should be treated with significant skepticism.
68
+ This threshold is the primary invalidation gate for many indicators.
69
+
70
+ --------------------------------------------------------------------------------
71
+ ACTIVITY STATES — OPERATIONAL LABELS
72
+ --------------------------------------------------------------------------------
73
+ ACTIVE: value >= 1.0
74
+ Most indicator readings reliable. Regime classifications including
75
+ REVERSAL and ROLLOVER are eligible. HFI CVD component is reliable.
76
+ Breakout signals should be considered.
77
+
78
+ MODERATE: value >= 0.5 AND value < 1.0
79
+ Most momentum indicators still valid but with reduced confidence.
80
+ Support/resistance levels have lower hold probability in moderate volume.
81
+ REVERSAL/ROLLOVER regimes are gated out (require ACTIVE).
82
+
83
+ DEAD: value < 0.5
84
+ invalidate indicators: weighted_rsi, hfi (especially CVD component),
85
+ directional_efficiency, trend_strength. These are all computed from
86
+ price/volume data that has no meaningful signal with dead volume.
87
+
88
+ --------------------------------------------------------------------------------
89
+ INDICATOR RELATIONSHIPS — ROLE AS INVALIDATION GATE
90
+ --------------------------------------------------------------------------------
91
+ # activity_ratio is the primary PREREQUISITE GATE for all other indicators.
92
+ # If value < 0.5, the following should be explicitly discarded:
93
+
94
+ indicators.weighted_rsi → DISCARD if activity_ratio < 0.5
95
+ indicators.directional_efficiency → DISCARD if activity_ratio < 0.5
96
+ indicators.trend_strength → DISCARD if activity_ratio < 0.5
97
+ indicators.hfi (CVD component) → SIGNIFICANTLY REDUCED if activity_ratio < 0.5
98
+ indicators.macd_histogram → REDUCED (slow EMA less reliable)
99
+ indicators.support (new levels) → DISCARD levels formed in this period
100
+
101
+ # Regime-specific gates:
102
+ indicators.regime = REVERSAL → REQUIRES activity_ratio >= 1.0
103
+ indicators.regime = ROLLOVER → REQUIRES activity_ratio >= 1.0
104
+
105
+ indicators.hmi | CONTEXT
106
+ HMI is somewhat more resistant to low volume (uses historical TF data)
107
+ but readings should still be downweighted when activity_ratio < 0.5.
108
+
109
+ indicators.volatility_squeeze | COMPANION
110
+ IF activity_ratio < 0.5 AND volatility_squeeze < 0.5
111
+ → Both volume AND price volatility are compressed. Maximum dual-quiet
112
+ state. All directional indicators degraded. Wait for volume return.
113
+
114
+ indicators.volatility_clustering | COMPANION
115
+ activity_ratio measures recent 5-candle activity for current-moment gating.
116
+ volatility_clustering measures multi-TF volume z-scores for longer context.
117
+ They typically agree on direction but activity_ratio reacts faster to sudden
118
+ volume changes; clustering reacts more smoothly.
119
+
120
+ indicators.activity_zscore | COMPANION
121
+ activity_ratio: current/baseline ratio (multiplicative measure).
122
+ activity_zscore: z-score on log volume (standardized statistical measure).
123
+ Both represent volume activity but from different statistical perspectives.
124
+ Together they provide a fuller view of volume state.
125
+
126
+ --------------------------------------------------------------------------------
127
+ DEPENDENCY ORDER
128
+ --------------------------------------------------------------------------------
129
+ 1 Read activity_ratio value AND activity_ratio.active boolean.
130
+ 2 Determine state: ACTIVE (>= 1.0), MODERATE (0.5-1.0), or DEAD (< 0.5).
131
+ 3 DEAD state: weighted_rsi, directional_efficiency, trend_strength, HFI CVD are invalid.
132
+ 4 MODERATE state: reduced confidence on all signals.
133
+ 5 Gate REVERSAL/ROLLOVER regime states (require ACTIVE).
134
+
135
+ --------------------------------------------------------------------------------
136
+ INVALIDATION CONDITIONS
137
+ --------------------------------------------------------------------------------
138
+ activity_ratio is itself a near-primary indicator — it does not depend on
139
+ other signals for validity.
140
+
141
+ IF baseline (1-day history) is not yet available (market just listed)
142
+ → Falls back to all-day average. If even that is < 10 candles, baseline
143
+ may be unreliable. Treat activity_ratio = 1.0 as default on fresh starts.
144
+
145
+ IF volume data has gaps (candles with zero volume)
146
+ → average over 5-candle window may include zero-volume candles.
147
+ result will be suppressed artificially. Verify data source integrity.
148
+
149
+ --------------------------------------------------------------------------------
150
+ ANTI-PATTERNS — DETECTABLE MISUSE CONDITIONS
151
+ --------------------------------------------------------------------------------
152
+ IF activity_ratio is only consulted for specific indicators and not others
153
+ → INCOMPLETE APPLICATION. activity_ratio < 0.5 is a system-wide gate.
154
+ It is not sufficient to gate only RSI while continuing to act on
155
+ regime or MACD signals. Apply the invalidation to ALL indicators.
156
+
157
+ IF activity_ratio = 1.0 is interpreted as "maximum activity"
158
+ → INCORRECT. 1.0 is exactly the baseline (neutral, normal activity).
159
+ Values up to 3.0+ are possible during squeezes or major events.
160
+ 1.0 is normal, not exceptional.
161
+
162
+ IF time-of-day normalization is ignored when comparing across sessions
163
+ → CONTEXT ERROR. activity_ratio compares against the same UTC hour baseline.
164
+ A ratio of 0.8 during a typically quiet Asian session is different
165
+ from 0.8 during peak US session. Do not compare activity_ratio values
166
+ across different UTC hours as if they represent the same absolute volume.
@@ -0,0 +1,166 @@
1
+ ================================================================================
2
+ INDICATOR: ACTIVITY_ZSCORE — VOLUME ACTIVITY Z-SCORE
3
+ ================================================================================
4
+ id: activity_zscore
5
+ data_field: indicators.activity_zscore
6
+ type: NUMERIC
7
+ range: Unbounded; follows log-normal distribution; practical range -3 to +4
8
+ precision: 3 decimal places
9
+ update_rate: per_tick
10
+ latency_profile: COINCIDENT
11
+
12
+ --------------------------------------------------------------------------------
13
+ CONSTRUCT
14
+ --------------------------------------------------------------------------------
15
+ activity_zscore is a standardized measure of current volume expressed as a
16
+ log-normal z-score against the same 1-day time-of-day normalized baseline
17
+ used by activity_ratio. It provides a statistically rigorous alternative view
18
+ of volume deviation.
19
+
20
+ Computation:
21
+ Uses the same baseline as activity_ratio (see activity_ratio.txt):
22
+ - 1-day lookback, time-of-day normalized (current UTC hour if >= 10 candles)
23
+
24
+ logVols = log(volume) for each candle in baseline window
25
+ mean_log = mean(logVols)
26
+ std_log = standard deviation(logVols)
27
+
28
+ currentLogVol = log(currentVol) (most recent 1m candle volume)
29
+
30
+ activity_zscore = (currentLogVol - mean_log) / std_log
31
+
32
+ Using log-normal distribution is appropriate because trading volume:
33
+ - Is always positive (log transform required)
34
+ - Has right-skewed distribution at linear scale
35
+ - Becomes approximately normal at log scale
36
+
37
+ This z-score is more statistically robust than activity_ratio for detecting
38
+ truly unusual volume events, because:
39
+ - It accounts for the distribution shape (not just mean ratio)
40
+ - It handles asymmetry correctly (equal-magnitude upside and downside spikes)
41
+
42
+ --------------------------------------------------------------------------------
43
+ RANGE INTERPRETATION
44
+ --------------------------------------------------------------------------------
45
+ value > 3.0
46
+ Extreme volume spike. Current volume is at the top 0.1% of the historical
47
+ 1-day log-normal distribution for this time of day. This represents a
48
+ major volume event: large liquidation, significant news, institutional
49
+ block, or market shock. Very rare in untriggered conditions.
50
+
51
+ value > 2.0 AND value <= 3.0
52
+ Strong volume spike. Current tick volume is unusually high relative to
53
+ the 1-day same-hour baseline. Top ~2.5% of observations. Associated with
54
+ breakout initiations, forced liquidations, or high-activity news reactions.
55
+
56
+ value > 1.0 AND value <= 2.0
57
+ Above average. Current volume is elevated but not extreme. Top ~16%
58
+ of observations. Increases confidence in directional signals at the
59
+ current tick. Suggests active participation without being a shock event.
60
+
61
+ value >= -1.0 AND value <= 1.0
62
+ Normal range. Within ±1 standard deviation of the mean log-volume for
63
+ this time of day. Average conditions; baseline reliability for all indicators.
64
+
65
+ value >= -2.0 AND value < -1.0
66
+ Below average. Current tick volume is lighter than typical.
67
+ Directional signals carry some reduction in reliability.
68
+
69
+ value < -2.0
70
+ Unusually quiet. Current tick volume is at the bottom ~2.5% of
71
+ historical observations for this time of day. Very low participation.
72
+ Most indicator signals should be treated with increased skepticism.
73
+
74
+ value < -3.0
75
+ Extremely quiet tick. Extremely unusual absence of volume.
76
+ Potential data gap or trading halt. Treat as similar to activity_ratio < 0.5.
77
+
78
+ --------------------------------------------------------------------------------
79
+ COMPARISON WITH ACTIVITY_RATIO
80
+ --------------------------------------------------------------------------------
81
+ # Both indicators measure volume activity vs baseline. They are complementary.
82
+
83
+ activity_ratio approaches volume as: recent_average / baseline_average
84
+ - Intuitively: "current MA of volume is X times the baseline MA"
85
+ - Good for: sustained elevated/depressed volume conditions
86
+ - Limitation: sensitive to outliers if recent candles contain spikes
87
+
88
+ activity_zscore approaches volume as: log-normal z-score of current candle
89
+ - Intuitively: "this tick's volume is X standard deviations from normal"
90
+ - Good for: detecting sudden single-tick volume spikes/crashes
91
+ - Limitation: single-tick; may miss sustained moderate elevation
92
+
93
+ Use activity_ratio as the primary gate (covers 5-candle window).
94
+ Use activity_zscore to detect instantaneous unusual events (single tick).
95
+
96
+ Agreement examples:
97
+ activity_ratio >= 1.0 AND activity_zscore > 1.0
98
+ → Sustained and current high volume. Full confidence conditions.
99
+
100
+ activity_ratio < 0.5 AND activity_zscore < -2.0
101
+ → Both agree on extreme quiet. Double confirmation of dead market.
102
+
103
+ Divergence examples:
104
+ activity_ratio = 0.4 (quiet recent window) AND activity_zscore = 2.5 (this tick spike)
105
+ → The current tick has spiked despite a quiet recent period.
106
+ A sudden large order or news event on a quiet tape. High significance.
107
+
108
+ activity_ratio = 1.5 (elevated recent window) AND activity_zscore = -0.5 (this tick quiet)
109
+ → Current tick is quiet but the recent window has been active.
110
+ The immediate activity is normalizing after a busy period.
111
+
112
+ --------------------------------------------------------------------------------
113
+ INDICATOR RELATIONSHIPS
114
+ --------------------------------------------------------------------------------
115
+ indicators.activity_ratio | COMPANION
116
+ Use together as described above. activity_ratio for window-level gate;
117
+ activity_zscore for tick-level event detection.
118
+
119
+ indicators.volume_change_point | COMPANION
120
+ change_point_probability detects volume REGIME shifts (sustained changes).
121
+ activity_zscore detects tick-level spikes (momentary changes).
122
+ IF both are elevated simultaneously:
123
+ → A sudden volume spike that also exceeds BOCPD detection threshold.
124
+ Rare and high-significance volume event.
125
+
126
+ indicators.hfi | CONTEXT
127
+ activity_zscore > 2.0 at the same tick as HFI CVD component change
128
+ suggests a large real-money order flow event at that specific moment.
129
+
130
+ indicators.squeeze indicators | ALERT
131
+ IF squeeze_energy > 10 AND activity_zscore > 2.0 fires
132
+ → Volume spike into a compressed market. Classic squeeze release trigger.
133
+ Monitor next few ticks for the directional breakout to confirm.
134
+
135
+ --------------------------------------------------------------------------------
136
+ DEPENDENCY ORDER
137
+ --------------------------------------------------------------------------------
138
+ 1 Check activity_ratio first (5-candle window gate).
139
+ 2 Read activity_zscore for current-tick event context.
140
+ 3 Identify divergences between activity_ratio and activity_zscore.
141
+ 4 If zscore > 2.0 during low activity_ratio: potential sudden volume event.
142
+ 5 Combine with squeeze_energy and volume_change_point for breakout context.
143
+
144
+ --------------------------------------------------------------------------------
145
+ INVALIDATION CONDITIONS
146
+ --------------------------------------------------------------------------------
147
+ IF std_log ≈ 0 (near-constant volume in 1-day baseline)
148
+ → Division by near-zero. z-score is unstable. Extremely unlikely in
149
+ practice except during exchange testing periods or extended maintenance.
150
+
151
+ IF baseline window has fewer than 10 candles
152
+ → std_log estimate is unreliable. Treat as approximately 0.
153
+
154
+ --------------------------------------------------------------------------------
155
+ ANTI-PATTERNS — DETECTABLE MISUSE CONDITIONS
156
+ --------------------------------------------------------------------------------
157
+ IF activity_zscore > 2.0 is used as a standalone trade trigger
158
+ → INCORRECT. High z-score means unusual volume at THIS TICK. Volume
159
+ can spike without directional follow-through. Requires directional
160
+ confirmation from hmi, regime, or market_structure.
161
+
162
+ IF activity_zscore is used instead of activity_ratio as the primary gate
163
+ → WRONG GATE. activity_ratio covers the 5-candle window for sustained volume
164
+ gating; activity_zscore is a single-tick measure. Using only
165
+ activity_zscore for gating may pass indicators during a dead
166
+ market that just had one unusual tick. Use activity_ratio as the gate.