Skip to main content

🌾 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 sts_t be the slope of a smoothed price series (e.g., SMA or EMA).

For each observation sts_t, collect the next N slope values:

{st+1,st+2,,st+N}\{s_{t+1}, s_{t+2}, \ldots, s_{t+N}\}

Group all observations by current slope bin (e.g., rounded or quantized values),
and compute the empirical distributions of future slopes within each bin:

P(st+hst)P(s_{t+h} \mid s_t)

for horizons h=1,2,,Nh = 1, 2, \ldots, N.

Each horizon forms one layer of the “fan.”


⚙️ Usage

  1. Compute slopes from your smoothed series.
  2. Define current-slope bins (e.g., quantiles or fixed-width buckets).
  3. For each bin:
    • Collect all subsequent slope values up to horizon N.
    • Record the empirical distribution P(st+hstbin)P(s_{t+h} \mid s_t \in \text{bin}).
  4. 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:

HorizonWhat It DescribesVisualization
+1Immediate slope reactionNarrow distribution; high autocorrelation
+2Short-term continuation/decayBroader fan; transitional dynamics
+3+Medium-term reversion or persistenceWidest 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

FeatureDescription
slope_fan_mean_h1Mean of slope distribution at +1 bar given current slope
slope_fan_std_h1Standard deviation at +1 bar
slope_fan_median_h3Median slope at +3 bars
slope_fan_skew_h2Skewness of slope distribution at +2 bars
slope_fan_decay_rateRate 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.

ModeDescription
GlobalP(st+hst)P(s_{t+h} \mid s_t) across all data
ConditionalP(st+hst,C)P(s_{t+h} \mid s_t, C) under condition C
ComparativeDifference 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.

Comments

No comments yet. Be the first!