Data collection: a simple MT5 script writes time, bid, ask to CSV every second (or on every tick) for two weeks.
Notebook outline:
Code: Select all
import pandas as pd
df = pd.read_csv('ticks.csv', names=['time','bid','ask'], parse_dates=['time'])
df['spread'] = (df.ask - df.bid) / 0.0001 # EURUSD pips
df['hour'] = df.time.dt.tz_localize('Etc/GMT-2').dt.tz_convert('Europe/London').dt.hour
summary = df.groupby('hour').spread.describe(percentiles=[.5,.9,.99])
summary[['50%','90%','99%']].plot(kind='bar')
What to look for:
- The hours where the median is lowest.
- The hours where the 99th percentile spikes, often more important than the median.
- Differences between Monday and the rest of the week.
If anyone runs this, post the chart (without broker name if you prefer). Comparing shapes across brokers is interesting.