ACTIVITY CLOCK: WHY YOUR 5-MINUTE BARS RUN ON THE WRONG CLOCK (SCRIPT)
Okay so if you came here from Instagram because you commented CLOCK, welcome. The script from the reel is attached at the bottom of this post.
Quick idea first. A 5-minute bar treats every minute of the day the same. 09:30 to 09:35 is one bar, 13:50 to 13:55 is one bar, same weight in your model. But the market doesn't trade evenly at all. It's busy at the open, it goes to sleep at lunch, and then it goes crazy into the close. So when you sample on the clock you're sampling the boring middle of the day just as often as the part where most of the trading actually happens.
Here's what I measured on AAPL, 20 sessions of Nasdaq trades (26 Oct to 20 Nov 2026), auction prints taken out:
- On average 394 trades a minute over the whole day.
- Lunch (12:00 to 13:30): 251 a minute. The quietest 5 minutes, 13:50 to 13:55, only 220.
- The first 5 minutes: 1,521 a minute, that's 6.1x lunch.
- The last 5 minutes: 3,748 a minute. 15.0x lunch. Same "one bar" as the lunch one.
- The first and last half hour together: 38% of all the trades, in 15% of the clock.
- SPY has the same shape, a bit flatter: the close is 6.5x lunch.
Now flip it around. Say you close a bar every N trades instead, and you size N so you still get 78 bars a day, the same as 5-minute bars. Then the last half hour gets 17 bars and the clock gives it 6. Lunch gets 3 to 4. That's the point, your bars follow the activity instead of the wall clock, and each bar holds about the same amount of information.
This is not a "time bars are evil" thing. It's just that if you compute volatility, signals or features on time bars, the open and the close are crammed into a handful of bars and lunch is spread over dozens. Your model sees the wrong mix of the day.
HOW TO RUN IT
- pip install lse-data pandas pyarrow numpy
- Make a free account on London Strategic Edge and create an API key
- export LSE_API_KEY=your_free_key
- python activity_clock.py
Part A runs on the free key: AAPL 1-minute bars for the last 30 days, they carry a trade count per minute, so you get trades per minute through the day, open and close vs lunch, and a little histogram of how many trade bars land in each half hour vs the 6 from the clock. Part B uses every single Nasdaq trade over the last 5 sessions, that needs their Nasdaq TotalView data, so set LSE_NASDAQ_KEY as well. Mine on the free key (23 sessions to 25 Nov): open 5.8x lunch, close 7.3x lunch, last half hour 10.7 trade bars vs 6 on the clock. The free bars count trades on all venues, so the levels differ from the Nasdaq-only numbers, the U-shape is the same.
WHERE THE DATA COMES FROM
I ran all of this on London Strategic Edge. The free plan gives you 10 years of history, 50 GB a month and an official API, which is plenty to run this script on any stock you want.
Make the free account here:
If you want the Nasdaq trades for Part B, use my code RICK10 at checkout:
Full disclosure, I work with London Strategic Edge, that's my code.
Run it on your own ticker, post your open vs lunch and close vs lunch numbers below and tell me which stock you used.
0
0 comments
Your Quant
2
ACTIVITY CLOCK: WHY YOUR 5-MINUTE BARS RUN ON THE WRONG CLOCK (SCRIPT)
powered by
Quantamentals for traders
skool.com/quantamentals-for-traders-5814
Beginners education under construction by Rick (Free)
Build your own community
Bring people together around your passion and get paid.
Powered by