@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
@@ -0,0 +1,305 @@
1
+ ================================================================================
2
+ INDICATOR: HMI — HELIOS MOMENTUM INDEX
3
+ ================================================================================
4
+ id: hmi
5
+ data_field: indicators.hmi
6
+ type: NUMERIC
7
+ range: -100.0 to 100.0
8
+ precision: 1 decimal place
9
+ update_rate: per_tick (every aggregate trade event)
10
+ latency_profile: COINCIDENT
11
+ # Reflects current cross-timeframe state.
12
+ # Does not predict future direction.
13
+ # Pair with data_field: indicators.hmi_velocity for direction confirmation.
14
+
15
+ --------------------------------------------------------------------------------
16
+ CONSTRUCT
17
+ --------------------------------------------------------------------------------
18
+ HMI is a weighted composite of momentum z-scores across 12 timeframes (1m–24h).
19
+
20
+ Each timeframe's raw % change is normalized by its own volatility to produce a
21
+ z-score, then Kalman-filtered for stability, then weighted and summed. The output
22
+ encodes both the DIRECTION and the BREADTH of agreement across the timeframe stack.
23
+
24
+ The weighting structure is non-uniform and heavily biased toward medium timeframes:
25
+
26
+ TIMEFRAME BASE WEIGHT
27
+ --------- -----------
28
+ 1m 0.05
29
+ 3m 0.06
30
+ 5m 0.08
31
+ 15m 0.12
32
+ 30m 0.14
33
+ 1h 0.16 ← single heaviest timeframe
34
+ 2h 0.13
35
+ 4h 0.11
36
+ 6h 0.06
37
+ 8h 0.04
38
+ 12h 0.03
39
+ 24h 0.02
40
+
41
+ Combined weight of 1m + 3m + 5m = 0.19
42
+ Weight of 1h alone = 0.16
43
+ Combined weight of 1h + 2h + 4h = 0.40
44
+
45
+ # The entire short-TF cluster (1m–5m) is outweighed by 1h alone.
46
+ # For HMI to reach any extreme, the 1h/2h/4h cluster must agree on direction.
47
+
48
+ Weights are further modulated per tick by:
49
+ - Bayesian confidence: low-confidence TF data reduces effective weight
50
+ - Alignment boost/penalty: TFs agreeing with neighbors get +15%; disagreeing get −15%
51
+ - Reversion dampener: extreme isolated z-scores are cut 50–80% when coherence is low
52
+ - Volume exhaustion multiplier: fading volume cuts contribution by up to 20%
53
+ - HFI cross-feed: derivatives flow alignment adds or subtracts up to 10%
54
+
55
+ HMI does NOT measure price extension, overbought/oversold state, or reversal probability.
56
+ It measures the degree of directional consensus across the weighted timeframe stack.
57
+
58
+ --------------------------------------------------------------------------------
59
+ RANGE INTERPRETATION
60
+ --------------------------------------------------------------------------------
61
+ # All ranges are self-contained. No cross-references required.
62
+ # For each range: what the stack state is, and what it means structurally.
63
+
64
+ hmi >= 75
65
+ The 1h/2h/4h cluster AND most shorter timeframes are aligned upward with
66
+ high magnitude. For this value to be reachable, medium-term TFs (combined
67
+ weight 0.40) must be strongly positive — short-TF contributions alone cannot
68
+ produce this reading. Every processing layer (alignment boost, reversion
69
+ dampener, exhaustion multiplier) is permitting full contribution rather than
70
+ attenuating. This is a fully established, self-reinforcing momentum state.
71
+ Historically co-occurs with CASCADE_UP or PARABOLIC regime.
72
+
73
+ hmi >= 60 AND hmi < 75
74
+ Strong directional consensus. The 1h/2h band is clearly positive and 30m is
75
+ contributing. Short TFs are aligned or neutral. The trend has propagated
76
+ through the full stack. This level is not reachable from short-TF activity
77
+ alone — medium/long TF agreement is mathematically required.
78
+
79
+ hmi >= 30 AND hmi < 60
80
+ Moderate consensus. Short and medium TFs agree but long TFs are contributing
81
+ weakly or are still catching up. This can mean:
82
+ - A developing trend that hasn't yet propagated to longer TFs
83
+ - A previous trend where longer TFs are decaying but still positive
84
+ These two states look identical in the HMI value. hmi_velocity distinguishes
85
+ them. IF hmi_velocity is unavailable: treat this range as indeterminate.
86
+
87
+ hmi >= 15 AND hmi < 30
88
+ Weak consensus. Primarily driven by short-to-medium TFs. The 1h/4h cluster
89
+ is near zero or mildly positive. Cannot distinguish early-stage accumulation
90
+ from momentum tail-off without hmi_velocity. Low structural weight — minor
91
+ changes in medium TFs will swing this reading significantly.
92
+
93
+ hmi > -15 AND hmi < 15
94
+ No meaningful directional consensus. Timeframes are mixed, opposing, or all
95
+ near zero. The weighted sum cancels out. This range carries no directional
96
+ information regardless of what any single timeframe shows. Do not infer
97
+ direction from HMI at this value.
98
+
99
+ hmi > -30 AND hmi <= -15
100
+ Weak downside consensus. Mirror construct of 15–29 upside range.
101
+ Same structural interpretation applies: short-to-medium TF driven, ambiguous
102
+ without hmi_velocity, sensitive to medium TF changes.
103
+
104
+ hmi > -60 AND hmi <= -30
105
+ Moderate downside consensus. Short and medium TFs agree on downside direction.
106
+ Long TFs are neutral or weakly negative. Mirror construct of 30–59 upside.
107
+ hmi_velocity required to distinguish developing vs decaying.
108
+
109
+ hmi > -75 AND hmi <= -60
110
+ Strong downside consensus. Mirror construct of 60–74 upside.
111
+ 1h/2h band is clearly negative. Medium/long TF agreement is mathematically
112
+ present. Trend propagated through the stack.
113
+
114
+ hmi <= -75
115
+ Full-stack downside alignment. Mirror construct of >= 75 upside.
116
+ 1h/2h/4h cluster strongly negative. Historically co-occurs with CASCADE_DOWN
117
+ or CRASH regime.
118
+
119
+ --------------------------------------------------------------------------------
120
+ TRAJECTORY EVALUATION
121
+ --------------------------------------------------------------------------------
122
+ # Evaluate using live values of both hmi AND hmi_velocity.
123
+ # hmi_velocity = Kalman-estimated rate of change of hmi, EMA-smoothed.
124
+ # These conditionals must be evaluated before acting on any hmi reading.
125
+
126
+ IF hmi >= 30 AND hmi_velocity >= 3.0
127
+ → Stack is broadening. Alignment expanding to additional timeframes.
128
+ Reading is likely to strengthen further. Medium TFs are joining short TFs
129
+ in positive territory.
130
+
131
+ IF hmi >= 30 AND hmi_velocity >= 0 AND hmi_velocity < 3.0
132
+ → Stack holding direction. Pace of gain is slowing. Existing alignment is
133
+ stable but not expanding. Trend continuation at current pace.
134
+
135
+ IF hmi >= 30 AND hmi_velocity < 0
136
+ → Stack has peaked or is peaking. Short TFs are beginning to diverge from
137
+ medium TFs. The hmi value reflects where the stack was, not its current
138
+ trajectory. Treat magnitude as potentially overstated.
139
+
140
+ IF hmi >= 60 AND hmi_velocity <= -3.0
141
+ → Active structural divergence. Long-TF infrastructure is still positive
142
+ (which is why hmi is still high) but short and medium TFs are reversing.
143
+ The high hmi value is a lagging artifact. Do not interpret as continuation.
144
+
145
+ IF hmi >= 15 AND hmi < 30 AND hmi_velocity >= 2.0
146
+ → Weak but building. Short-TF alignment is strengthening. Medium TFs may
147
+ follow. Possible early-stage trend formation.
148
+
149
+ IF hmi >= 15 AND hmi < 30 AND hmi_velocity <= 0
150
+ → Weak and fading. Signal has no actionable content. Discard for this cycle.
151
+
152
+ IF hmi > -15 AND hmi < 15 AND ANY direction
153
+ → Trajectory evaluation is not applicable. Stack is not in consensus.
154
+ hmi_velocity at near-zero hmi has no directional meaning.
155
+
156
+ # Mirror these conditionals for negative hmi values with sign-inverted thresholds.
157
+ IF hmi <= -30 AND hmi_velocity <= -3.0
158
+ → Downside stack broadening. Alignment expanding to additional timeframes.
159
+
160
+ IF hmi <= -60 AND hmi_velocity >= 3.0
161
+ → Active structural divergence to upside. Long-TF downside is lagging.
162
+ hmi value is overstating current downside state.
163
+
164
+ --------------------------------------------------------------------------------
165
+ INDICATOR RELATIONSHIPS
166
+ --------------------------------------------------------------------------------
167
+ # Format: field | relationship_type | operational rule
168
+
169
+ indicators.hmi_velocity | REQUIRED_COMPANION
170
+ At hmi IN -30..30: hmi_velocity is more informative than hmi itself.
171
+ IF hmi IN -30..30 AND hmi_velocity is not evaluated: mark hmi state as INDETERMINATE.
172
+ Do not act on hmi in this range without hmi_velocity.
173
+ At hmi outside -30..30: hmi_velocity determines whether value is current or lagging.
174
+
175
+ indicators.regime | CROSS_VALIDATE
176
+ HMI and regime are computed independently. When they conflict, confidence
177
+ in both is reduced. Evaluate conflict before using either.
178
+
179
+ IF hmi >= 40 AND regime IN [CASCADE_UP, BREAKOUT, TREND_UP]
180
+ → Full agreement between momentum magnitude and regime classification.
181
+ Both signals carry higher weight than either alone.
182
+
183
+ IF hmi >= 40 AND regime = CHOP
184
+ → Direct conflict. Regime has detected timeframe disagreement as dominant.
185
+ HMI reading is likely artifact of isolated TF movement despite weighted sum.
186
+ Discount hmi. Regime classification takes precedence.
187
+
188
+ IF hmi >= 40 AND regime IN [CHOP, CONSOL, RANGING]
189
+ → Conflict. Do not use hmi for directional inference until they reconcile.
190
+
191
+ IF hmi < 20 AND regime = BREAKOUT
192
+ → Regime is leading hmi. Momentum is building in structure before it has
193
+ propagated to the full timeframe stack. hmi may strengthen — monitor
194
+ hmi_velocity for confirmation.
195
+
196
+ IF hmi >= 60 AND regime = EXHAUST_UP
197
+ → Regime is detecting micro-TF divergence while macro TFs remain aligned.
198
+ hmi will remain high but is approaching structural peak.
199
+
200
+ indicators.tf_alignment | AMPLIFIES
201
+ hmi measures magnitude of the weighted sum. tf_alignment measures what
202
+ percentage of timeframes agree on direction. These are different dimensions.
203
+
204
+ IF hmi >= 60 AND tf_alignment >= 80
205
+ → Maximum signal quality. High magnitude AND high breadth. Full stack
206
+ agreement on both count and weighted contribution.
207
+
208
+ IF hmi >= 60 AND tf_alignment < 50
209
+ → Magnitude is concentrated in a subset of timeframes (likely 1h/2h with
210
+ high weight). Many TFs are neutral or opposing. Alignment is not broad.
211
+ Reduce confidence in directional inference.
212
+
213
+ IF hmi < 40 AND tf_alignment >= 80
214
+ → High breadth but low magnitude. Many TFs agree on direction but none
215
+ have strong momentum. Low-energy directional state.
216
+
217
+ indicators.hfi | CROSS_VALIDATE
218
+ HMI reflects price-derived momentum across timeframes. HFI reflects derivatives
219
+ market positioning (funding rate, open interest, CVD). These measure different
220
+ constructs. Agreement between them increases inference confidence.
221
+
222
+ IF hmi >= 40 AND hfi >= 20
223
+ → Price momentum confirmed by derivatives flow. Institutional positioning
224
+ is aligned with the timeframe stack direction.
225
+
226
+ IF hmi >= 40 AND hfi <= -10
227
+ → Divergence. Derivatives market is positioned against price momentum.
228
+ One signal will prove correct. Reduce confidence in both. Do not
229
+ treat hmi as standalone sufficient.
230
+
231
+ IF hmi <= -40 AND hfi >= 10
232
+ → Divergence in downside move. Derivatives players are buying while price
233
+ momentum is negative. Potential precursor to reversal — monitor hmi_velocity.
234
+
235
+ indicators.activity_ratio | PREREQUISITE_GATE
236
+ HMI is computed from trade flow z-scores. Insufficient volume degrades
237
+ signal quality. Gate is monotonic: reducing below 0.8 reduces confidence
238
+ continuously toward full invalidation at 0.5.
239
+
240
+ IF activity_ratio >= 0.8: hmi is volume-supported, full weight.
241
+ IF activity_ratio >= 0.5 AND activity_ratio < 0.8: reduce confidence in hmi.
242
+ IF activity_ratio < 0.5: see INVALIDATION.
243
+
244
+ --------------------------------------------------------------------------------
245
+ DEPENDENCY ORDER
246
+ --------------------------------------------------------------------------------
247
+ 1 INVALIDATION CONDITIONS (activity_ratio, regime) — discard if met.
248
+ 2 RANGE INTERPRETATION — determine current stack state.
249
+ 3 TRAJECTORY — combine with hmi_velocity; mark INDETERMINATE if hmi IN -30..30 and velocity unavailable.
250
+ 4 CROSS-VALIDATE with regime (conflict rules in INDICATOR RELATIONSHIPS).
251
+ 5 BREADTH — assess via tf_alignment for magnitude-breadth divergence.
252
+ 6 DERIVATIVES — cross-validate with hfi if available.
253
+ 7 VOLUME GATE — reduce confidence if activity_ratio < 0.8.
254
+
255
+ --------------------------------------------------------------------------------
256
+ INVALIDATION CONDITIONS
257
+ --------------------------------------------------------------------------------
258
+ # IF any condition below is true: discard hmi entirely.
259
+ # Do not use hmi for any inference when invalidated.
260
+
261
+ IF activity_ratio < 0.5
262
+ → Insufficient trade volume. Z-scores are computed from noise-level flow.
263
+ The weighted sum has no statistical reliability regardless of magnitude.
264
+
265
+ IF regime = CHOP
266
+ → Regime classifier has determined active timeframe disagreement is the
267
+ dominant state. Any non-zero hmi is an artifact of isolated TF movement,
268
+ not genuine stack alignment.
269
+
270
+ IF regime = CONSOL
271
+ → Price is in compression. HMI will return near-zero or weakly directional
272
+ values that reflect historical TF drift, not current directional state.
273
+ Directional interpretation is not valid in this regime.
274
+
275
+ --------------------------------------------------------------------------------
276
+ ANTI-PATTERNS — DETECTABLE MISUSE CONDITIONS
277
+ --------------------------------------------------------------------------------
278
+
279
+ IF hmi >= 75 AND being used to assess reversal probability or overbought state
280
+ → INCORRECT USE. hmi measures stack alignment, not price extension.
281
+ Extreme hmi can persist for the duration of a strong trend.
282
+ FOR extension/reversal assessment: use indicators.weighted_rsi,
283
+ indicators.vwap_zscore, or indicators.bayesian_overbought instead.
284
+
285
+ IF hmi IN 15..40 AND hmi_velocity has not been evaluated
286
+ → INCOMPLETE EVALUATION. At this range, hmi cannot distinguish early-stage
287
+ momentum from fading momentum. The reading is structurally ambiguous.
288
+ Do not act until hmi_velocity confirms trajectory.
289
+
290
+ IF hmi reading is being used as overbought/oversold signal
291
+ → INCORRECT USE. High hmi ≠ overbought. Low hmi ≠ oversold.
292
+ These are independent constructs measuring different market dimensions.
293
+
294
+ IF activity_ratio < 0.8 AND hmi is large in magnitude
295
+ → HIGH FALSE-SIGNAL RISK. Below-normal volume is the most frequent source
296
+ of misleading hmi readings. The weighted sum can appear compelling while
297
+ being computed on thin flow. Apply confidence reduction proportional
298
+ to how far activity_ratio is below 0.8.
299
+
300
+ IF hmi is high AND representing a short-timeframe bounce against a multi-hour trend
301
+ → VERIFY: This scenario cannot produce high hmi by construction.
302
+ 1m+3m+5m combined weight = 0.19. 1h alone = 0.16.
303
+ IF hmi IS high in this scenario, re-check that longer TF data is current
304
+ and not stale. A stale 1h reading in downtrend would cause exactly this
305
+ apparent contradiction.
@@ -0,0 +1,155 @@
1
+ ================================================================================
2
+ INDICATOR: HMI_VELOCITY — HELIOS MOMENTUM INDEX VELOCITY
3
+ ================================================================================
4
+ id: hmi_velocity
5
+ data_field: indicators.hmi_velocity
6
+ type: NUMERIC
7
+ range: Unbounded (practically constrained by parent HMI range of -100 to 100)
8
+ precision: 2 decimal places
9
+ update_rate: per_tick
10
+ latency_profile: COINCIDENT
11
+ # Measures rate of change of hmi at the current moment.
12
+ # Always evaluate jointly with data_field: indicators.hmi
13
+
14
+ --------------------------------------------------------------------------------
15
+ CONSTRUCT
16
+ --------------------------------------------------------------------------------
17
+ hmi_velocity is the first derivative of the composite HMI score, smoothed via
18
+ exponential moving average. It is NOT the internal Kalman velocity state (x[1])
19
+ used inside HMI's per-timeframe processing. It is computed as:
20
+
21
+ rawDelta = currentHmi - prevHmi
22
+ hmi_velocity = EMA(rawDelta, prevVelocity, alpha=0.15)
23
+ EMA formula: alpha * rawDelta + (1 - alpha) * prevVelocity
24
+
25
+ The alpha of 0.15 produces significant smoothing — approximately 12 ticks of
26
+ effective lag. This makes hmi_velocity a stable trend-of-trend signal, not a
27
+ noisy tick-to-tick delta.
28
+
29
+ hmi_velocity encodes:
30
+ SIGN Whether HMI is currently rising (positive) or falling (negative)
31
+ MAGNITUDE How fast the directional state is accelerating or decelerating
32
+
33
+ A value of zero means HMI is holding steady. Positive means momentum alignment
34
+ is strengthening. Negative means it is weakening or reversing.
35
+
36
+ --------------------------------------------------------------------------------
37
+ RANGE INTERPRETATION
38
+ --------------------------------------------------------------------------------
39
+ # Ranges are approximate due to unbounded nature — based on observed behavior
40
+ # given parent HMI is clamped to [-100, 100] and EMA alpha is 0.15.
41
+
42
+ hmi_velocity >= 5.0
43
+ Sharp acceleration. HMI is gaining multiple points per tick on a sustained
44
+ basis. The timeframe stack is rapidly broadening alignment. Associated with
45
+ early-stage breakouts or momentum surges where shorter TFs are pulling the
46
+ composite upward quickly.
47
+
48
+ hmi_velocity >= 2.0 AND hmi_velocity < 5.0
49
+ Steady acceleration. HMI is climbing at a healthy pace. Alignment is building
50
+ across timeframes. Combines with moderate-to-high HMI for highest conviction
51
+ momentum states.
52
+
53
+ hmi_velocity >= 0.5 AND hmi_velocity < 2.0
54
+ Mild acceleration. HMI is trending upward slowly. May reflect gradual TF
55
+ stack alignment or stabilization after prior momentum. Not an entry signal
56
+ by itself.
57
+
58
+ hmi_velocity > -0.5 AND hmi_velocity < 0.5
59
+ Stable / no meaningful change. HMI is flat or barely moving. Current
60
+ alignment state is holding. No directional information from velocity alone.
61
+
62
+ hmi_velocity > -2.0 AND hmi_velocity <= -0.5
63
+ Mild deceleration. HMI is losing ground slowly. Momentum is fading.
64
+ Existing alignment is degrading. Monitor for continuation of deceleration.
65
+
66
+ hmi_velocity > -5.0 AND hmi_velocity <= -2.0
67
+ Steady deceleration. HMI is dropping at a meaningful pace. Timeframe stack
68
+ is diverging. High-hmi readings with this velocity should be treated as
69
+ lagging — the current state is weaker than hmi alone suggests.
70
+
71
+ hmi_velocity <= -5.0
72
+ Sharp deceleration. Rapid stack divergence in progress. If hmi is still
73
+ positive and high, the reading is substantially lagging. Associated with
74
+ exhaustion peaks, failed breakouts, or sudden reversal of alignment after
75
+ a squeeze break that rapidly fades.
76
+
77
+ --------------------------------------------------------------------------------
78
+ HMI DISAMBIGUATION TABLE
79
+ --------------------------------------------------------------------------------
80
+ # hmi IN 15..40 (and -40..-15 for downside) is structurally ambiguous without velocity.
81
+ # This table resolves the ambiguity.
82
+
83
+ IF hmi >= 15 AND hmi < 40
84
+ IF hmi_velocity >= 2.0 → Building. Short-to-medium TFs are aligning.
85
+ IF hmi_velocity >= 0.0 → Holding. Stack is stable but not expanding.
86
+ IF hmi_velocity < 0.0 → Fading. Reading is trailing edge of alignment.
87
+ Do not treat hmi value as current state.
88
+
89
+ IF hmi >= 60
90
+ IF hmi_velocity >= 0.0 → Continuation. Stack integrity intact.
91
+ IF hmi_velocity < -3.0 → Structural divergence. Value is lagging.
92
+ Short TFs reversing while long TFs still positive.
93
+
94
+ IF hmi > -15 AND hmi < 15
95
+ → hmi_velocity has no directional meaning here.
96
+ Stack is not in consensus; velocity of a near-zero score is noise.
97
+
98
+ # Mirror these conditionals for negative hmi values with sign-inverted velocity.
99
+
100
+ --------------------------------------------------------------------------------
101
+ INDICATOR RELATIONSHIPS
102
+ --------------------------------------------------------------------------------
103
+ indicators.hmi | REQUIRED_COMPANION
104
+ hmi_velocity has no meaning without its parent hmi value.
105
+ hmi_velocity alone cannot indicate market direction.
106
+
107
+ indicators.regime | CONTEXT
108
+ IF regime IN [EXHAUST_UP, EXHAUST_DN] AND hmi_velocity confirms deceleration
109
+ → Regime and velocity agree on momentum peak. Higher confidence in
110
+ exhaustion read.
111
+ IF regime = BREAKOUT AND hmi_velocity >= 3.0
112
+ → Regime and velocity agree on acceleration. Breakout is expanding.
113
+ IF regime = CASCADE_UP AND hmi_velocity <= -3.0
114
+ → Conflict. Regime reflects established long-TF alignment (lagging).
115
+ Velocity is detecting early divergence. Monitor next few ticks.
116
+
117
+ indicators.tf_alignment | CONTEXT
118
+ Rising hmi_velocity with rising tf_alignment = alignment broadening.
119
+ Falling hmi_velocity with stable tf_alignment = magnitude shrinking
120
+ before breadth shrinks. Velocity leads tf_alignment at turns.
121
+
122
+ --------------------------------------------------------------------------------
123
+ DEPENDENCY ORDER
124
+ --------------------------------------------------------------------------------
125
+ 1 hmi is the parent — if hmi is invalidated, discard hmi_velocity.
126
+ 2 If hmi IN -15..15: hmi_velocity has no directional content.
127
+ 3 Apply disambiguation table above for direction.
128
+ 4 Cross-reference with regime if available.
129
+
130
+ --------------------------------------------------------------------------------
131
+ INVALIDATION CONDITIONS
132
+ --------------------------------------------------------------------------------
133
+ IF indicators.hmi is invalidated (see hmi.txt)
134
+ → hmi_velocity is also invalid. Discard.
135
+
136
+ IF hmi IN -5..5
137
+ → hmi_velocity carries no directional content. Do not use.
138
+
139
+ --------------------------------------------------------------------------------
140
+ ANTI-PATTERNS — DETECTABLE MISUSE CONDITIONS
141
+ --------------------------------------------------------------------------------
142
+ IF hmi_velocity is evaluated without first reading hmi
143
+ → INCOMPLETE EVALUATION. hmi_velocity has no directional meaning in
144
+ isolation. Acceleration of a near-zero hmi is noise.
145
+
146
+ IF hmi_velocity > 0 is used as a long signal independently
147
+ → INCORRECT USE. hmi_velocity tells you the trajectory of the stack,
148
+ not whether the stack is currently aligned. Rising velocity from
149
+ hmi = -80 means downside momentum is becoming less severe, not
150
+ that a long entry is appropriate.
151
+
152
+ IF hmi_velocity is expected to flip simultaneously with hmi at a pivot
153
+ → INCORRECT EXPECTATION. alpha=0.15 produces ~12 tick smoothing lag.
154
+ Velocity will show prior direction for several ticks after hmi turns.
155
+ Prioritize hmi level change over velocity for turn detection.
@@ -0,0 +1,136 @@
1
+ ================================================================================
2
+ INDICATOR: HURST_EXPONENT
3
+ ================================================================================
4
+ id: hurst_exponent
5
+ data_field: indicators.hurst_exponent
6
+ type: NUMERIC
7
+ range: 0.0 to 1.0
8
+ precision: 3 decimal places
9
+ update_rate: per_tick (requires sufficient close price history)
10
+ latency_profile: SLOW — computed from rolling close price history using R/S analysis
11
+
12
+ --------------------------------------------------------------------------------
13
+ CONSTRUCT
14
+ --------------------------------------------------------------------------------
15
+ The Hurst Exponent is computed via Rescaled Range (R/S) analysis on log returns
16
+ from sequential 1m close prices.
17
+
18
+ Computation:
19
+ returns[i] = closes[i] / closes[i-1] - 1 (for each consecutive close pair)
20
+ Minimum 16 valid returns required. If < 16: returns default value 0.5.
21
+
22
+ For window sizes w (powers of 2, from minWindow=8 to maxWindow=length/2):
23
+ Divide returns into floor(length/w) non-overlapping blocks.
24
+ For each block: compute mean, cumulative deviations, range, std dev.
25
+ R/S = range / std_dev for each block, then average across blocks.
26
+ Store (log(w), log(avgRS)) pair.
27
+
28
+ Hurst = slope of OLS linear regression on collected (log(w), log(avgRS)) pairs.
29
+ H = (k·Σxy - Σx·Σy) / (k·Σx² - (Σx)²)
30
+ Clamped to [0, 1].
31
+
32
+ The exponent captures whether 1m close price returns exhibit autocorrelation
33
+ (trending persistence) or anti-correlation (mean-reverting tendency).
34
+
35
+ --------------------------------------------------------------------------------
36
+ RANGE INTERPRETATION
37
+ --------------------------------------------------------------------------------
38
+ value > 0.6
39
+ Persistent / trending. Returns are positively autocorrelated — up moves tend
40
+ to follow up moves, down moves follow down moves. Price has a statistical
41
+ tendency to continue in the current direction. Momentum strategies have
42
+ a statistical edge. The higher above 0.5, the stronger the persistence.
43
+
44
+ value >= 0.45 AND value <= 0.55 (approximately)
45
+ Random walk. Returns exhibit minimal autocorrelation. Price movement has no
46
+ detectable persistent or mean-reverting tendency at the 1m timeframe.
47
+ No statistical edge in either direction from this metric alone.
48
+
49
+ value < 0.4
50
+ Anti-persistent / mean-reverting. Returns are negatively autocorrelated — up
51
+ moves tend to follow down moves and vice versa. Price has a statistical
52
+ tendency to reverse rather than continue. Mean-reversion strategies have
53
+ a statistical edge. The lower below 0.5, the stronger the mean-reversion.
54
+
55
+ value < 0.3
56
+ Strong mean-reversion tendency. Price is exhibiting persistent countertrend
57
+ behavior at the 1m level. Fade setups may be favored over trend-following.
58
+
59
+ value = 0.5 (exactly)
60
+ Default value returned when insufficient close price history is available
61
+ (< 16 valid returns). Treat as UNKNOWN, not as a meaningful reading.
62
+
63
+ --------------------------------------------------------------------------------
64
+ IMPORTANT CONSTRAINTS ON USE
65
+ --------------------------------------------------------------------------------
66
+ # Hurst Exponent is a statistical property, not a real-time signal.
67
+ # These constraints must be evaluated before use.
68
+
69
+ 1. It is computed from 1m close prices only. It reflects behavior at the 1m
70
+ return level. It does not describe behavior at 1h or 4h timeframes.
71
+
72
+ 2. It is a lagging statistical measure. A regime change or sudden shift in
73
+ price behavior will take many ticks to be reflected in Hurst.
74
+
75
+ 3. It measures tendency, not certainty. H = 0.65 does not mean price will
76
+ continue in the current direction — it means historically over the
77
+ lookback window, returns have been positively autocorrelated.
78
+
79
+ 4. When total history is exactly at the minimum threshold (16 returns),
80
+ the estimate is noisy. Reliable estimates require substantially more data.
81
+
82
+ --------------------------------------------------------------------------------
83
+ INDICATOR RELATIONSHIPS
84
+ --------------------------------------------------------------------------------
85
+ indicators.directional_efficiency | COMPANION
86
+ directional_efficiency measures current net movement cleanliness.
87
+ hurst_exponent measures historical return persistence.
88
+ IF hurst >= 0.6 AND directional_efficiency >= 0.5
89
+ → Current price movement is efficient AND historical pattern is trending.
90
+ Strongest case for momentum strategy applicability.
91
+ IF hurst < 0.4 AND directional_efficiency < 0.3
92
+ → Both current and historical measures indicate non-directional movement.
93
+ Mean-reversion strategies may be favored over momentum.
94
+
95
+ indicators.vwap_zscore | COMPANION FOR MEAN-REVERSION
96
+ IF hurst < 0.4 AND |vwap_zscore| > 2.0
97
+ → Historical mean-reverting tendency PLUS current price extended far
98
+ from VWAP. Both independently suggest mean-reversion probability.
99
+
100
+ indicators.regime | CONTEXT
101
+ TRENDING regimes (CASCADE, BREAKOUT, TREND) should co-occur with
102
+ hurst > 0.5 when the trend has persisted for sufficient time.
103
+ IF regime = CASCADE_UP AND hurst < 0.4:
104
+ → The trend may be very young (not yet reflected in Hurst) OR the
105
+ Hurst estimate is based on pre-trend history. Allow lag time for
106
+ Hurst to reflect new trend conditions.
107
+
108
+ --------------------------------------------------------------------------------
109
+ DEPENDENCY ORDER
110
+ --------------------------------------------------------------------------------
111
+ 1 If value = 0.5 exactly: insufficient history; discard.
112
+ 2 Read range interpretation.
113
+ 3 Cross-validate with directional_efficiency and regime for context.
114
+
115
+ --------------------------------------------------------------------------------
116
+ INVALIDATION CONDITIONS
117
+ --------------------------------------------------------------------------------
118
+ IF value = 0.5 (default)
119
+ → Insufficient close price history. Reading is meaningless.
120
+
121
+ IF recent regime change occurred (< last 20 ticks)
122
+ → Hurst may still reflect prior regime. Do not treat as current state.
123
+ Allow 20-50 ticks for Hurst to converge after a regime shift.
124
+
125
+ --------------------------------------------------------------------------------
126
+ ANTI-PATTERNS — DETECTABLE MISUSE CONDITIONS
127
+ --------------------------------------------------------------------------------
128
+ IF hurst > 0.6 is used to confirm a long entry independently
129
+ → INCOMPLETE USE. Hurst describes historical 1m return autocorrelation,
130
+ not current momentum direction. A high H on a downtrending asset means
131
+ the downtrend is persistent. Combine with direction indicators (hmi, regime).
132
+
133
+ IF hurst is expected to respond quickly to a new trend
134
+ → INCORRECT EXPECTATION. Hurst is a slow statistical indicator. It
135
+ requires many data points to converge on a new value. It lags real-time
136
+ regime changes significantly.