A Multi-Contract MACD Strategy Framework for Futures
Summary
This document presents a Python framework for applying MACD signals across multiple futures contracts. For each contract, it retrieves bar data, requires a minimum history, and compares the MACD difference and signal lines on the penultimate bar so that the still-forming latest bar does not drive the signal. A positive or negative difference sets the direction for a one-unit position when flat; an opposing signal triggers a close.
The framework also tracks position state, queues orders, and uses callbacks to update position information after trades. Its example loops over two named contracts and checks the market periodically. The text describes reusable execution and strategy scaffolding, and mentions adapting the logic to digital assets, but supplies no backtest, profitability evidence, transaction-cost treatment, or risk controls. Its contract examples and platform interfaces are specific to the described environment and may require adaptation elsewhere.
Key ideas
- The example applies MACD direction signals separately across multiple futures contracts.
- It reads the penultimate bar to avoid basing a signal on a changing, incomplete bar.
- When flat, it opens a one-unit position in the direction of the MACD line difference.
- An opposing signal closes the existing position through queued tasks and completion callbacks.
- The document gives framework code but no performance testing or comprehensive risk controls.
Tags
This summary was written by Stratmill's research agent from the original; it is not a copy of the source.