โš–๏ธ Strictly AS-IS Archival Documentation: Provided free of charge under the MIT License without warranty, financial/gambling advice, or technical support of any kind.

๐Ÿ”ฎ TITAN ORACLE โ€” Complete Technical Documentation

Disclaimer: Educational and research material only โ€” not financial or investment advice. Trading involves substantial risk of loss; past or simulated results do not indicate future results. Titan HFT is provided AS-IS, with no liability and no support. No API keys are included.

Guide to the 7-Layer Predictive Indicator

TITAN ORACLE is a predictive super-indicator that combines 7 advanced mathematical algorithms into a single score (oracle_score) ranging from -100 to +100. Unlike traditional indicators (EMA, RSI, MACD), which are lagging (they look at the past), TITAN ORACLE is leading โ€” it forecasts what comes next.


General Architecture

โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚                         INPUT DATA                              โ”‚
โ”‚            candles[] โ†’ close, high, low, volume                 โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
                      โ”‚
    โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
    โ–ผ                 โ–ผ                 โ–ผ
โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”      โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”     โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚ LAYER 1โ”‚      โ”‚ LAYER 2  โ”‚     โ”‚ LAYER 3  โ”‚
โ”‚ Kalman โ”‚      โ”‚ Entropy  โ”‚     โ”‚  Hurst   โ”‚
โ”‚ Filter โ”‚      โ”‚  Flow    โ”‚     โ”‚ Exponent โ”‚
โ””โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”˜      โ””โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”˜     โ””โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”˜
    โ”‚                โ”‚                โ”‚
    โ–ผ                โ–ผ                โ–ผ
โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”      โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”     โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”     โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚ LAYER 4โ”‚      โ”‚ LAYER 5  โ”‚     โ”‚ LAYER 6  โ”‚     โ”‚ LAYER 7  โ”‚
โ”‚Lyapunovโ”‚      โ”‚ Wavelet  โ”‚     โ”‚  VPIN    โ”‚     โ”‚Changepointโ”‚
โ”‚ Chaos  โ”‚      โ”‚ Denoise  โ”‚     โ”‚  Volume  โ”‚     โ”‚ Bayesian โ”‚
โ””โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”˜      โ””โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”˜     โ””โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”˜     โ””โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”˜
    โ”‚                โ”‚                โ”‚                 โ”‚
    โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
                     โ–ผ
            โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
            โ”‚  FUSION LAYER  โ”‚
            โ”‚  Adaptive      โ”‚
            โ”‚  Weights       โ”‚
            โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
                    โ–ผ
         oracle_score [-100, +100]
         confidence   [0.0, 1.0]
         regime: Trending/MeanReverting/Chaotic

LAYER 1: Kalman Filter (Kalman Adaptive Predictor)

What does it do?

It predicts the future price and the rate of change of the price. The Kalman filter is used in missile guidance, GPS and autopilots โ€” here we apply it to the market.

Mathematical Model

The system state is a 2D vector:

x = [price, velocity]

State Equation (Prediction):

x_predicted = F ยท x_previous

where the transition matrix F is:

F = | 1  dt |    (dt = 1 bar)
    | 0   1 |

This says: new_price = old_price + velocity ร— dt

Observation Equation (Correction):

z = H ยท x + noise

where H = [1, 0] (we observe only the price, not the velocity).

Kalman update in 5 steps:

  1. Predict State: xฬ‚ = F ยท x
  2. Predict Covariance: Pฬ‚ = F ยท P ยท Fแต€ + Q
  3. Kalman Gain: K = Pฬ‚ ยท Hแต€ ยท (H ยท Pฬ‚ ยท Hแต€ + R)โปยน
  4. Update State: x = xฬ‚ + K ยท (z - H ยท xฬ‚)
  5. Update Covariance: P = (I - K ยท H) ยท Pฬ‚

Parameters

ParameterValueDescription
Q (process noise)[[0.01, 0], [0, 0.01]]How much the market changes "internally"
R (measurement noise)1.0Observation noise (raw price)
Pโ‚€ (initial covariance)[[1, 0], [0, 1]]Initial uncertainty

Output

FieldTypeDescription
predicted_pricef64Predicted price for the next bar
predicted_velocityf64Rate of change (positive = rising, negative = falling)
uncertaintyf64Prediction uncertainty (P[0][0])

Trading Signal


LAYER 2: Shannon Entropy Flow Regime Detector

What does it do?

It detects the market regime: Trending, Mean Reverting or Chaotic. Shannon entropy measures the "disorder" of returns โ€” orderly (trending) markets have low entropy, chaotic ones have maximum entropy.

Mathematical Formula

1. Return Calculation:

r[i] = (close[i] - close[i-1]) / close[i-1]

2. Bin Distribution:

Returns are sorted into 10 bins (histogram). Shannon entropy:

H = -ฮฃ p(i) ยท logโ‚‚(p(i))    for all bins with p(i) > 0

where p(i) = probability of falling in bin i.

3. Normalisation:

H_normalized = H / logโ‚‚(num_bins)    โ†’ [0, 1]

4. Regime Detection via Autocorrelation:

autocorr = ฮฃ(r[i] ยท r[i-1]) / ฮฃ(r[i]ยฒ)

Parameters

ParameterValueDescription
window50Number of bars analysed
num_bins10Number of bins for the Shannon histogram
autocorr thresholdยฑ0.3Regime classification threshold

Output

FieldTypeDescription
entropyf64Normalised entropy [0, 1]
regimeMarketRegimeTrending / MeanReverting / Chaotic / Unknown
clarity_scoref641 - entropy (signal clarity)

LAYER 3: Hurst Exponent (Fractal Memory Analyzer)

What does it do?

It detects whether the market has memory (the trend will continue) or evolves randomly. It is based on R/S (Rescaled Range) analysis, invented by the hydrologist Harold Edwin Hurst.

Mathematical Formula

R/S (Rescaled Range) Method:

For each sub-series size n:

  1. Split the N-element series into sub-series of length n
  2. For each sub-series:
  1. Average R/S over all sub-series

Log-log regression:

log(R/S) = H ยท log(n) + c

The Hurst exponent H is the slope of the linear regression on the log-log scale.

Interpretation

HurstMeaning
H > 0.5Persistent โ€” the trend will continue
H = 0.5Random Walk โ€” no memory
H < 0.5Anti-persistent โ€” the trend will reverse

Signal

persistence_signal = (H - 0.5) ร— 2.0    โ†’ [-1, +1]

Multiplied by the direction of the most recent move:

Parameters

ParameterValueDescription
window128Maximum number of bars analysed
min_group_sizes[8, 16, 32, 64, 128]Sub-series sizes

LAYER 4: Lyapunov Exponent (Chaos Detector)

What does it do?

It measures how chaotic or predictable the market is. If similar trajectories diverge quickly โ†’ the market is chaotic and unpredictable. If they stay similar โ†’ the market is stable and predictable.

Mathematical Formula

1. Phase-space reconstruction (Takens' Theorem):

v[i] = [x[i], x[i+lag], x[i+2ยทlag], ..., x[i+(dim-1)ยทlag]]

with dim = 3, lag = 2

2. Nearest-neighbour search:

For each vector v[i], find the nearest neighbour v[j] (with a minimum temporal separation of 2 ร— lag):

dist_0 = ||v[i] - v[j]||โ‚‚    (Euclidean distance)

3. Divergence evolution:

Track how the distance evolves after k steps:

dist_k = ||v[i+k] - v[j+k]||โ‚‚

4. Lyapunov exponent:

ฮป = (1/N) ยท ฮฃ ln(dist_k / dist_0) / k

Interpretation

ฮปMeaning
ฮป > 0.05CHAOTIC โ€” predictions are unreliable
ฮป โ‰ˆ 0STABLE โ€” the market is predictable
ฮป < 0CONVERGENT โ€” highly predictable

Output

predictability = exp(-ฮป ร— 10).clamp(0, 1)

Parameters

ParameterValueDescription
embedding_dim3Phase-space dimension
lag2Embedding lag
evolution_steps5How many steps divergence is tracked

LAYER 5: Haar Wavelet Decomposition

What does it do?

It separates the price signal into a trend component (low frequency) and noise (high frequency). In effect it "denoises" the price, revealing the real trend hidden under the fluctuations.

Mathematical Formula

Haar transform at level l:

The signal is split recursively:

approx[i] = (signal[2i] + signal[2i+1]) / โˆš2    (approximation โ€” trend)
detail[i] = (signal[2i] - signal[2i+1]) / โˆš2     (detail โ€” noise)

This process is repeated over max_levels = min(6, logโ‚‚(N)) levels.

Reconstruction (Denoise):

The high-frequency details (first 2 levels) are zeroed and the inverse transform is applied:

signal_reconst[2i]     = (approx[i] + detail[i]) / โˆš2
signal_reconst[2i+1]   = (approx[i] - detail[i]) / โˆš2

Noise Ratio:

noise_ratio = (energy_detail_level_1 + energy_detail_level_2) / total_energy

where energy = ฮฃ d[i]ยฒ

Output

FieldTypeDescription
denoised_trendf64Denoised price (clean trend)
trend_directionf64Slope of the last 5 denoised values
dominant_cycleusizeDominant cycle (2^level)
noise_ratiof64Proportion of noise [0, 1]

LAYER 6: VPIN (Volume-Synchronized Probability of Informed Trading)

What does it do?

It detects smart money (informed) activity. High VPIN = someone with privileged information is trading aggressively. Developed at Cornell University for flash-crash detection.

Mathematical Formula

1. Volume classification (Bulk Volume Classification):

buy_fraction = (close - low) / (high - low)
buy_volume = volume ร— buy_fraction
sell_volume = volume ร— (1 - buy_fraction)

2. Volume Buckets:

Total volume is split into n_buckets equal buckets:

bucket_volume = total_volume / n_buckets

Each bucket accumulates buy and sell volume until it is full.

3. VPIN Calculation:

VPIN = ฮฃ|buy_bucket[i] - sell_bucket[i]| / ฮฃ(buy_bucket[i] + sell_bucket[i])

over the last n_buckets buckets.

Output

FieldTypeDescription
vpinf64Probability of informed trading [0, 1]
toxicity_alertbooltrue if VPIN > 0.6 (smart money active!)
buy_pressuref64Buying pressure [0, 1]

Interpretation

VPINMeaning
< 0.3Normal โ€” no smart-money activity
0.3 - 0.6Moderate โ€” caution
> 0.6ALERT โ€” smart money is trading aggressively

LAYER 7: Bayesian Online Changepoint Detection (BOCPD)

What does it do?

It detects structural changes in real time. Based on the Adams & MacKay (2007) paper. When the market shifts from one regime to another (e.g. from trend to crash), BOCPD pinpoints the exact moment.

Mathematical Formula

Run Length = how many bars have elapsed since the last changepoint.

For each observation x_t:

1. Predictive Probability (Student-t):

ฯ€(x_t | r) = Student-t(x_t; ฮผ_n, ฯƒยฒ_n, 2ฮฑ_n)

with Normal-Inverse-Gamma parameters updated online.

2. Growth vs Changepoint:

growth_prob[r+1]     = joint[r] ร— (1 - 1/ฮป)
changepoint_prob[0] += joint[r] ร— (1/ฮป)

where ฮป = hazard_lambda (how often changepoints occur).

3. Normalisation:

P(r_t | data) = probs / ฮฃ probs

4. MAP Run Length:

best_run_length = argmax P(r_t | data)

Parameters

ParameterValueDescription
hazard_lambda100.0Mean interval between changepoints (bars)
ฮผโ‚€0.0Prior mean
ฮบโ‚€1.0Prior strength
ฮฑโ‚€1.0Prior shape
ฮฒโ‚€0.0001Prior scale

Output

FieldTypeDescription
changepoint_probabilityf64Probability of a changepoint NOW [0, 1]
run_lengthusizeBars since the last changepoint
regime_stablebooltrue if changepoint_prob < 0.3

FUSION LAYER โ€” Adaptive Combination

What does it do?

It combines the signals of all 7 layers with adaptive weights โ€” layers that are more confident receive a higher weight.

Fusion Formula

1. Individual Signals โ†’ [-1, +1]:

kalman_signal  = (velocity ร— 1000).clamp(-1, +1)
hurst_signal   = persistence_signal                    (already [-1, +1])
wavelet_signal = (trend_direction ร— 100).clamp(-1, +1)
vpin_signal    = (buy_pressure - 0.5) ร— 2             (map [0,1] โ†’ [-1,+1])

2. Fixed (Base) Weights:

LayerWeightRationale
Kalman0.30The most direct predictor (price + velocity)
Wavelet0.25High-quality denoised trend
Hurst0.20Memory / persistence
VPIN0.15Smart-money activity
Entropy echo0.10Clarity ร— Kalman (confirmation)

3. Meta-Confidence (Global Modifier):

meta_confidence = (lyapunov.predictability ร— entropy.clarity ร— stability_factor).clamp(0, 1)

where stability_factor = 1.0 if the regime is stable, 0.3 otherwise.

4. Regime Boost:

Trending      โ†’ ร— 1.3  (boost โ€” directional signals are trustworthy)
MeanReverting โ†’ ร— 0.7  (reduce โ€” the trend may reverse)
Chaotic       โ†’ ร— 0.3  (severe penalty โ€” unpredictable)

5. Final Score:

raw = w_kalman ร— kalman + w_wavelet ร— wavelet + w_hurst ร— hurst + w_vpin ร— vpin + w_entropy ร— kalman ร— clarity
oracle_score = (raw ร— regime_boost ร— meta_confidence ร— 100).clamp(-100, +100)

6. Final Confidence:

confidence = meta_confidence ร— max(0, 1 - noise_ratio)

Interpreting oracle_score

ScoreInterpretationAction
+15 to +100Bullish๐ŸŸข LONG
-15 to +15Neutral / Uncertainโšช HOLD
-100 to -15Bearish๐Ÿ”ด SHORT
V2 OPTIMISATION NOTE: The historical computation was optimised from O(nยฒ) to O(n) using pre-computed series and point-by-point fusion. This allows instant computation over thousands of bars without timeouts. The thresholds were adjusted to ยฑ15 to reflect the real scale of the composite scores.

Chaos Kill Switch

If confidence < 0.15, the market is in complete chaos:


Data Flow Diagram

Candle[] โ”€โ”€โ”€ close[] โ”€โ”€โ”ฌโ”€โ”€ Kalman Filter โ”€โ”€โ”€โ”€ predicted_price, velocity
                       โ”œโ”€โ”€ Entropy Regime โ”€โ”€โ”€โ”€ entropy, regime, clarity
                       โ”œโ”€โ”€ Hurst R/S โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€ hurst, persistence
                       โ”œโ”€โ”€ Lyapunov โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€ exponent, predictability
                       โ””โ”€โ”€ Wavelet Haar โ”€โ”€โ”€โ”€โ”€โ”€ denoised_trend, noise_ratio

Candle[] โ”€โ”€โ”€ volume โ”€โ”€โ”€โ”€โ”€ VPIN โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€ vpin, buy_pressure, toxicity
            close[] โ”€โ”€โ”€โ”€โ”€ BOCPD โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€ changepoint_prob, run_length

                              โ”‚
                              โ–ผ
                        FUSION LAYER
                    adaptive weights ร— regime
                              โ”‚
                              โ–ผ
                     oracle_score [-100, +100]
                     confidence  [0.0, 1.0]
                     dominant_regime

Advantages over Traditional Indicators

AspectClassic Indicators (EMA, RSI)TITAN ORACLE
TimingLagging (look at the past)Leading (forecast the future)
NoiseSensitive to noiseWavelet denoises the signal
RegimeNot detectedEntropy + Changepoint detect it
Smart MoneyInvisibleVPIN detects informed activity
ChaosIgnoredLyapunov + Kill Switch protect
MemoryNot analysedHurst detects persistence
AdaptivityFixed parametersAdaptive weights based on conditions

Source Files

FileDescription
src-tauri/crates/titan-indicators/src/oracle.rsFull implementation (all 7 layers + fusion + unit tests)
src-tauri/crates/titan-indicators/benches/bench_oracle.rsCriterion benchmarks for the Oracle pipeline
src-tauri/src/titan_oracle.rsRe-export of the titan-indicators Oracle API into the main crate
src-tauri/src/strategy.rsDecision logic driven by oracle_score
src-tauri/src/commands/backtest.rsTauri command get_oracle_snapshot (registered in main.rs)

TITAN ORACLE v1.0 โ€” Precision. Prediction. Profit. ๐Ÿ”ฎ