๐พ Slope Distribution Fan
Core Question:
Given the current slope magnitude and direction,
what is the historical distribution of slope values over the next N bars?
๐งญ Conceptโ
The Slope Distribution Fan measures the conditional likelihoods of future slope values, conditioned on the current slope.
It answers questions like:
โWhen the current slope is +0.15, what distribution of slopes historically followed over the next 1, 2, or 3 bars?โ
This creates a โfanโ of possible slope outcomes โ a probabilistic envelope that describes how slope typically evolves.
๐ผ๏ธ Placeholder: Distribution Fan Visualization
Visual: central slope at time t, with multiple translucent curves fanning out to show slope distributions at +1, +2, +3 bars.
๐ข Mathematical Definitionโ
Let be the slope of a smoothed price series (e.g., SMA or EMA).
For each observation , collect the next N slope values:
Group all observations by current slope bin (e.g., rounded or quantized values),
and compute the empirical distributions of future slopes within each bin:
for horizons .
Each horizon forms one layer of the โfan.โ
โ๏ธ Usageโ
- Compute slopes from your smoothed series.
- Define current-slope bins (e.g., quantiles or fixed-width buckets).
- For each bin:
- Collect all subsequent slope values up to horizon N.
- Record the empirical distribution .
- Visualize or summarize these conditional distributions.
๐ผ๏ธ Placeholder: Workflow Diagram
Visual: pipeline showing โCompute slope โ Group by slope bin โ Aggregate future slopes โ Plot fan.โ
๐ก Example (Pseudocode)โ
import pandas as pd
import numpy as np
df["sma"] = df["close"].rolling(10).mean()
df["slope"] = df["sma"].diff()
H = 3 # lookahead horizon
bins = np.linspace(df["slope"].min(), df["slope"].max(), 20)
df["slope_bin"] = pd.cut(df["slope"], bins=bins)
records = []
for h in range(1, H + 1):
df[f"slope_future_{h}"] = df["slope"].shift(-h)
grouped = df.groupby("slope_bin")[f"slope_future_{h}"].describe()
grouped["horizon"] = h
records.append(grouped)
fan = pd.concat(records)
๐ผ๏ธ Placeholder: Code Output Visualization Visual: heatmap showing slope_bin (y-axis) vs. horizon (x-axis) with color for mean or median future slope.
๐ Distributional Interpretationโ
Each horizon defines its own conditional slope distribution:
| Horizon | What It Describes | Visualization |
|---|---|---|
| +1 | Immediate slope reaction | Narrow distribution; high autocorrelation |
| +2 | Short-term continuation/decay | Broader fan; transitional dynamics |
| +3+ | Medium-term reversion or persistence | Widest spread; slope โfanโ shape visible |
This lets you ask:
- How does slope persistence vary with slope magnitude?
- Do extreme slopes tend to revert faster?
- How asymmetric is the fan (e.g., more downside slope expansion than upside)?
๐ผ๏ธ Placeholder: Multi-Layer PDF Chart Visual: multiple probability curves fanning out with horizon.
๐งฎ Feature Outputsโ
| Feature | Description |
|---|---|
slope_fan_mean_h1 | Mean of slope distribution at +1 bar given current slope |
slope_fan_std_h1 | Standard deviation at +1 bar |
slope_fan_median_h3 | Median slope at +3 bars |
slope_fan_skew_h2 | Skewness of slope distribution at +2 bars |
slope_fan_decay_rate | Rate of slope mean reversion with horizon |
These features describe the shape and decay of slope behavior through time.
๐ผ๏ธ Placeholder: Feature Heatmap Visual: table or heatmap of mean/variance/skew by slope bin and horizon.
๐ Relation to Slope Persistenceโ
- Slope Persistence measures whether slopes tend to continue increasing in magnitude.
- Slope Distribution Fan shows how the entire distribution shifts as a function of current slope.
Persistence is a binary or threshold-based view. The fan is a continuous, probabilistic one โ effectively a richer, distributional generalization.
๐ผ๏ธ Placeholder: Comparison Illustration Visual: slope persistence (single line) vs. slope fan (band of probabilities).
๐งฉ Integration With Conditional Studiesโ
Slope Distribution Fans can themselves be computed under conditional contexts โ e.g., high ATR, specific trading sessions, or RSI zones. Each condition produces a different deformation of the fanโs shape.
| Mode | Description |
|---|---|
| Global | across all data |
| Conditional | under condition C |
| Comparative | Difference or KL-divergence between conditional and global fans |
๐ผ๏ธ Placeholder: Conditional Fan Comparison Visual: overlapping contour plots showing fan widening/narrowing by regime.
๐ง Notesโ
- The slope fan is not predictive in isolation โ itโs descriptive of conditional dynamics.
- When integrated into a feature pipeline, it can inform forecast uncertainty or expected directional persistence.
- The fan can also be viewed as a distributional regression surface over slope magnitude ร horizon.
Summary: The Slope Distribution Fan visualizes how slope values historically evolve after a given slope magnitude. It transforms slope behavior into a multi-horizon likelihood field โ a richer way of understanding trend momentum, decay, and variability.
๐ผ๏ธ Placeholder: Summary Visualization Visual: composite graphic showing slope bins, fan expansion, and persistence overlay.