I’m trying to set a custom tick timeframe dynamically in ProRealTime using the TIMEFRAME() function. However, I found that TIMEFRAME((timeFrame) tick, UPDATEONCLOSE) does not work when timeFrame is a variable.
I also tried using conditional statements like:
But that didn’t work either.
Is there any way to pass a variable to TIMEFRAME() or dynamically change the timeframe without manually editing the script? If not, what’s the best workaround?
Thanks in advance for any help! 🚀
The keyword TIMEFRAME does not support variables, such as Timeframe(
myTF,UpdateOnClose), only
constants.
Automated strategies only support time-based timeframes (from Yearly to 1 second), not ticks, range bars, etc…
The keyword
GetTimeFrame may be used to know which TF is being used, usually to set differents configurations. You can find more at
https://www.prorealcode.com/documentation/gettimeframe/, though in the example shown it’s only useful in line 8, as in lines 2 and 5 it already knows which TF is being used, being constants.