Moving Average Crossover Strategy
Welcome to Simple Trading Bot, a modular, backtestable trading framework built in Python. This project showcases algorithmic strategy design, performance tracking, and real-time simulation, perfect for demonstrating trading logic, data handling, and system architecture.
This bot implements a classic Moving Average Crossover strategy:
- Buy Signal: When short-term MA crosses above long-term MA
- Sell Signal: When short-term MA crosses below long-term MA
It includes:
- Strategy logic
- Backtesting engine
- Mock live execution
- Trade logging
- Performance visualization
- Modular strategy design (
strategy/) - Historical backtesting with performance metrics (
backtest/) - Mock live feed simulation (
live/) - Trade logging and signal tracking (
utils/) - Easy to extend with new strategies or data sources
Trading-bot/ ├── strategy/ └── moving_average_crossover.py ├── backtest/ └── backtest_engine.py ├── live/ └── mock_execution.py ├── utils/ └── logger.py ├── data/ └── sample_data.csv ├── requirements.txt └── README.md
BUY at $105.00 [Index: 4]
SELL at $110.00 [Index: 6]
Final Portfolio Value: $10,500.00
Visual output includes signal overlays and price charts using matplotlib.
git clone https://github.com/gem870/simple-trading-bot.git
cd Trading-bot
pip install -r requirements.txt
python backtest/backtest_engine.py
python live/mock_execution.pyThe bot uses rolling averages to generate signals: data['short_ma'] = data['Close'].rolling(window=20).mean() data['long_ma'] = data['Close'].rolling(window=50).mean() data['signal'] = np.where(short_ma > long_ma, 1, -1)
- Add RSI-based reversal strategy
- Integrate with Binance or MetaTrader API
- Build Qt GUI dashboard for live visualization
- Add performance analytics (Sharpe ratio, drawdown, etc.)
- Deploy on cloud for remote execution