Skip to content

The script uses the VectorBT library to download historical price data, implement the strategy, simulate portfolios, and visualize the results.

Notifications You must be signed in to change notification settings

mosh888/VectorBT-Simple-MA-Crossover-Backtest

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 

Repository files navigation

MA Crossover Strategy Backtest with Benchmark Comparison

This repository contains a Python script that backtests a simple moving average (MA) crossover strategy on Nasdaq 100 Futures (NQ=F) and compares its performance against a buy-and-hold strategy on S&P 500 Futures (ES=F). The backtest is conducted using the VectorBT library, which allows for efficient data retrieval, strategy implementation, and performance analysis.

Features:

Moving Average Crossover Strategy:

  • The script applies a 10-period fast MA and a 50-period slow MA on NQ=F (Nasdaq 100 Futures) to generate buy and sell signals.
  • Benchmark Comparison: The strategy's performance is compared against a benchmark buy-and-hold strategy on ES=F (S&P 500 Futures).
  • Visualization: The script generates visual comparisons of portfolio values and includes relevant performance statistics for both the strategy and the benchmark.
  • Customizable Timeframe: Users can adjust the start and end dates and the data interval (e.g., hourly) to backtest different periods.

Requirements:

  • Python 3.7 or higher
  • vectorbt library
  • matplotlib library

About

The script uses the VectorBT library to download historical price data, implement the strategy, simulate portfolios, and visualize the results.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published