Horizon Chart

Stock Price Momentum Horizon

Horizon chart showing stock price momentum over time with neon cyan/coral bands for gains and losses.

Output
Stock Price Momentum Horizon
Python
import matplotlib.pyplot as plt
import numpy as np

# Neon palette for dark theme
COLORS = {
    'positive': ['#0d3d4d', '#1a6b7a', '#27D3F5'],  # Cyan gradient
    'negative': ['#4d1a2a', '#8a2545', '#F5276C'],  # Coral gradient
    'background': '#0a0a0f',
    'text': '#ffffff',
    'grid': '#333333',
}

np.random.seed(42)
days = np.arange(0, 252)  # Trading year
# Simulated stock momentum
momentum = np.cumsum(np.random.randn(252) * 0.02)
momentum = momentum - np.mean(momentum)  # Center around zero

fig, ax = plt.subplots(figsize=(14, 3), facecolor=COLORS['background'])
ax.set_facecolor(COLORS['background'])

band_height = 0.015

# Positive bands (gains)
ax.fill_between(days, 0, np.clip(momentum, 0, band_height), color=COLORS['positive'][0])
ax.fill_between(days, 0, np.clip(momentum - band_height, 0, band_height), color=COLORS['positive'][1])
ax.fill_between(days, 0, np.clip(momentum - 2*band_height, 0, band_height), color=COLORS['positive'][2])

# Negative bands (losses)
ax.fill_between(days, 0, np.clip(momentum, -band_height, 0), color=COLORS['negative'][0])
ax.fill_between(days, 0, np.clip(momentum + band_height, -band_height, 0), color=COLORS['negative'][1])
ax.fill_between(days, 0, np.clip(momentum + 2*band_height, -band_height, 0), color=COLORS['negative'][2])

ax.axhline(0, color=COLORS['grid'], linewidth=0.5, alpha=0.5)
ax.set_xlim(0, 251)
ax.set_ylim(-0.02, 0.02)

ax.set_title('Stock Price Momentum (1 Year)', color=COLORS['text'], fontsize=12, fontweight='bold', pad=10)
ax.set_xlabel('Trading Days', color=COLORS['text'], fontsize=10)
ax.set_ylabel('Momentum', color=COLORS['text'], fontsize=10)

for spine in ax.spines.values():
    spine.set_visible(False)
ax.tick_params(colors=COLORS['text'], labelsize=8)

plt.tight_layout()
plt.show()
Library

Matplotlib

Category

Time Series

Did this help you?

Support PyLucid to keep it free & growing

Support