Measured Move Engine
Relevant source files
The following files were used as context for generating this wiki page:
The Measured Move Engine is a core technical analysis component of the Rabid Raccoon trading platform designed to identify equal-length price swings (AB=CD patterns) and project future price targets. It operates within a multi-timeframe framework (15M, 1H, 4H) to provide deterministic trading signals, entry triggers, and invalidation levels for Micro E-mini S&P 500 (MES) futures.
The engine integrates with the broader Instant Analysis Engine and the Market Context Engine to refine trade setups based on volatility (VIX) and cross-asset correlations. By detecting swing structure—specifically high and low anchor points—the engine calculates the "quality" of a move and its current status, ranging from "FORMING" to "ACTIVE".
Sources: README.md:14, src/lib/instant-analysis.ts:1-15, src/lib/forecast.ts:100-115
Pattern Detection Logic
The engine identifies patterns based on four distinct price points (A, B, C, and D) to form an AB=CD structure. The detection process relies on detectSwings to find local extrema which then serve as anchor points for the measured move calculation.
Measured Move Components
The engine tracks the following data for every detected move:
| Component | Description |
|---|---|
| Point A | The start of the initial price leg (impulse). |
| Point B | The end of the initial leg and start of the retracement. |
| Point C | The end of the retracement leg; must not exceed Point A. |
| Projected D | The target level where Leg CD equals Leg AB in price distance. |
| Direction | Classified as either BULLISH or BEARISH. |
| Status | ACTIVE, FORMING, EXPIRED, or INVALIDATED. |
| Quality | A numeric score (0-100) based on the symmetry and "cleanliness" of the swing. |
Sources: src/lib/instant-analysis.ts:315-325, src/lib/forecast.ts:160-165, src/components/TechChart.tsx:170-185
Workflow of Detection
The following diagram illustrates how the engine processes raw candle data into actionable measured move levels:
The engine identifies swings and filters them to find active AB=CD patterns before projecting targets.
Sources: src/lib/instant-analysis.ts:300-330, src/components/TechChart.tsx:170-190
Integration with Multi-Timeframe Analysis
Measured moves are calculated across different timeframes to confirm trend strength. The computeSignals function evaluates these moves alongside standard technical indicators like RSI and Moving Averages.
Signal Convergence
When a Measured Move is identified as ACTIVE, the engine generates specific deterministic signals:
- Directional Bias: Derived from whether the move is BULLISH or BEARISH.
- Quality Thresholds: The engine uses the
qualityscore to weight the signal's impact on the overall timeframe gauge. - Level Calculation: Entry, Stop, and Target levels are primarily derived from the Measured Move geometry. If no active move exists, the engine reverts to ATR-based deterministic fallbacks.
Sources: src/lib/instant-analysis.ts:320-330, src/lib/instant-analysis.ts:500-515, src/lib/forecast.ts:105-120
Multi-Timeframe Data Structure
Relationship between analysis results and measured move data structures.
Sources: src/lib/instant-analysis.ts:375-400, src/components/TechChart.tsx:5-15
Trade Plan Generation
The engine provides a concrete "Trade Plan" based on the relationship between current price and the measured move anchors.
Execution Levels
- Entry: Often aligned with Point C or a specific retracement level.
- Stop: Typically placed at Point A (invalidation of the leg) or Point C.
- Target: The Projected D level, where the AB=CD equality is met.
Sources: src/lib/instant-analysis.ts:515-530, src/components/ForecastPanel.tsx:115-135
Deterministic vs. AI Overlay
The Rabid Raccoon platform uses a hybrid approach for communicating these levels:
- Deterministic Engine: Performs the "Raw Math" to find the exact price levels for A, B, C, and D.
- AI Analysis (OpenAI/Anthropic): Interprets the deterministic levels to provide a tradeable narrative, such as "Deterministic 15M MES measured move: entry X, stop Y, target Z."
Sources: src/lib/instant-analysis.ts:600-620, src/lib/forecast.ts:150-180, src/app/api/analyse/chart/route.ts:120-135
Visualization and UI
The TechChart component renders Measured Moves as dashed polyline segments connecting points A → B → C → D.
- Bullish Moves: Rendered in emerald/teal (
#26a69a). - Bearish Moves: Rendered in red (
#ef5350). - Labels: Points A, B, C, and D are explicitly labeled on the SVG chart for visual confirmation of the structure.
Sources: src/components/TechChart.tsx:170-200, src/components/ForecastPanel.tsx:135-150
Conclusion
The Measured Move Engine serves as the geometric foundation of the Rabid Raccoon trading logic. By identifying price symmetry via AB=CD patterns and combining them with volatility filters, the system provides high-probability entry and exit targets that are mathematically verifiable rather than speculative.