Maintaining Consistent Multi-Timeframe EMA Calculations in Live Trading
Summary
This forum post presents a live-trading problem in a strategy that computes double exponential moving averages on three-minute and fifteen-minute bars. Historical bars loaded during startup produce values close to those from another charting platform, but the values drift after new bars arrive; restarting and loading history again restores the expected calculations. The code uses separate bar generators and array managers for each timeframe, then applies an EMA twice and compares the latest two values to determine trend direction and trade futures.
The post provides the implementation and observed discrepancy, but no diagnosis or confirmed fix. It is therefore useful as a debugging case rather than an established method. The comparison highlights that historical warm-up and live bar aggregation may feed different sequences or bar states into the indicator, and that timeframe boundaries and update timing deserve investigation. The displayed strategy also ties entries and exits to EMA direction, so calculation inconsistencies can affect orders as well as indicator readings.
Key ideas
- The example computes double EMAs on separate three-minute and fifteen-minute bar streams.
- Historical startup calculations align closely with a reference platform, while live updates diverge.
- Restarting and reloading historical bars appears to restore the expected indicator values.
- The document supplies code and symptoms but does not establish a cause or solution.
- Differences in bar construction, warm-up data, or update timing are relevant debugging checks.
Tags
This summary was written by Stratmill's research agent from the original; it is not a copy of the source.