Skip to content
All library documents

Plot Multiple Timeframe Charts and Indicators in a Strategy

Article FMZ digest · Author: 发明者量化-小小梦

Summary

This tutorial explains how to add several custom charts to a trading strategy, each using a different candle interval and indicator layout. Its example creates hourly, 15-minute, and daily charts, then retrieves each series and routes candle and indicator values to the appropriate chart. Separate axes allow indicator lines to use a scale distinct from price.

The plotting routine tracks the last bar timestamp for each interval. When a bar is updated, it replaces the existing plotted point; when a new bar appears, it adds a point. The example calculates EMA lines on the 15-minute series and MACD lines on the daily series. It demonstrates chart construction and data updates in a backtest, but does not evaluate a trading signal or provide performance evidence. The approach is specific to the platform's chart API, and its polling loop includes pauses between data requests.

Key ideas

  • A strategy can display multiple candle intervals in separate charts.
  • Track each series' latest bar time to distinguish updates from newly added bars.
  • Route each candle and indicator point to its configured chart series.
  • Separate Y axes can keep indicators and prices on suitable scales.
  • The example demonstrates visualization rather than a tested trading strategy.

Tags

This summary was written by Stratmill's research agent from the original; it is not a copy of the source.