How Forex Statistics Are Actually Calculated
Behind every statistic on this site lies rigorous analysis of historical price data. Here's exactly how we process millions of candles to deliver accurate, actionable insights.
15 Years of Data
Historical price analysis
Verified Sources
Industry-standard data feeds
Open Methodology
Every calculation explained
Processing Power
Candles analyzed per study
Analysis framework
Reproducible results
The Foundation: Data Sources
Garbage in, garbage out. Every statistical analysis starts with quality data. Here's where our numbers come from and why it matters.
Primary Data Sources
MetaTrader 5 Historical Data
Downloaded directly from major broker feeds, representing institutional-grade pricing from 2008-2023. We use data from multiple brokers and cross-verify for consistency.
CSV Export Format
Each candle contains timestamp, open, high, low, close, and volume data. This OHLC format is the industry standard and allows for precise pattern recognition.
Data Validation
We remove weekends, holidays where markets were closed, and any gaps or anomalies that would skew results. Only complete trading days are included in frequency calculations.
The Analysis Framework: Python & Pandas
We process historical data using Python, the industry standard for quantitative analysis. Here's the exact workflow:
Step 1 Data Import & Cleaning
CSV files are loaded into Pandas DataFrames. We standardize timestamps to UTC, verify OHLC integrity (high ≥ open/close, low ≤ open/close), and remove any incomplete or corrupt candles.
df = df.dropna() # Remove incomplete data
df = validate_ohlc(df) # Verify candle integrity
Step 2 Pattern Detection Logic
For inside bars, we apply the mathematical definition: current high < previous high AND current low > previous low. This boolean operation runs across the entire dataset.
(df['high'] < df['high'].shift(1)) &
(df['low'] > df['low'].shift(1))
)
Step 3 Frequency Calculation
We count TRUE instances and divide by total candles to get the percentage. This gives us the raw formation frequency for that specific pair and timeframe.
inside_count = inside_bar.sum()
frequency = (inside_count / total_candles) * 100
Step 4 Cross-Pair Aggregation
The same analysis runs on all major pairs independently. We then aggregate results to find averages, ranges, and identify outliers. This reveals which pairs behave differently and why.
Handling Edge Cases & Anomalies
Real market data is messy. Here's how we ensure accuracy despite imperfections:
Weekend Gaps
Forex markets close Friday evening and reopen Sunday evening. Large gaps can occur. We exclude Sunday opening candles from pattern detection if the gap exceeds 50 pips, as these don't represent true consolidation.
Flash Crashes
Rare liquidity events create extreme candles. We identify outliers using standard deviation filters (> 5σ from mean) and flag them separately. These are noted but not excluded from totals.
Broker Feed Differences
Different brokers have slightly different prices due to liquidity providers. We use data from IC Markets and OANDA, cross-referencing for consistency. Discrepancies under 2 pips are considered normal.
Economic Event Candles
NFP, FOMC, and other major news events create volatile candles. We do NOT exclude these, as they're part of normal market behavior. However, we do track them separately for context.
Statistical Significance & Sample Size
Is 15 years enough data? Here's why we're confident in the sample size:
Sample Size Per Pair
Statistical Confidence
With over 50,000 candles per pair and multiple market cycles analyzed, our frequencies are statistically robust. A ±0.3% margin means if we report 7.2%, the true value lies between 6.9% and 7.5% with 99% confidence.
Performance Metrics: Beyond Just Frequency
Knowing how often a pattern forms is just the beginning. We also calculate success rates, average pip movement, and risk-reward ratios. Here's the expanded methodology:
Breakout Direction Analysis
After identifying an inside bar, we track the next candle's close. If it closes above the mother bar's high, that's a bullish breakout. Below the low is bearish. We calculate the percentage of bullish vs bearish breakouts to identify directional bias.
df['close'] > mother_bar_high, 'bullish',
np.where(df['close'] < mother_bar_low, 'bearish', 'none')
)
Pip Movement Calculation
We measure the distance from the inside bar close to the high/low of the following 5 candles. This reveals average profit potential. Values are normalized to pips for consistent comparison across pairs.
df['high'].rolling(5).max() - inside_bar_close
) * 10000 # Convert to pips
Win Rate Determination
Using a standardized trade model (entry at breakout, stop at opposite side of mother bar, target of 2:1 risk-reward), we backtest every inside bar. Trades that hit the target before the stop are winners.
win = (df['high'] >= target).any() before stop hit
win_rate = wins / total_trades * 100
Quality Control: How We Verify Results
Before publishing any statistic, we run multiple verification checks. Here's our quality assurance process:
Manual Spot Checks
We randomly sample 100 identified patterns and visually verify them on TradingView charts. This catches any logic errors in pattern detection code.
Cross-Dataset Validation
We run the same analysis on data from different brokers. Results should match within ±1%. Larger discrepancies trigger investigation into data quality issues.
Sanity Range Testing
Each pattern has an expected frequency range based on academic literature. Inside bars should be 3-12%. If results fall outside this, we investigate before publishing.
Reproducibility Testing
All analysis scripts are version-controlled. We can re-run any analysis from scratch and get identical results. This ensures no hidden errors in our calculations.
Limitations & Transparency
No analysis is perfect. Here are the known limitations of our methodology and what they mean for traders:
Broker-Specific Differences
Spreads, slippage, and feed quality vary by broker. Our analysis uses ECN broker data, which may differ from retail market maker feeds. Expect ±0.5% variance in real trading.
Historical Bias
Market structure evolves. The 2008-2023 period includes quantitative easing, algorithm trading growth, and structural changes. Patterns may behave differently in future market regimes.
Context Not Captured
Raw frequency doesn't account for trend context, support/resistance proximity, or macroeconomic backdrop. These factors significantly impact pattern success in live trading.
Execution Assumptions
Our backtest assumes perfect execution at candle open/close prices. Real trading involves slippage, spreads, and partial fills that reduce theoretical performance by 10-20%.
Important Note on Usage
These statistics are educational tools, not trading signals. They reveal how often patterns occur historically, not whether you should take any specific trade. Always combine statistical knowledge with proper risk management, context analysis, and your own trading plan.
Open Source & Community Verification
Transparency builds trust. Here's how you can verify our work:
Code Snippets
Key analysis functions are shown in articles. You can implement the same logic and verify our numbers match yours.
Raw Data Access
Historical OHLC data is freely available from MetaTrader and other platforms. Download it yourself and run comparisons.
Community Feedback
Readers regularly share their own analysis results. When discrepancies arise, we investigate and update if necessary.
Ready to Apply This Knowledge?
Now that you understand the methodology, explore our pattern frequency studies to see what the data reveals about your favorite setups.