OPEN-SOURCE SCRIPT

Lanczos Candles

This indicator reconstructs price action using Lanczos resampling, incorporating lower timeframe data to create a more detailed representation of market movements. Traditional candle aggregation on higher timeframes tends to lose some price action detail - this indicator attempts to preserve more of that information through mathematical resampling.

The indicator samples price data from a lower timeframe and uses the Lanczos algorithm, a mathematical method commonly used in signal processing and image resampling, to reconstruct the price series at the chart's timeframe. The process helps maintain price movements that might otherwise be smoothed out in regular candle aggregation.

The main settings allow you to select the source timeframe for sampling, adjust the Lanczos filter width to balance smoothness versus detail preservation, and optionally enable Heikin Ashi calculation. The filter width parameter (default: 3) affects how aggressive the smoothing is - higher values produce smoother results while lower values retain more of the original variation.

This approach can be useful for technical analysis when you want to work with higher timeframes while maintaining awareness of significant price movements that occurred within those candles. The optional Heikin Ashi mode can help visualize trends in the resampled data.

The indicator works best when there's a clear ratio between your chart timeframe and the source timeframe (for example, using 1-minute data to build 5-minute candles).
ashiCandlestick analysisdspeducationalheikinheikin-ashiheikinashijapaneseLTFPine utilitiesresampleupscale

Open-source script

In true TradingView spirit, the author of this script has published it open-source, so traders can understand and verify it. Cheers to the author! You may use it for free, but reuse of this code in publication is governed by House rules. You can favorite it to use it on a chart.

Want to use this script on a chart?


Also on:

Disclaimer