Time Series
Static

Candlestick Chart

Candlestick charts originated in 18th century Japan for rice trading and have become the standard for financial market visualization. Each candlestick shows four price points: open, high, low, and close for a time period. The 'body' represents the range between open and close, while 'wicks' extend to show high and low. Green/white candles indicate price increases, while red/black show decreases. Combined with volume and moving averages, candlestick charts are essential for technical analysis.

Example Visualization

Candlestick chart showing 30 days of stock price movements with volume

Try this prompt

"Use mplfinance library to create a candlestick chart showing 'Open', 'High', 'Low', and 'Close' prices for the last 30 days. Generate a proper example dataset with realistic stock price movements."
Generate this now

Python Code Example

example.py
import numpy as np
import pandas as pd
import mplfinance as mpf
from datetime import datetime

# Generate realistic OHLC data for the last 30 business days
np.random.seed(42)
dates = pd.date_range(end=datetime.today(), periods=30, freq='B')
price = 100 + np.cumsum(np.random.randn(30))

# Create Open, High, Low, Close columns
open_prices = price + np.random.randn(30) * 0.5
close_prices = price + np.random.randn(30) * 0.5
high_prices = np.maximum(open_prices, close_prices) + np.abs(np.random.randn(30) * 0.5)
low_prices = np.minimum(open_prices, close_prices) - np.abs(np.random.randn(30) * 0.5)

df = pd.DataFrame({
    'Open': open_prices,
    'High': high_prices,
    'Low': low_prices,
    'Close': close_prices,
    'Volume': np.random.randint(1000, 5000, size=30)
}, index=dates)

# Plot candlestick chart with volume and moving averages
mpf.plot(df, type='candle', style='charles',
         title='Candlestick Chart with Volume and SMA',
         ylabel='Price ($)', volume=True, mav=(10, 20))

Common Use Cases

  • 1Stock and cryptocurrency price analysis
  • 2Forex trading visualization
  • 3Commodity price tracking
  • 4Technical pattern recognition

Pro Tips

Add moving averages (SMA, EMA) for trend identification

Include volume bars for confirmation of price movements

Use consistent color conventions (green=up, red=down)