How to Backtest an EGX Strategy: A Quant Guide to the Egyptian Exchange
Published · 8 min read
Youssef — founder, TextToQuant
Search for quantitative Egyptian Exchange analysis and you'll find almost nothing. Academic papers on market efficiency, a few broker reports, and forums full of tips. What you won't find is practical material on actually backtesting EGX trading strategies — testing rules against historical EGX data before risking money on them.
This guide is that material. It covers what makes the EGX structurally different from the markets most backtesting content assumes, where usable data comes from, how standard strategy types translate (and where they break), and how to run an EGX backtest without writing code.
If you're new to backtesting itself — what it is, what makes one valid — start with our guide on how to backtest a trading strategy without coding, then come back. Everything there about data quality, costs, and position sizing applies double here.
Why the EGX is different (and why it matters for backtesting)
Most backtesting tutorials silently assume US-style market structure: deep liquidity, no daily price limits, easy shorting, Monday–Friday sessions. The EGX violates most of those assumptions, and a backtest that ignores the differences will produce numbers you can't trade.
Trading calendar and sessions
The EGX trades Sunday through Thursday — the weekend is Friday and Saturday. That matters for anything calendar-based: "Monday effect" studies, weekly bars, day-of-week filters. A weekly bar on EGX data anchored to a Monday open is measuring something different than the same bar on the S&P 500.
Sessions are also short — a few hours around midday Cairo time — so intraday strategies have far fewer bars to work with per day than on crypto or US equities.
Daily price limits
EGX stocks trade with daily price limits — a stock can only move a fixed percentage from its reference price before trading in it is constrained or halted for the day. This has real backtesting consequences:
- Momentum gets truncated. A breakout that would run 15% in one day on an unconstrained market gets spread over multiple limit days on the EGX. Your entry may be impossible at the backtested price: if the stock is locked at limit-up, there may be no sellers at all.
- Stops don't always fill. A stop loss at −7% is a polite fiction if the stock gaps to limit-down and stays there. Realistic EGX backtests need to assume worse-than-stop fills on limit days.
Liquidity concentration
EGX liquidity is heavily concentrated in a handful of large names, with a long tail of stocks that trade thin. Two consequences:
- Your tradable universe is smaller than the listed universe. A strategy backtested across "all EGX stocks" is mostly backtested on stocks you couldn't actually fill at the printed price. Restrict tests to names with real turnover.
- Slippage assumptions must be pessimistic. The 0.05–0.1% slippage that's reasonable for liquid US stocks is optimistic for mid-tier EGX names. Model more, and size positions so that you're never a meaningful fraction of daily volume.
Shorting and instruments
For practical purposes, treat the EGX as a long-only market when backtesting. A short-selling framework exists on paper, but availability is limited to specific stocks and brokers, and borrowing is not something a retail strategy should assume. Every "long/short" strategy template you've seen needs its short leg removed or replaced with "move to cash."
Currency and inflation context
EGX returns are denominated in Egyptian pounds, and the pound has gone through repeated large devaluations. A backtest showing +80% in EGP across a devaluation year may be flat or negative in dollar terms — and some of the strongest EGX rallies have been partly currency pass-through, as the market repriced hard assets in a weakening currency. Decide up front which currency your results mean, and be suspicious of any EGX equity curve that doesn't mention this.
Settlement and costs
Delivery-versus-payment settlement on the EGX is not instant — funds and shares take days to settle, which caps how fast you can recycle capital in and out of positions. High-turnover strategies need to model that delay, plus the full cost stack: brokerage commission, exchange and clearing fees, and transaction levies.
Where EGX data comes from
You can't backtest without history. Realistic options:
- The exchange itself. EGX publishes official end-of-day data, indices (EGX30, EGX70, EGX100), and historical statistics. This is the ground truth for daily bars.
- Regional data vendors and portals (Mubasher and similar) carry EGX quotes and history and are what most local brokers build on.
- Global platforms. TradingView and major data providers carry EGX symbols with daily history, which is enough for the swing- and position-timeframe strategies that suit this market anyway.
- TextToQuant. We maintain cleaned EGX daily data in the platform, with the boring-but-critical work done: consistent bar alignment, corporate-action handling, and delisted names retained so backtests aren't survivorship-biased.
Whatever the source, apply the same checks: are bars adjusted for splits and dividends, are delisted companies included, and does the history span at least one full boom-bust-devaluation cycle?
Adapting standard strategies to EGX conditions
Standard strategy families don't transfer to the EGX unchanged. How each one bends:
Trend following. Structurally the best fit for a long-only, limit-constrained market: entries don't depend on catching single-day moves, and holding periods are long enough that settlement friction doesn't dominate. The adaptation is patience on entry — use closes above a level over multiple days rather than intraday breakouts that limit rules can make unfillable.
Mean reversion. Dangerous here in its naive form. "Buy the 3-day dip" works statistically in deep, mean-reverting markets; on the EGX, a multi-day slide in a thin name is as likely to be someone who knows something exiting. If you test reversion, demand a liquidity filter and a regime filter, and expect the validation suite to kill most variants.
Momentum / relative strength. Cross-sectional momentum (rank the universe, hold the strongest) translates reasonably well, with two edits: rank within the liquid names only, and rebalance monthly rather than weekly to keep turnover and settlement drag tolerable.
Breakout systems. Work, but must be tested with limit-aware fills: if the breakout bar closed at or near limit-up, assume you entered the next day, worse. If a breakout edge survives that haircut in backtest, it's much more believable.
Anything intraday or high-frequency. Short sessions, thin books, wide effective spreads. Not where a retail quant should spend their first hundred backtests.
A worked example on TextToQuant
Here's the shape of an honest EGX backtest, start to finish. The strategy: a deliberately simple long-only trend filter on a liquid EGX large-cap.
The plain-English input:
Buy [EGX stock] when the 20-day SMA crosses above the 50-day SMA and the close is above the 200-day SMA. Sell when the 20-day crosses back below the 50-day. Risk 2% of equity per trade, daily timeframe, last 8 years.
TextToQuant parses that into explicit rules, shows you the assumptions it made (fill timing, costs, sizing), and lets you correct them before running — the same workflow as any other no-code backtest, pointed at EGX data.
Then the report: equity curve, trade list, drawdown, and — because a single equity curve proves nothing — the validation layer. Monte Carlo reshuffles the trade sequence to show the range of outcomes your edge could have produced; walk-forward checks whether the parameters keep working on data they weren't tuned on; the deflated Sharpe ratio discounts the result for every variant you tried before this one. The output is a letter grade, and on a market as thin as the EGX, respect the grade — especially when it says discard.
Whatever the numbers turn out to be, the point of the exercise stands: every step — data, costs, limits, validation — was explicit. That's the difference between EGX analysis and EGX opinions.
FAQ
Can you actually backtest EGX stocks without coding?
Yes. The workflow is identical to backtesting any market on a plain-English platform: describe the rules, review the parsed strategy, run it against historical EGX data with costs applied. The EGX-specific part isn't the tooling — it's the assumptions (limits, liquidity, long-only, settlement) covered in this guide.
What timeframes work best for EGX trading strategies?
Daily and above. Sessions are short, intraday liquidity is thin, and the strategies that survive validation on EGX data tend to be multi-day trend and momentum systems with modest turnover. If your idea needs 5-minute bars to work, the EGX is the wrong venue for it.
Is the EGX efficient enough that backtesting is pointless?
The opposite argument is stronger: less-studied markets are where systematic analysis has the most room, precisely because almost nobody is doing it rigorously. But thin liquidity cuts both ways — apparent inefficiencies are often just untradeable. That's why validation (out-of-sample testing, Monte Carlo, deflated Sharpe) matters more on the EGX, not less: it's how you separate a real edge from a liquidity mirage.