By ThinOrSwim and TradingView they have such function to create multi-timeframe indicator.
With time dependent timeframe, you can use the GETTIMEFRAME instruction that returns the current timeframe of the chart in seconds.
Here is the link in the documentation: https://www.prorealcode.com/documentation/gettimeframe/
There is no built-in instruction for non linear timeframe such as ticks or volumes. I will think of a coded workaround.
To obtain the number of ticks in the current candle, we can use:
if not isset($ticks[barindex]) then
$ticks[barindex] = 0
endif
if islastbarupdate then
$ticks[barindex]=$ticks[barindex]+1
endif
return $ticks[barindex] coloured(0,255,255) style(histogram)
A minimum of 2 candles are needed to verify that the counter is correct, here a 20-tick chart.
Below is the code that indicates the amount of volume in the candle; here is an example with a chart in 50-volumes per candlestick.
if not isset($volumes[barindex]) then
$volumes[barindex] = 0
endif
if islastbarupdate then
diff=volume-$volumes[barindex]
$volumes[barindex]=$volumes[barindex]+diff
endif
return $volumes[barindex] coloured("orchid") style(histogram,2)