Skip to content
Vikas Sharma edited this page Sep 13, 2025 · 1 revision

TastyAlgo Backtesting Dashboard Wiki


Overview

TastyAlgo is an interactive algorithmic trading dashboard for backtesting stock strategies using market regime detection and advanced analytics. It enables users to experiment with multiple strategies, visualize results by market conditions, and analyze performance with downloadable reports.


Table of Contents


Features

  • Interactive dashboard built with Streamlit
  • Backtest major trading strategies (Momentum, Moving Average, Volatility Breakout, Pairs Trading)
  • Market regime identification using statistical methods or clustering (K-Means)
  • Visualizes price, signals, portfolio value, drawdown, and regime heatmap
  • User-adjustable strategy parameters
  • CSV export for trades and results
  • Modular, well-documented Python code

Quick Start

  1. Clone the repository:
    git clone https://github.com/yourname/tastyalgo-backtesting-stock.git
    cd tastyalgo-backtesting-stock
    
  2. Install requirements:
    pip install -r requirements.txt
    
  3. Launch dashboard:
    streamlit run app.py
    
  4. Select your stock ticker, dates, strategy, and parameters in the dashboard UI, then click Run Backtest.

Trading Strategies

  • Momentum: Buys assets with strong recent returns; customizable n-day period and thresholds.
  • Moving Average Crossover: Buys/sells when fast and slow moving averages cross.
  • Volatility Breakout: Trades sudden large price moves.
  • Pairs Trading: Trades relative changes between correlated stocks.

Each strategy includes parameter sliders and explanations for use and tuning.


Market Regime Detection

TastyAlgo segments market history into regimes:

  • Bull (rising markets)
  • Bear (falling markets)
  • Sideways/Neutral (range-bound, low volatility)

Detection Methods:

  • Statistical: Uses rolling returns and volatility windows.
  • K-Means Clustering: Groups periods with similar price behaviors.

Results/predictions are visualized and can be compared for performance by regime.


Performance Metrics

After each backtest, the dashboard shows:

  • Total Return
  • Sharpe Ratio
  • Max Drawdown
  • Win Rate
  • Volatility
  • Regime-wise results
  • Interactive plots for portfolio value, drawdown, regime distribution

Exporting Reports

Users can download a CSV summary of the trade history and all main metrics with a click.


FAQ

Q: What data source is used?
A: Yahoo Finance via yfinance API.

Q: Can I add my own strategies?
A: Yes. See strategies.py for examples on how to add custom logic.

Q: How can I save my parameters or reports?
A: Use the dashboard export buttons to download results, or save parameters manually.


Contributing

Pull requests for new features, strategies, regime detectors, and documentation are welcome.

  • Fork the repo and submit improvements/enhancements.

For detailed method descriptions, code explanations, change logs, and troubleshooting, see additional Wiki pages and the repo README.