Professional-grade Python framework for backtesting, optimizing, and deploying trading strategies.
AlphaEngine is a complete algorithmic trading framework for serious quant traders. It includes 5 production-ready strategies, an interactive dashboard, walk-forward optimization, Monte Carlo simulation, and multi-exchange support.
This repo contains the free demo with 1 strategy (Momentum) and basic backtesting.
- β Momentum strategy
- β 15 technical indicators (computed from scratch)
- β Portfolio tracker with commission/slippage
- β Performance metrics (Sharpe, Sortino, win rate, etc.)
- β Position sizing
- β Run provenance logging - every backtest captures the why, not just the what
π Full Version (Get it here β)
- β¦ 5 strategies: Momentum, Mean Reversion, Breakout, RSI+MACD, Grid Trading
- β¦ Interactive Streamlit dashboard with 5 tabs
- β¦ Parameter optimization with Sharpe ratio heatmaps
- β¦ Monte Carlo simulation (1000+ scenarios, fan charts)
- β¦ Risk management suite: drawdown halts, trailing stops, Kelly criterion
- β¦ Multi-exchange: Binance (crypto) + Alpaca (US equities)
- β¦ MQL5 Expert Advisor (.mq5 file for MetaTrader 5)
- β¦ Telegram & Discord notifications
git clone https://github.com/Leotaby/alpha-engine.git
cd alpha-engine
pip install numpy pandas
python demo.pyOutput:
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β β‘ A L P H A E N G I N E β Free Demo β
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
π Generated 1000 bars | $28,521 β $44,182
βΈ Running Momentum strategy... β
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
Total Return +0.23%
Sharpe Ratio 0.040
Win Rate 100.0%
Max Drawdown 2.05%
Profit Factor 0.00
Total Trades 2
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
π Run saved β ID: f7e302ab (logs/run_history.json)
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
Run ID : f7e302ab
Strategy : momentum | BTC/USDT | 1h
Regime : trending
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
HYPOTHESIS
Default dual-EMA crossover with ADX > 25 to confirm trend
strength. Baseline run before any parameter tuning.
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
PARAMETERS
fast_period 12
slow_period 26
adx_threshold 25.0
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
RESULTS
Total Return +0.23%
Sharpe Ratio 0.040
Win Rate 100.0%
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
π Run History
ID Strategy Regime Return% Sharpe Trades
f7e302ab momentum trending +0.23 0.040 2
One of the hardest problems in systematic trading is remembering why you chose a specific configuration β not just what the parameters were. AlphaEngine solves this with a lightweight RunContext layer built into every backtest.
Every run captures:
ctx = RunContext(
strategy_name="momentum",
params={"fast_period": 12, "slow_period": 26, "adx_threshold": 25.0},
hypothesis="ADX > 25 filters noise in ranging BTC markets. Testing baseline before tuning.",
market_regime="trending", # trending | ranging | volatile | mean-reverting
symbol="BTC/USDT",
tags=["baseline", "crypto", "adx-filter"],
notes="Synthetic data β alternating trending/ranging regimes every 200 bars.",
)Results are automatically persisted to logs/run_history.json. You can query your full history:
from core.run_logger import RunLogger
log = RunLogger("logs/run_history.json")
# Top 5 runs by Sharpe ratio
best = log.top_n(metric="sharpe_ratio", n=5)
# Filter by strategy and regime
trending = log.filter(strategy="momentum", regime="trending")
# Side-by-side parameter + result comparison
log.compare("f7e302ab", "a1b2c3d4")The edge lives in the assumption that drove the setup, not just the parameters.
Even in the free version, you can create custom strategies:
from strategies.base_strategy import BaseStrategy
class MyStrategy(BaseStrategy):
name = "my_strategy"
default_params = {"fast": 10, "slow": 30}
@property
def description(self):
return "My custom crossover strategy."
@property
def param_grid(self):
return {"fast": [5, 10, 15], "slow": [20, 30, 40]}
def generate_signals(self, df):
from utils.indicators import ema
df = ema(df, self.params["fast"])
df = ema(df, self.params["slow"])
df["signal"] = 0
df.loc[df[f"ema_{self.params['fast']}"] > df[f"ema_{self.params['slow']}"], "signal"] = 1
df.loc[df[f"ema_{self.params['fast']}"] < df[f"ema_{self.params['slow']}"], "signal"] = -1
return df| Starter | Pro β | Premium | |
|---|---|---|---|
| Price | $79 | $129 | $249 |
| Strategies | 2 | 5 | 5 |
| Dashboard | Basic | Full (5 tabs) | Full |
| Optimizer | β | β | β |
| Monte Carlo | β | β | β |
| Risk Suite | Basic | Full | Full |
| Exchanges | 1 | 2 | 2 |
| MQL5 EA | β | β | β |
| Support | Priority | Video call |
- Python 3.10+ - core framework
- Streamlit - interactive dashboard
- Plotly - professional charts
- NumPy/Pandas - data processing
- MQL5 - MetaTrader 5 Expert Advisor
This software is for educational and research purposes only. It is not financial advice. Past performance does not guarantee future results. Always do your own research before trading with real money.
Built with π§ by a quantitative finance professional.




