Developed and Optimized Trading Strategies in Backtrader

  • Day: 2024-01-16
  • Time: 00:00 to 23:55
  • Project: Dev
  • Workspace: WP 2: Operational
  • Status: Completed
  • Priority: MEDIUM
  • Assignee: Matías Nehuen Iglesias
  • Tags: Backtrader, Python, Trading, Data Analysis, Visualization

Description

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.

Evidence

  • source_file=2024-01-16.sessions.jsonl, line_number=1, event_count=0, session_id=d3ae969f69ad2970a31fb442bf6321e10aceac285174418a7fbe96c30935aa4d
  • event_ids: []