Skip to main content

πŸ” Slope Persistence

Question:
When a smoothed series (e.g., SMA, EMA) shows a steep slope, how likely is that slope to maintain or intensify over the next N bars?


Concept​

Slope persistence quantifies trend continuity β€” it measures whether the rate of change in a smoothed price series tends to sustain or accelerate once it reaches a certain magnitude.

At each step:

st=Mtβˆ’Mtβˆ’1s_t = M_t - M_{t-1}

We then evaluate how often the next slope increases in absolute value:

pt=1 if ∣st+1∣>∣st∣, else 0p_t = 1 \text{ if } |s_{t+1}| > |s_t|, \text{ else } 0

Persistence is the fraction of those events:

P=βˆ‘ptNP = \frac{\sum p_t}{N}

πŸ–ΌοΈ Placeholder: Slope Continuation Illustration
Visual: line showing moving average with slope arrows; highlight periods where slope steepens.


Usage​

  1. Compute slope of a chosen smoothed feature (e.g., SMA₁₀).
  2. Identify moments where ∣st∣|s_t| exceeds a threshold (e.g., top decile).
  3. Measure how often slope magnitude increases over the next HH bars.
  4. Compare persistence across regimes such as:
    • high vs. low volatility (ATR-based)
    • different time windows
    • rising vs. falling markets

This produces both global and conditional distributions β€” showing how slope continuation behaves under different contexts.


Example Pseudocode​

df["sma"] = df["close"].rolling(10).mean()
df["slope"] = df["sma"].diff()

# Define "steep" slope threshold (e.g., 90th percentile)
S0 = df["slope"].abs().quantile(0.9)
mask = df["slope"].abs() > S0

# Compare with next bar's slope magnitude
df["next_slope"] = df["slope"].shift(-1)
persistence = (df.loc[mask, "next_slope"].abs() > df.loc[mask, "slope"].abs()).mean()

πŸ–ΌοΈ Placeholder: Distribution Comparison Chart Visual: two PDFs comparing slope persistence under different ATR regimes.


Distributional Interpretation​

  • The global distribution represents persistence rates across all conditions.
  • Conditional distributions isolate contexts where slope continuation differs β€” e.g., during high volatility or specific sessions.

This links directly to Conditional vs. Non-Conditional Studies and can be expressed as a distribution pipeline:

D0 = get_distribution("slope_persistence")
D1 = condition(D0, where="ATR_percentile > 0.8")
compare_distributions([D0, D1])

Potential Features​

Feature NameDescription
slope_persistence_h1Probability slope increases next bar
slope_persistence_h3Probability slope increases within next 3 bars
slope_persistence_median_shiftMedian difference between future and current slope magnitudes

Notes​

  • High persistence often marks early-trend acceleration zones.
  • Low persistence commonly appears in chop or exhaustion phases.
  • Conditional analysis can reveal how persistence interacts with other metrics (ATR, RSI, funding, etc.).
  • Persistence metrics can serve as both features (for regime classification) and signals (for entry/exit timing).