@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,151 @@
|
|
|
1
|
+
================================================================================
|
|
2
|
+
INDICATOR: VOLUME_CHANGE_POINT — BAYESIAN VOLUME REGIME CHANGE PROBABILITY
|
|
3
|
+
================================================================================
|
|
4
|
+
id: volume_change_point
|
|
5
|
+
data_field: indicators.volatility_clustering.change_point_probability
|
|
6
|
+
# NOT a standalone field — embedded in volatility_clustering output
|
|
7
|
+
type: NUMERIC
|
|
8
|
+
range: [0.0, 1.0]
|
|
9
|
+
precision: 3 decimal places
|
|
10
|
+
update_rate: per_tick
|
|
11
|
+
latency_profile: LAGGING (uses Bayesian Online Changepoint Detection over 60 max run length)
|
|
12
|
+
|
|
13
|
+
--------------------------------------------------------------------------------
|
|
14
|
+
CONSTRUCT
|
|
15
|
+
--------------------------------------------------------------------------------
|
|
16
|
+
IMPORTANT: volume_change_point is not a standalone indicator. It is the
|
|
17
|
+
changePointProbability sub-field of the volatility_clustering output object.
|
|
18
|
+
|
|
19
|
+
Access path: indicators.volatility_clustering.change_point_probability
|
|
20
|
+
|
|
21
|
+
Computation: BOCPD (Bayesian Online Changepoint Detection)
|
|
22
|
+
- Input: sequence of log(volume) values, one per tick
|
|
23
|
+
- Model: Gaussian distribution with unknown mean and variance per run segment
|
|
24
|
+
- Hazard rate (prior probability of changepoint at any tick):
|
|
25
|
+
hazardPrior = 1/60 (prior: changepoints expected roughly every 60 ticks)
|
|
26
|
+
- Maximum run length tracked: 60 ticks
|
|
27
|
+
- At each tick, the algorithm maintains probability distributions over all
|
|
28
|
+
possible run lengths (0 to max_run). It updates these probabilities with
|
|
29
|
+
the new observed log-volume using Bayesian Gaussian likelihood.
|
|
30
|
+
- changePointProbability = P(a changepoint occurred at this tick)
|
|
31
|
+
= marginalized probability that the current run length is 0 or very short.
|
|
32
|
+
|
|
33
|
+
Interpretation: This indicator answers "Has the volume regime just shifted?"
|
|
34
|
+
High probability means the current volume level is inconsistent with the
|
|
35
|
+
volume pattern from the past N ticks and is likely a new regime.
|
|
36
|
+
|
|
37
|
+
--------------------------------------------------------------------------------
|
|
38
|
+
RANGE INTERPRETATION
|
|
39
|
+
--------------------------------------------------------------------------------
|
|
40
|
+
value > 0.7
|
|
41
|
+
Strong evidence of a volume regime change at this tick. The volume level
|
|
42
|
+
is inconsistent with the recent run and is likely a new distributional
|
|
43
|
+
regime. This could be:
|
|
44
|
+
- Volume surging (breakout initiation, news, large order)
|
|
45
|
+
- Volume collapsing (end of a high-volume period)
|
|
46
|
+
Direction of the shift must be determined by comparing current activity
|
|
47
|
+
to prior activity_ratio or volatility_clustering levels.
|
|
48
|
+
|
|
49
|
+
value >= 0.5 AND value <= 0.7
|
|
50
|
+
Moderate evidence of a regime shift. Volume behavior is inconsistent
|
|
51
|
+
with the recent pattern but the signal is not definitive yet.
|
|
52
|
+
Monitor for next few ticks to confirm or deny.
|
|
53
|
+
|
|
54
|
+
value < 0.3
|
|
55
|
+
Low probability of a regime change. Volume is behaving consistently
|
|
56
|
+
with the recent run. No shift detected.
|
|
57
|
+
|
|
58
|
+
value ≈ 0.0
|
|
59
|
+
Baseline state. No evidence of a changepoint. Volume is in a stable
|
|
60
|
+
and consistent regime.
|
|
61
|
+
|
|
62
|
+
NOTE: The hazard prior of 1/60 means the algorithm expects a changepoint roughly
|
|
63
|
+
every 60 ticks on average. The algorithm will correctly produce P ≈ 0.017 at
|
|
64
|
+
every tick when volume is truly stable. Values meaningfully above 0.1 are already
|
|
65
|
+
notable; above 0.5 is a significant detection.
|
|
66
|
+
|
|
67
|
+
--------------------------------------------------------------------------------
|
|
68
|
+
COMMON SCENARIOS WHERE CHANGE POINT FIRES
|
|
69
|
+
--------------------------------------------------------------------------------
|
|
70
|
+
SCENARIO A: Volume explosion during consolidation
|
|
71
|
+
squeeze_energy > 10 (squeeze building)
|
|
72
|
+
AND change_point_probability > 0.5
|
|
73
|
+
→ Volume is shifting regime during a squeeze. Classic pre-breakout signal.
|
|
74
|
+
The squeeze energy is about to release.
|
|
75
|
+
|
|
76
|
+
SCENARIO B: Volume collapse after a spike
|
|
77
|
+
Prior activity_ratio was ACTIVE (>= 1.0)
|
|
78
|
+
AND change_point_probability > 0.6
|
|
79
|
+
AND current activity_ratio drops to MODERATE
|
|
80
|
+
→ The high-volume phase is ending. Momentum from the prior surge may fade.
|
|
81
|
+
|
|
82
|
+
SCENARIO C: Sudden volume shock
|
|
83
|
+
No prior squeeze building
|
|
84
|
+
AND change_point_probability > 0.75 in one tick
|
|
85
|
+
→ Sudden volume regime shift not preceded by buildup. Could be news,
|
|
86
|
+
large liquidation, or unusual market event. Treat as alert for
|
|
87
|
+
position risk management rather than a directional signal.
|
|
88
|
+
|
|
89
|
+
--------------------------------------------------------------------------------
|
|
90
|
+
INDICATOR RELATIONSHIPS
|
|
91
|
+
--------------------------------------------------------------------------------
|
|
92
|
+
indicators.volatility_clustering | CONTAINER
|
|
93
|
+
change_point_probability is the secondary output of the same computation
|
|
94
|
+
that provides volatility_clustering multiplier.
|
|
95
|
+
Read both together: clustering tells you current volume level relative
|
|
96
|
+
to history; change_point indicates whether that level has SHIFTED.
|
|
97
|
+
|
|
98
|
+
IF volatility_clustering >= 1.2 AND change_point_probability > 0.5
|
|
99
|
+
→ Not only is volume elevated, but the elevation is a NEW regime.
|
|
100
|
+
This combination is stronger than either alone.
|
|
101
|
+
|
|
102
|
+
indicators.squeeze_energy | ALERT PAIR
|
|
103
|
+
IF squeeze_energy > 5 AND change_point_probability > 0.5
|
|
104
|
+
→ Compressed market with a volume regime shift. Highest-priority
|
|
105
|
+
breakout alerting condition.
|
|
106
|
+
|
|
107
|
+
indicators.activity_ratio | CONTEXT
|
|
108
|
+
change_point_probability does not tell you whether the regime shifted
|
|
109
|
+
to more or less volume. Use activity_ratio.active and activity_ratio
|
|
110
|
+
thresholds to determine direction of the volume shift.
|
|
111
|
+
|
|
112
|
+
indicators.market_structure | CONTEXT
|
|
113
|
+
If market_structure transitions to BREAKING_UP or CONFIRMED_BREAK_UP
|
|
114
|
+
simultaneously with change_point_probability > 0.5, the breakout has
|
|
115
|
+
both structural and volume regime confirmation.
|
|
116
|
+
|
|
117
|
+
indicators.hmi_velocity | COMPANION
|
|
118
|
+
If a volume regime shift occurs AND hmi_velocity is strongly positive,
|
|
119
|
+
it suggests the new volume regime is supporting a directional move,
|
|
120
|
+
not just noise.
|
|
121
|
+
|
|
122
|
+
--------------------------------------------------------------------------------
|
|
123
|
+
DEPENDENCY ORDER
|
|
124
|
+
--------------------------------------------------------------------------------
|
|
125
|
+
1 Read volatility_clustering.change_point_probability.
|
|
126
|
+
2 If above 0.5: check activity_ratio to determine if volume is rising or falling.
|
|
127
|
+
3 If above 0.5: check squeeze_energy for pre-existing compression.
|
|
128
|
+
4 If above 0.5: check market_structure for structural breakout context.
|
|
129
|
+
5 Highest-confidence breakout condition: squeeze_energy + change_point_probability + market_structure all elevated.
|
|
130
|
+
|
|
131
|
+
--------------------------------------------------------------------------------
|
|
132
|
+
INVALIDATION CONDITIONS
|
|
133
|
+
--------------------------------------------------------------------------------
|
|
134
|
+
IF market is in first 60 ticks since startup or data reset
|
|
135
|
+
→ BOCPD run-length model requires warmup. Probabilities will be
|
|
136
|
+
unreliable until 60-tick window has filled.
|
|
137
|
+
|
|
138
|
+
--------------------------------------------------------------------------------
|
|
139
|
+
ANTI-PATTERNS — DETECTABLE MISUSE CONDITIONS
|
|
140
|
+
--------------------------------------------------------------------------------
|
|
141
|
+
IF change_point_probability > 0.5 is used as a directional signal
|
|
142
|
+
→ INCORRECT. BOCPD detects WHEN a regime shift occurred, not the
|
|
143
|
+
direction of the shift. A volume changepoint can be a surge OR
|
|
144
|
+
a collapse. Use activity_ratio to determine which direction.
|
|
145
|
+
|
|
146
|
+
IF this indicator is treated as a standalone indicator accessible at a
|
|
147
|
+
top-level data path
|
|
148
|
+
→ ACCESS PATTERN ERROR. This field is embedded within the
|
|
149
|
+
volatility_clustering output object. Access via:
|
|
150
|
+
indicators.volatility_clustering.change_point_probability
|
|
151
|
+
There is no standalone "indicators.volume_change_point" field.
|
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
================================================================================
|
|
2
|
+
INDICATOR: VWAP — VOLUME WEIGHTED AVERAGE PRICE
|
|
3
|
+
================================================================================
|
|
4
|
+
id: vwap
|
|
5
|
+
data_field: indicators.vwap
|
|
6
|
+
type: PRICE LEVEL (same units as current price)
|
|
7
|
+
range: Positive real number; tracks price closely
|
|
8
|
+
precision: Asset tick size
|
|
9
|
+
update_rate: per_tick (recalculates with each new 1m candle)
|
|
10
|
+
latency_profile: SLOW — computed from rolling 7-day 1m candle history
|
|
11
|
+
|
|
12
|
+
--------------------------------------------------------------------------------
|
|
13
|
+
CONSTRUCT
|
|
14
|
+
--------------------------------------------------------------------------------
|
|
15
|
+
VWAP is the volume-weighted average of the typical price over all available
|
|
16
|
+
1-minute candles (approximately 7 days, ~10,080 candles).
|
|
17
|
+
|
|
18
|
+
For each candle:
|
|
19
|
+
typicalPrice = (high + low + close) / 3
|
|
20
|
+
|
|
21
|
+
Cumulative computation:
|
|
22
|
+
cumulativeTPV = Σ(typicalPrice × volume) over all candles
|
|
23
|
+
cumulativeVol = Σ(volume) over all candles
|
|
24
|
+
vwap = cumulativeTPV / cumulativeVol
|
|
25
|
+
|
|
26
|
+
Also computed from the same pass (for use in vwap_zscore):
|
|
27
|
+
variance = (Σ(typicalPrice² × volume) / totalVol) - vwap²
|
|
28
|
+
stdDev = sqrt(max(variance, 0))
|
|
29
|
+
|
|
30
|
+
Additional outputs from the same VWAP computation:
|
|
31
|
+
indicators.vwap_upper_band_1 = vwap + 1 × stdDev
|
|
32
|
+
indicators.vwap_lower_band_1 = vwap - 1 × stdDev
|
|
33
|
+
indicators.vwap_upper_band_2 = vwap + 2 × stdDev
|
|
34
|
+
indicators.vwap_lower_band_2 = vwap - 2 × stdDev
|
|
35
|
+
|
|
36
|
+
vwap represents the AVERAGE COST of all participants (weighted by volume)
|
|
37
|
+
over the rolling 7-day window. It serves as an anchor price level reflecting
|
|
38
|
+
institutional cost basis. Price trading above VWAP indicates current buyers
|
|
39
|
+
are paying above the average historical cost. Below VWAP indicates buyers
|
|
40
|
+
have an advantage relative to recent average cost.
|
|
41
|
+
|
|
42
|
+
--------------------------------------------------------------------------------
|
|
43
|
+
INTERPRETATION: VWAP AS A PRICE LEVEL
|
|
44
|
+
--------------------------------------------------------------------------------
|
|
45
|
+
price > vwap
|
|
46
|
+
Current price above the 7-day volume-weighted average. Short-term price
|
|
47
|
+
action is at a premium to the rolling cost basis. Often a sign of bullish
|
|
48
|
+
positioning but also means buyers are paying above average costs.
|
|
49
|
+
|
|
50
|
+
price ≈ vwap (within 0.3% or one standard deviation)
|
|
51
|
+
Price is at or near the volume-weighted cost basis. This level acts as a
|
|
52
|
+
fair value anchor. Significant trading activity tends to occur near VWAP.
|
|
53
|
+
|
|
54
|
+
price < vwap
|
|
55
|
+
Current price below the 7-day volume-weighted average. Price is at a
|
|
56
|
+
discount relative to rolling cost basis. May reflect capitulation or
|
|
57
|
+
bearish positioning.
|
|
58
|
+
|
|
59
|
+
price > vwap_upper_band_2
|
|
60
|
+
Price is more than 2 standard deviations above VWAP. Historically extended
|
|
61
|
+
relative to volume-weighted activity. Check vwap_zscore for numeric
|
|
62
|
+
deviation and bayesian_overbought for RSI context.
|
|
63
|
+
|
|
64
|
+
price < vwap_lower_band_2
|
|
65
|
+
Price is more than 2 standard deviations below VWAP. Historically extended
|
|
66
|
+
below volume-weighted activity. Potential mean-reversion zone.
|
|
67
|
+
|
|
68
|
+
--------------------------------------------------------------------------------
|
|
69
|
+
IMPORTANT NOTES ON VWAP AT 7-DAY WINDOW
|
|
70
|
+
--------------------------------------------------------------------------------
|
|
71
|
+
# vwap here is NOT a session VWAP (intraday only). It uses 7 days of data.
|
|
72
|
+
# This makes it a medium-term cost basis, not an intraday anchor.
|
|
73
|
+
# Differences from traditional session VWAP:
|
|
74
|
+
# - Reacts slowly to price moves (large denominator from 7 days)
|
|
75
|
+
# - Represents multi-day positioning cost, not single-session cost
|
|
76
|
+
# - Standard deviation bands are wider due to multi-day price range
|
|
77
|
+
# - Best used for identifying price extensions vs medium-term fair value
|
|
78
|
+
|
|
79
|
+
--------------------------------------------------------------------------------
|
|
80
|
+
INDICATOR RELATIONSHIPS
|
|
81
|
+
--------------------------------------------------------------------------------
|
|
82
|
+
indicators.vwap_zscore | REQUIRED_COMPANION
|
|
83
|
+
vwap alone tells you the level; vwap_zscore tells you how far price
|
|
84
|
+
has deviated in statistical terms. Read vwap_zscore alongside vwap.
|
|
85
|
+
|
|
86
|
+
indicators.poc | CONTEXT
|
|
87
|
+
VWAP (time-volume weighted average) and POC (highest-volume price level)
|
|
88
|
+
are both volume-anchored references but can diverge during trending periods.
|
|
89
|
+
IF vwap significantly above POC: multi-day cost basis above the highest-
|
|
90
|
+
activity price level — area between is a high-significance range.
|
|
91
|
+
IF price is between vwap and POC: in the strongest support/resistance zone.
|
|
92
|
+
|
|
93
|
+
indicators.support / indicators.resistance | CONTEXT
|
|
94
|
+
Support levels that coincide with VWAP carry higher significance.
|
|
95
|
+
If price tests VWAP from above and it aligns with a strong support
|
|
96
|
+
level, both computations independently support the same level.
|
|
97
|
+
|
|
98
|
+
indicators.hurst_exponent | COMPANION FOR MEAN-REVERSION
|
|
99
|
+
IF hurst < 0.4 AND price > vwap_upper_band_2
|
|
100
|
+
→ Statistical mean-reversion tendency PLUS price extended above VWAP.
|
|
101
|
+
Two independent factors suggest reversion toward VWAP.
|
|
102
|
+
|
|
103
|
+
--------------------------------------------------------------------------------
|
|
104
|
+
DEPENDENCY ORDER
|
|
105
|
+
--------------------------------------------------------------------------------
|
|
106
|
+
1 Compare current price to vwap level.
|
|
107
|
+
2 Compare to ±1σ and ±2σ bands.
|
|
108
|
+
3 Read vwap_zscore for standardized deviation.
|
|
109
|
+
4 Note alignment with support/resistance and POC levels.
|
|
110
|
+
|
|
111
|
+
--------------------------------------------------------------------------------
|
|
112
|
+
INVALIDATION CONDITIONS
|
|
113
|
+
--------------------------------------------------------------------------------
|
|
114
|
+
IF no 1m candle history is available
|
|
115
|
+
→ VWAP cannot be computed. Treat as unavailable on market open or
|
|
116
|
+
after a data gap.
|
|
117
|
+
|
|
118
|
+
IF volume data has gaps (some candles have zero volume)
|
|
119
|
+
→ VWAP may be skewed. The internal computation handles zero-volume
|
|
120
|
+
candles but extended gaps reduce reliability.
|
|
121
|
+
|
|
122
|
+
--------------------------------------------------------------------------------
|
|
123
|
+
ANTI-PATTERNS — DETECTABLE MISUSE CONDITIONS
|
|
124
|
+
--------------------------------------------------------------------------------
|
|
125
|
+
IF using vwap as an intraday fairness anchor only
|
|
126
|
+
→ SCOPE MISMATCH. This VWAP is 7 days. Single-session fair value
|
|
127
|
+
may differ significantly from this VWAP, especially after large
|
|
128
|
+
gap opens or multi-day trend moves.
|
|
129
|
+
|
|
130
|
+
IF VWAP crossover is used as a trade signal
|
|
131
|
+
→ VWAP is a reference level, not a momentum indicator. Crossovers on a
|
|
132
|
+
7-day VWAP are not meaningful as short-term entry signals.
|
|
133
|
+
Use regime or MACD for directional signals.
|
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
================================================================================
|
|
2
|
+
INDICATOR: VWAP_ZSCORE — VWAP Z-SCORE
|
|
3
|
+
================================================================================
|
|
4
|
+
id: vwap_zscore
|
|
5
|
+
data_field: indicators.vwap_zscore
|
|
6
|
+
type: NUMERIC
|
|
7
|
+
range: Unbounded; typical practical range -4.0 to +4.0
|
|
8
|
+
precision: 3 decimal places
|
|
9
|
+
update_rate: per_tick
|
|
10
|
+
latency_profile: SLOW (inherits VWAP's 7-day window sluggishness)
|
|
11
|
+
|
|
12
|
+
--------------------------------------------------------------------------------
|
|
13
|
+
CONSTRUCT
|
|
14
|
+
--------------------------------------------------------------------------------
|
|
15
|
+
vwap_zscore expresses how many standard deviations the current price is from
|
|
16
|
+
the 7-day VWAP.
|
|
17
|
+
|
|
18
|
+
Formula:
|
|
19
|
+
vwap_zscore = (currentPrice - vwap) / stdDev
|
|
20
|
+
|
|
21
|
+
Where stdDev is computed from the same 7-day candle history:
|
|
22
|
+
variance = (Σ(typicalPrice² × volume) / totalVol) - vwap²
|
|
23
|
+
stdDev = sqrt(max(variance, 0))
|
|
24
|
+
|
|
25
|
+
This is a volume-weighted standard deviation, not a simple price standard
|
|
26
|
+
deviation. It weights the dispersion more heavily toward price levels that
|
|
27
|
+
traded with more volume.
|
|
28
|
+
|
|
29
|
+
Threshold modulation by volatility_clustering:
|
|
30
|
+
The standard thresholds (below) are internally scaled by volcMultiplier,
|
|
31
|
+
where volcMultiplier is clamped from indicators.volatility_clustering
|
|
32
|
+
(range 0.6-2.0 based on that indicator's output).
|
|
33
|
+
|
|
34
|
+
In high-volatility-clustering conditions, the band thresholds expand,
|
|
35
|
+
meaning larger deviations are required to reach the same "extreme" label.
|
|
36
|
+
In low-volatility conditions, thresholds compress.
|
|
37
|
+
|
|
38
|
+
Base thresholds (before volatility scaling):
|
|
39
|
+
> +2.0 → FAR_ABOVE
|
|
40
|
+
+0.5 to +2.0 → ABOVE
|
|
41
|
+
-0.5 to +0.5 → AT_VWAP
|
|
42
|
+
-2.0 to -0.5 → BELOW
|
|
43
|
+
< -2.0 → FAR_BELOW
|
|
44
|
+
|
|
45
|
+
--------------------------------------------------------------------------------
|
|
46
|
+
RANGE INTERPRETATION
|
|
47
|
+
--------------------------------------------------------------------------------
|
|
48
|
+
value > 2.0
|
|
49
|
+
Price is significantly above the 7-day volume-weighted cost basis —
|
|
50
|
+
more than 2 standard deviations above VWAP. This level is historically
|
|
51
|
+
rare during the 7-day window. Associated with extended bullish states or
|
|
52
|
+
momentum breakouts. Mean-reversion risk is elevated when other momentum
|
|
53
|
+
indicators also show fatigue.
|
|
54
|
+
|
|
55
|
+
value >= 0.5 AND value <= 2.0
|
|
56
|
+
Price is above VWAP and within 2 standard deviations. Constructive
|
|
57
|
+
for bulls — price is pricier than the rolling average but not at
|
|
58
|
+
statistical extremes.
|
|
59
|
+
|
|
60
|
+
value > -0.5 AND value < 0.5
|
|
61
|
+
Price is near VWAP — at the volume-weighted fair value anchor.
|
|
62
|
+
Neutral positioning. Neither bulls nor bears have a strong cost basis
|
|
63
|
+
advantage at current price.
|
|
64
|
+
|
|
65
|
+
value >= -2.0 AND value <= -0.5
|
|
66
|
+
Price is below VWAP. Bears hold the cost basis advantage. Downside
|
|
67
|
+
conditions are in effect but not at statistical extremes.
|
|
68
|
+
|
|
69
|
+
value < -2.0
|
|
70
|
+
Price is significantly below VWAP. Extended bearish territory.
|
|
71
|
+
Mirror of > 2.0. Mean-reversion risk from the downside is elevated
|
|
72
|
+
when combined with oversold RSI or bullish divergence conditions.
|
|
73
|
+
|
|
74
|
+
--------------------------------------------------------------------------------
|
|
75
|
+
INDICATOR RELATIONSHIPS
|
|
76
|
+
--------------------------------------------------------------------------------
|
|
77
|
+
indicators.vwap | REQUIRED_COMPANION
|
|
78
|
+
vwap_zscore is meaningless without knowing the absolute VWAP level.
|
|
79
|
+
Reference vwap (price level) alongside the z-score for context.
|
|
80
|
+
|
|
81
|
+
indicators.bayesian_overbought | CROSS_VALIDATE FOR EXTENDED STATES
|
|
82
|
+
IF vwap_zscore > 2.0 AND bayesian_overbought > 0.88
|
|
83
|
+
→ Price is far above VWAP AND the RSI reading is in the top percentile
|
|
84
|
+
of recent history. Both independent metrics agree price is historically
|
|
85
|
+
extended upward. Highest compound warning for upside mean-reversion risk.
|
|
86
|
+
|
|
87
|
+
IF vwap_zscore < -2.0 AND bayesian_overbought < 0.12
|
|
88
|
+
→ Mirror: price far below VWAP + RSI at recent historical bottom.
|
|
89
|
+
Highest compound signal for downside mean-reversion risk.
|
|
90
|
+
|
|
91
|
+
indicators.support / indicators.resistance | CONTEXT
|
|
92
|
+
A support level that coincides with VWAP has dual anchoring — it is both
|
|
93
|
+
a frequently-tested price level AND the volume-weighted cost basis.
|
|
94
|
+
vwap_zscore near 0 will often coincide with active support/resistance zones.
|
|
95
|
+
|
|
96
|
+
indicators.hfi | CONTEXT
|
|
97
|
+
HFI captures funding/OI/CVD-based sentiment.
|
|
98
|
+
IF vwap_zscore > 2.0 AND hfi > 30
|
|
99
|
+
→ Price far extended above VWAP WITH positive funding/OI positioning.
|
|
100
|
+
Both price and derivatives market are bullish and extended.
|
|
101
|
+
Elevated risk if HFI reverses (funding flips negative).
|
|
102
|
+
|
|
103
|
+
indicators.volatility_clustering | ADJUSTS INTERPRETATION
|
|
104
|
+
This indicator modulates vwap_zscore thresholds internally.
|
|
105
|
+
In high volatility-clustering periods, the "extreme" bands widen.
|
|
106
|
+
Be aware that the same z-score number means different things under
|
|
107
|
+
different volatility clustering conditions.
|
|
108
|
+
|
|
109
|
+
indicators.hurst_exponent | COMPANION FOR MEAN REVERSION
|
|
110
|
+
IF hurst < 0.4 AND |vwap_zscore| > 2.0
|
|
111
|
+
→ Price extended beyond 2σ in a historically mean-reverting asset.
|
|
112
|
+
Two independent factors both favor a return toward VWAP.
|
|
113
|
+
|
|
114
|
+
indicators.poc_distance | CONTEXT
|
|
115
|
+
IF vwap_zscore > 2.0 AND poc_distance > 3.0
|
|
116
|
+
→ Price is both above VWAP (cost basis) and far above the Point of
|
|
117
|
+
Control (highest-volume price). Double extension signal.
|
|
118
|
+
|
|
119
|
+
indicators.regime | CONTEXT
|
|
120
|
+
During CASCADE/PARABOLIC: vwap_zscore can sustain high values for extended
|
|
121
|
+
periods. Do not use FAR_ABOVE as a mean-reversion trigger in these regimes.
|
|
122
|
+
During CHOP/CONSOL: FAR ABOVE/BELOW is a stronger mean-reversion signal
|
|
123
|
+
as there is no trend to sustain the extension.
|
|
124
|
+
|
|
125
|
+
--------------------------------------------------------------------------------
|
|
126
|
+
DEPENDENCY ORDER
|
|
127
|
+
--------------------------------------------------------------------------------
|
|
128
|
+
1 Read vwap_zscore and range bucket.
|
|
129
|
+
2 If |value| > 2.0: note regime — in trending regimes (CASCADE/BREAKOUT),
|
|
130
|
+
large z-scores may persist rather than mean-revert.
|
|
131
|
+
3 If |value| > 2.0: cross-validate with bayesian_overbought.
|
|
132
|
+
4 Mean-reversion context: add hurst_exponent and support/resistance.
|
|
133
|
+
|
|
134
|
+
--------------------------------------------------------------------------------
|
|
135
|
+
INVALIDATION CONDITIONS
|
|
136
|
+
--------------------------------------------------------------------------------
|
|
137
|
+
IF vwap is not available (insufficient candle history): discard.
|
|
138
|
+
|
|
139
|
+
IF stdDev ≈ 0 (near constant-price period)
|
|
140
|
+
→ z-score becomes unstable. Check if asset is temporarily illiquid.
|
|
141
|
+
Use activity_ratio to detect.
|
|
142
|
+
|
|
143
|
+
--------------------------------------------------------------------------------
|
|
144
|
+
ANTI-PATTERNS — DETECTABLE MISUSE CONDITIONS
|
|
145
|
+
--------------------------------------------------------------------------------
|
|
146
|
+
IF vwap_zscore > 2.0 is automatically treated as a short entry signal
|
|
147
|
+
→ INCORRECT USE. Extended z-scores can persist in strong trends.
|
|
148
|
+
In CASCADE regimes, z-score > 3.0 is a continuation signal, not
|
|
149
|
+
a reversal signal. Gate by regime first.
|
|
150
|
+
|
|
151
|
+
IF threshold values are compared without adjusting for volatility_clustering
|
|
152
|
+
→ INCOMPLETE. vwap_zscore thresholds are dynamically adjusted by
|
|
153
|
+
volatility_clustering multiplier. The same absolute z-score number
|
|
154
|
+
means different things in high vs low clustering environments.
|
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
================================================================================
|
|
2
|
+
INDICATOR: WEIGHTED_RSI — MULTI-TIMEFRAME WEIGHTED RSI (OBOS)
|
|
3
|
+
================================================================================
|
|
4
|
+
id: weighted_rsi
|
|
5
|
+
data_field: indicators.weighted_rsi
|
|
6
|
+
type: NUMERIC
|
|
7
|
+
range: 0.0 to 100.0
|
|
8
|
+
precision: 2 decimal places
|
|
9
|
+
update_rate: per_tick
|
|
10
|
+
latency_profile: COINCIDENT
|
|
11
|
+
|
|
12
|
+
--------------------------------------------------------------------------------
|
|
13
|
+
CONSTRUCT
|
|
14
|
+
--------------------------------------------------------------------------------
|
|
15
|
+
weighted_rsi is a multi-timeframe RSI that blends RSI readings across all 12
|
|
16
|
+
timeframes into a single number, applying exponential decay weights that
|
|
17
|
+
heavily favor shorter timeframes but retain longer-TF context.
|
|
18
|
+
|
|
19
|
+
Per-timeframe weights (exponential decay):
|
|
20
|
+
1m: 1.00 | 3m: 0.80 | 5m: 0.64 | 15m: 0.51 | 30m: 0.41 | 1h: 0.33
|
|
21
|
+
2h: 0.26 | 4h: 0.21 | 6h: 0.17 | 8h: 0.13 | 12h: 0.11 | 24h: 0.08
|
|
22
|
+
|
|
23
|
+
RSI computation per TF:
|
|
24
|
+
avgGain = average of positive changes over window
|
|
25
|
+
avgLoss = average of |negative| changes over window
|
|
26
|
+
rs = (avgGain + 0.001) / (avgLoss + 0.001) [epsilon prevents division by zero]
|
|
27
|
+
rsi_tf = 100 - 100 / (1 + rs)
|
|
28
|
+
|
|
29
|
+
Weighted composite:
|
|
30
|
+
value = Σ(rsi_tf × weight) / Σ(weight) before EWMA smoothing
|
|
31
|
+
|
|
32
|
+
EWMA smoothing applied:
|
|
33
|
+
smoothedValue = alpha × raw + (1 - alpha) × prevSmoothed (alpha = 0.3)
|
|
34
|
+
|
|
35
|
+
Dead zone: if total price movement across all TFs < 0.01, returns smoothed 50.
|
|
36
|
+
|
|
37
|
+
The 1m timeframe has by far the largest weight (1.00 vs 0.08 for 24h), meaning
|
|
38
|
+
shorter-term RSI conditions dominate this indicator. Long-TF RSI context
|
|
39
|
+
contributes but takes many ticks to shift the composite materially.
|
|
40
|
+
|
|
41
|
+
--------------------------------------------------------------------------------
|
|
42
|
+
RANGE INTERPRETATION
|
|
43
|
+
--------------------------------------------------------------------------------
|
|
44
|
+
value >= 80
|
|
45
|
+
Heavily overbought across the short-TF stack. Short-term RSI conditions
|
|
46
|
+
are at extreme levels. Upward momentum has been very strong in recent
|
|
47
|
+
bar-by-bar changes. Historically associated with short-TF exhaustion or
|
|
48
|
+
continuation after high-momentum breakouts.
|
|
49
|
+
|
|
50
|
+
value >= 70 AND value < 80
|
|
51
|
+
Overbought zone. Short-to-medium TF RSIs are elevated. Upside momentum
|
|
52
|
+
is stretched. Does not indicate a reversal but does indicate momentum
|
|
53
|
+
sustainability is reduced. Use Bayesian P(Overbought) to assess vs
|
|
54
|
+
historical percentile.
|
|
55
|
+
|
|
56
|
+
value >= 55 AND value < 70
|
|
57
|
+
Mild upside bias. RSI conditions favor the upside but without extremity.
|
|
58
|
+
Momentum is present without being stretched. Constructive environment
|
|
59
|
+
for upside continuation from a momentum standpoint.
|
|
60
|
+
|
|
61
|
+
value >= 45 AND value < 55
|
|
62
|
+
Neutral. Balanced buy/sell pressure in RSI terms. No directional bias
|
|
63
|
+
from momentum at the cross-TF level. Check other indicators for direction.
|
|
64
|
+
|
|
65
|
+
value >= 30 AND value < 45
|
|
66
|
+
Mild downside bias. Short-TF RSI slightly favors the downside.
|
|
67
|
+
Some downside momentum present.
|
|
68
|
+
|
|
69
|
+
value >= 20 AND value < 30
|
|
70
|
+
Oversold zone. Short-to-medium TF RSIs are depressed. Downside momentum
|
|
71
|
+
is stretched. Does not indicate a reversal but does indicate downside
|
|
72
|
+
sustainability is reduced.
|
|
73
|
+
|
|
74
|
+
value < 20
|
|
75
|
+
Heavily oversold. Extreme downside RSI across the short-TF stack.
|
|
76
|
+
Mirror of >= 80 upside interpretation.
|
|
77
|
+
|
|
78
|
+
--------------------------------------------------------------------------------
|
|
79
|
+
RELATED FIELDS THAT SHARE THIS COMPUTATION
|
|
80
|
+
--------------------------------------------------------------------------------
|
|
81
|
+
indicators.rsi_divergence
|
|
82
|
+
Computed within the same OBOS system. Detects divergence between
|
|
83
|
+
price slope and OBOS (weighted_rsi) slope. See rsi_divergence.txt.
|
|
84
|
+
|
|
85
|
+
indicators.bayesian_overbought
|
|
86
|
+
Uses this same weighted_rsi value to compute an empirical percentile
|
|
87
|
+
over a 60-observation rolling window. See bayesian_overbought.txt.
|
|
88
|
+
|
|
89
|
+
--------------------------------------------------------------------------------
|
|
90
|
+
INDICATOR RELATIONSHIPS
|
|
91
|
+
--------------------------------------------------------------------------------
|
|
92
|
+
indicators.bayesian_overbought | REQUIRED_COMPANION
|
|
93
|
+
weighted_rsi alone cannot distinguish whether "overbought" at 75 is
|
|
94
|
+
historically extreme or normal for this asset.
|
|
95
|
+
Check bayesian_overbought alongside weighted_rsi.
|
|
96
|
+
IF weighted_rsi >= 70 AND bayesian_overbought >= 0.9
|
|
97
|
+
→ Confirmed overbought: reading is both extreme in absolute terms
|
|
98
|
+
AND at the high end of the asset's recent history.
|
|
99
|
+
IF weighted_rsi >= 70 AND bayesian_overbought = 0.6
|
|
100
|
+
→ RSI is elevated but historically common for this asset.
|
|
101
|
+
Less likely to produce a mean-reversion response.
|
|
102
|
+
|
|
103
|
+
indicators.rsi_divergence | CONTEXT
|
|
104
|
+
Divergence is meaningful only when weighted_rsi approaches extremes.
|
|
105
|
+
IF weighted_rsi < 40 AND rsi_divergence = BULLISH_DIVERGENCE
|
|
106
|
+
→ Price making lower lows but oversold RSI is improving. Monitors
|
|
107
|
+
a potential momentum shift from downside.
|
|
108
|
+
|
|
109
|
+
indicators.hmi | CROSS_VALIDATE
|
|
110
|
+
HMI is weighted toward medium TFs (1h carries more than 1m alone).
|
|
111
|
+
weighted_rsi is weighted toward the shortest TFs.
|
|
112
|
+
Agreement between high hmi and elevated weighted_rsi is normal.
|
|
113
|
+
Divergence (high hmi, low weighted_rsi or vice versa) indicates the
|
|
114
|
+
two timeframe bands are moving differently.
|
|
115
|
+
|
|
116
|
+
indicators.regime | GATE
|
|
117
|
+
IF regime = CHOP: weighted_rsi near 50 is expected. No signal.
|
|
118
|
+
|
|
119
|
+
--------------------------------------------------------------------------------
|
|
120
|
+
DEPENDENCY ORDER
|
|
121
|
+
--------------------------------------------------------------------------------
|
|
122
|
+
1 Regime/activity gate: if CHOP or activity_ratio < 0.5, discard.
|
|
123
|
+
2 Read value and range bucket.
|
|
124
|
+
3 Frame with bayesian_overbought for historical percentile context.
|
|
125
|
+
4 Check rsi_divergence if value is above 65 or below 35.
|
|
126
|
+
|
|
127
|
+
--------------------------------------------------------------------------------
|
|
128
|
+
INVALIDATION CONDITIONS
|
|
129
|
+
--------------------------------------------------------------------------------
|
|
130
|
+
IF activity_ratio < 0.5
|
|
131
|
+
→ Very low volume makes RSI calculations unreliable. Discard.
|
|
132
|
+
|
|
133
|
+
IF value is exactly 50.0 in a moving market
|
|
134
|
+
→ Likely dead zone trigger (total movement < 0.01). Treat as INDETERMINATE.
|
|
135
|
+
|
|
136
|
+
--------------------------------------------------------------------------------
|
|
137
|
+
ANTI-PATTERNS — DETECTABLE MISUSE CONDITIONS
|
|
138
|
+
--------------------------------------------------------------------------------
|
|
139
|
+
IF weighted_rsi >= 70 is used as a reversal signal
|
|
140
|
+
→ INCORRECT USE. RSI overbought is a caution signal, not a reversal
|
|
141
|
+
trigger. During strong trending markets, weighted_rsi can hold above
|
|
142
|
+
70 for many consecutive ticks. Combine with bayesian_overbought and
|
|
143
|
+
regime to assess whether reversal probability is meaningful.
|
|
144
|
+
|
|
145
|
+
IF weighted_rsi smoothing lag is ignored in fast markets
|
|
146
|
+
→ EWMA alpha=0.3 provides meaningful smoothing. Rapid price moves
|
|
147
|
+
will not immediately push weighted_rsi to extremes. Regime and
|
|
148
|
+
vwap_zscore may react faster to sudden moves than weighted_rsi.
|