Skip to content
All library documents

Building Real-Time Candles from Time or Tick Samples

Article TradingView scripts

Summary

This Pine library provides tools for constructing and displaying candles from live price updates. It supports chart-time candles and custom candles sampled either after a chosen duration or a chosen number of updates. Candle data can be shown as conventional OHLC or transformed into Heikin-Ashi values, and the library includes price-source selection, color options, and moving-average examples.

The described approach tracks real-time updates with persistent state, maintains candle OHLC values and indices, and uses elapsed update time for tick data. Custom-time candles can optionally link each open to the prior close. The examples demonstrate plotting RSI-derived candles and a custom-timeframe Heikin-Ashi view, so the library can visualize indicators as well as prices. This is implementation guidance rather than a trading strategy or performance study. Its real-time update logic and chart rendering are platform-specific, and the excerpt does not establish how the generated values behave in historical simulations.

Key ideas

  • Candles can be aggregated from live updates by elapsed time or update count.
  • The library supports conventional OHLC and Heikin-Ashi candle representations.
  • Custom candles can track timestamps, durations, sequential indices, and configurable open-price linkage.
  • Examples apply candle transformations to RSI and show moving-average and chart-display options.
  • The document explains a visualization library and gives no trading rules or performance evidence.

Tags

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