Price Data: OHLCV & Timeframes
Learn how price data is structured, what OHLCV means, why timeframes matter, and how to handle corporate actions.
Understanding Price Data
All algorithmic strategies start with price data. Understanding how price data is structured—and its limitations—is foundational.
What is OHLCV?
- Open: The first trade price of the period
- High: The highest price traded during the period
- Low: The lowest price traded during the period
- Close: The last trade price of the period (most important for technical analysis)
- Volume: Total number of shares traded during the period
Each of these is a separate data point. Your algorithm will consume OHLCV bars and generate trading signals from them.
import pandas as pd
# Loading price data
df = pd.read_csv('AAPL_daily.csv', parse_dates=['Date'])
# df columns: Date, Open, High, Low, Close, Adjusted Close, Volume
print(df.head())
# Date Open High Low Close Adj Close Volume
# 2024-01-01 191.00 195.50 190.75 194.45 194.23 5234000
Adjusted vs. Unadjusted Prices
Stocks undergo corporate actions: dividend payments and stock splits. If you don't adjust for these, your backtests will show massive false losses.
- Stock split (2-for-1): One share becomes two. Unadjusted price would show a 50% "loss" that didn't actually happen.
- Dividend ($1.00): Price drops by $1.00 on ex-dividend date. Unadjusted data shows a decline that should have been a total return.
Always Use Adjusted Close
When backtesting, always use the "Adjusted Close" price, not the raw close. Your data provider (like EODHD used by this platform) handles this automatically.
Timeframes: The Tradeoff
| Timeframe | Use Case | Typical Strategy | Pros | Cons |
|---|---|---|---|---|
| 1-minute | Scalping | Breakouts | Many signals | Lots of noise, spread costs matter |
| 5-15 minute | Day trading | Mean reversion | Good middle ground | Still requires monitoring |
| 1-hour | Swing trading | Trend + momentum | Enough data, less noise | Overnight gaps |
| Daily | Swing/Position | Trend following | Clean signals, low costs | Fewer opportunities |
| Weekly/Monthly | Position trading | Long-term trends | Very clean, low drawdowns | Slow to respond |
Lower timeframes = more signals but also more false signals (noise). Higher timeframes = cleaner signals but fewer opportunities.
Start with Daily
If you're new to algo trading, start with daily timeframes. Less noise, easier to understand, and you won't need to monitor positions 24/7.
- OHLCV (Open, High, Low, Close, Volume) is the standard format for price data
- The closing price is the most important price point for technical analysis
- Different timeframes suit different strategies—always think about tradeoffs
- Adjusted prices are critical: ignore dividends and splits at your peril