TREND — Regime & Reversal Heuristic
The Trend module identifies the current market regime (bullish, bearish, sideways) and estimates the probability of reversals or regime transitions.
It integrates multiple technical indicators (EMA alignment, MACD, RSI, ADX, Bollinger Bandwidth, slope, and z-score) into a unified market-state model.
Concept
Section titled “Concept”- Detects trend direction and strength using multi-indicator consensus.
- Evaluates bullish, bearish, or sideways regimes based on moving average and momentum alignment.
- Provides a reversal warning when exhaustion conditions appear (e.g., overbought RSI, cooling MACD histogram, falling ADX).
- Includes multi-timeframe consensus (short, medium, long) and a reversal backtest tool to evaluate the heuristic’s historical accuracy.
Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
symbol |
string | Target asset (e.g. AAPL, BTCUSD) |
start_date / end_date |
string | Analysis period (YYYY-MM-DD) |
time_window |
string | Predefined range (e.g. 3M, 6M, 12M, 24M, 5Y) |
horizon_days |
int | Lookahead window for reversal backtest (default 3) |
threshold_pct |
float | Required counter‑move threshold for a valid reversal (default 1.0) |
Endpoints
Section titled “Endpoints”| Endpoint | Description |
|---|---|
GET /stats/trend/state |
Returns the current market regime, confidence, and reversal assessment |
GET /stats/trend/consensus |
Multi‑timeframe consensus (short/medium/long) with sideways score and breakout bias |
GET /stats/trend/reversal/backtest |
Backtests reversal heuristic on historical data |
GET /stats/trend/documentation |
Returns endpoint and field descriptions for developers |
Example Requests
Section titled “Example Requests”1. Current regime & reversal assessment
Section titled “1. Current regime & reversal assessment”curl -s -H "Authorization: Bearer $ACCESS_TOKEN" \ "https://api.statalpha.io/stats/trend/state?symbol=AAPL&time_window=6M"2. Multi-timeframe consensus
Section titled “2. Multi-timeframe consensus”curl -s -H "Authorization: Bearer $ACCESS_TOKEN" \ "https://api.statalpha.io/stats/trend/consensus?symbol=AAPL&time_window=12M"3. Reversal heuristic backtest
Section titled “3. Reversal heuristic backtest”curl -s -H "Authorization: Bearer $ACCESS_TOKEN" \ "https://api.statalpha.io/stats/trend/reversal/backtest?symbol=TSLA&time_window=12M&horizon_days=3&threshold_pct=1.5"Example Response (trend state)
Section titled “Example Response (trend state)”{ "symbol": "AAPL", "time_window": "6M", "regime": "bullish", "confidence_pct": 82.3, "reversal_warning": { "likely": true, "direction": "bearish", "reasons": ["RSI overbought (>=70)", "MACD momentum cooling"] }, "metrics": { "close": 232.47, "ema50": 228.15, "ema200": 216.90, "rsi14": 71.3, "adx14": 24.8, "macd": 1.42, "macd_signal": 1.28, "macd_hist": 0.14, "bb_width20": 0.083, "slope50_pct_per_day": 0.042, "close_z20": 1.52 }}Interpretation
Section titled “Interpretation”| Metric | Meaning |
|---|---|
| regime | Current dominant state (bullish, bearish, sideways) |
| confidence_pct | Strength of the detected regime (0–100%) |
| reversal_warning | Possible near-term reversal, direction, and reasons |
| metrics | Key technical values supporting the regime classification |
| sideways.score_0_3 | Degree of sideways compression (only for sideways markets) |
| sideways.breakout_bias | Likely breakout direction if sideways (up / down) |
| consensus.overall | Majority signal across short, medium, and long-term timeframes |
- The trend model is heuristic and not predictive, but provides probabilistic context for trend strength and potential regime shifts.
- Confidence blends multiple components (MA alignment, slope, MACD, ADX).
- Sideways detection combines low ADX, narrow Bollinger Bands, and flat slope.