Skip to content
All library documents

Generating Synthetic Candles to Test Trading Indicators

Article TradingView scripts

Summary

This Pine Script tool creates artificial open, high, low, and close series for evaluating indicators in a controlled environment. Its recursive random process produces close values, while separate smoothed random components shape the highs and lows; adjustable inputs affect the starting value, randomness, wick size, open-to-close variation, and price scaling. The script can also derive common candle averages and display the generated candles for visual inspection.

The intended use is development and troubleshooting: researchers can examine indicator behavior across changing synthetic price patterns and inspect initialization, including recursive filters that may behave unexpectedly at the start of a series. The author explicitly cautions that the generated values do not represent a ticker and should not be used for trading. The document offers no statistical validation that the synthetic series capture real market behavior, so results on these candles cannot establish live-market performance.

Key ideas

  • The generator creates synthetic OHLC candles from randomized, recursively smoothed values.
  • Inputs let users alter close randomness, wick variability, open-close variation, and price scaling.
  • Developers can substitute the generated series into indicators to inspect behavior and initialization.
  • The artificial candles do not represent market prices and are unsuitable for trading decisions.
  • Testing on synthetic data alone does not establish performance on real market data.

Tags

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