I know that on a chart you can't have two data sources with one being Renko and the other being a time-based bar like HA candles. But is there a workaround to it? Or has anyone synthetically created virtual renko candles in code from HA candles using ticks?
Can you help answer these questions from other members on futures io?
while creating virtual bars might be the most complex work around, it is likely the one giving you the most flexibility, too. You would for example be able to backtest strategies more accurately since your code could utilize Look-Inside-Bar-Backtesting when applied to tick or time based bars.
Another idea that comes to mind would be using a PriceSeries Provider for providing the time based data that you would use to compute the Heikin Ashi values from.
Thanks for your response. Yes, backtesting with Renko is utterly useless in my experience. The disparity between the backtest and reality is night and day.
Now I have a very basic question: strategy code gets called by TS when a bar closes or a tick is received. But how does one store data across these invocations? For example, I want to be able to store the number of ticks over a period of time, etc.
I am not sure I correctly understand your question. In general, you would for example use a variable to store values within your code. How often your variable can be updated throughout the bar depends if you declared it as intrabarpersist or not.
I meant that I would like to calculate the value of a variable at the close of one bar and make it available to me in another bar. For example to synthetically construct either a Renko or HA candle from the other you'd need data to persist across bars.
in TS variables are tied to the datastream. When it comes to computing virtual bars within your code you can have more than one virtual bar per chart bar. In this case referencing values for previous bar will become problematic when using variables and other approaches like using a vector for example are more suitable.