PIR Evolver Deep Dive: From Thue-Morse to Trading Signals
A technical walkthrough of the engine that powers SignalO
PIR Evolver Deep Dive: From Thue-Morse to Trading Signals
The Journey
This article traces the complete path from raw market data to a trading signal — through the PIR Evolver Engine. Every step is grounded in mathematics that was discovered in the 1800s and proven in our neural network research.
Step 1: The Thue-Morse Sequence
The Thue-Morse sequence is a binary sequence where the n-th term is determined by the parity of the number of 1s in the binary representation of n:
n: 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
binary: 0 1 10 11 100 101 110 111 1000 1001 1010 1011 1100 1101 1110 1111
1s: 0 1 1 2 1 2 2 3 1 2 2 3 2 3 3 4
sign: + - - + - + + - - + + - + - - +
Key property: for n = 2^k, the signed sum is exactly zero. The sequence is at perfect equilibrium at powers of two. This is not an approximation — it is a mathematical fact.
Step 2: Applying Signs to Returns
Given a return sequence r₁, r₂, ..., rₙ, we assign Thue-Morse signs:
signed_sum = Σᵢ sign(i) × rᵢ
If the returns are balanced (equal positive and negative contributions), the signed sum is near zero. If there's a structural imbalance — e.g., all the positive returns happen at even indices — the signed sum deviates.
Step 3: Balance Gap
The balance gap is the absolute value of the signed sum, normalized by the number of terms:
balance_gap = |signed_sum| / n
- balance_gap ≈ 0: Market is in equilibrium (stable regime)
- balance_gap >> 0: Market has shifted (regime transition)
This is computed in O(n) time — one pass through the return sequence. No matrix operations, no optimization, no parameter tuning.
Step 4: Pattern Area (Entropy)
The pattern area is the shoelace area of the signed cumulative path:
path(i) = Σⱼ₌₀ⁱ sign(j) × rⱼ
area = ½ |Σᵢ (path(i) × path(i+1) - path(i+1) × path(i))|
This measures the "shape" of the return sequence:
- Low area: Clean trend — the path goes in one direction
- High area: Scattered — the path zigzags, indicating uncertainty
Step 5: Regime Classification
Combining balance gap and pattern area:
| Balance Gap | Pattern Area | Returns | Regime |
|---|---|---|---|
| Low | Low | Positive | Bullish |
| Low | Low | Flat | Range |
| Low | Low | Negative | Bearish |
| High | High | Any | Transition |
The "Transition" state is the most valuable signal — it warns that the current regime is breaking down before the new regime is established.
Step 6: Position Sizing
Each regime has a confidence score derived from how far the balance gap is from the historical baseline:
confidence = 1 - (current_gap / max_historical_gap)
Position sizing:
- Bullish + high confidence: Full long position
- Bullish + low confidence: Reduced position (half)
- Transition: Exit to cash
- Bearish: Short position (if enabled) or cash
- Range: Minimal position, wait for breakout
Step 7: The Rebalancer
The top-16 crypto momentum rebalancer:
- Compute PIR metrics for all 16 assets every tick
- Classify each asset's regime
- Compute confidence scores
- Allocate capital proportional to confidence × expected return
- Rebalance on regime transitions (not on fixed time intervals)
This means the system trades when the math says the regime has changed — not when a timer fires. Fewer trades, better timing.
Why This Works
Markets have structural equilibria. Trends, ranges, and consolidation patterns are all forms of equilibrium. PIR detects when that equilibrium breaks — when the "shape" of returns stops being balanced.
This is the same math that detects when a neural network's weights lose equilibrium (TPNN structural health). The domain is different (financial returns vs. network weights), but the math is identical:
PIR balance gap = |Σᵢ sign(i) × xᵢ| / n
where x can be anything — returns, weights, mastery scores, or cell states.
SignalO
The PIR Evolver Engine powers SignalO, our live signal feed product. SignalO exposes the engine's output as a real-time subscription service:
- Per-asset regime classification (updated every tick)
- Balance gap and pattern area values
- Regime transition alerts (push + email)
- Historical replay for backtesting
- API access for programmatic integration
Educational disclaimer: SignalO is for educational purposes only. PIR regime detection is experimental. No signal can predict future market performance. Always do your own research.
Published by Only Institute