πŸ“… 2024-01-16 β€” Session: Developed and Optimized Trading Strategies in Backtrader

πŸ•’ 00:00–23:55
🏷️ Labels: Backtrader, Python, Trading, Data Analysis, Visualization
πŸ“‚ Project: Dev
⭐ Priority: MEDIUM

Session Goal:

The goal of this session was to enhance and optimize trading strategies using the Backtrader framework, focusing on data visualization, indicator plotting, and trading logic implementation.

Key Activities:

  • Investment Strategy Overview: Reflected on combining technical analysis with systematic trading rules to enhance investment strategies.
  • Data Processing Expansion: Developed Python code for weekly data resampling using the yfinance library, improving stock data analysis.
  • Model Fitting Techniques: Transitioned from exponential model fitting to linear fit on log-transformed stock prices for better residual analysis.
  • Backtrader Enhancements:
    • Optimized plotting of β€˜OLSResiduals’ indicator and modified the plotinfo attribute in CustomCashObserver.
    • Implemented trading logic in Backtrader strategies using the next method, including buy and sell orders based on residuals.
    • Modified OLSResiduals indicator to ensure unique naming and correct plotting for each ticker.

Achievements:

  • Successfully integrated and optimized multiple components of the Backtrader framework to improve trading strategy execution and visualization.
  • Enhanced data processing capabilities and model fitting techniques for better financial analysis.

Pending Tasks:

  • Further testing and validation of the implemented strategies to ensure robustness and efficiency in different market conditions.