I'm trying to create an indicator that can use higher timeframes for some of my indicators. Everything works except a volume related indicator. I know you can use open, close, high, low so it seems to me that I should be able to use volume since that is the other key value for a bar. But it didn't seem to give me the results I was expecting. Anyone know if it's possible and I just missed something?
I did discover an unfortunate thing about AggregationPeriod. You cant bury it inside a function then use the function to reference historical data using open[1] type notation.
if you have a function:
def bob = average(close(period = AggregationPeriod.THREE_DAYS), 20)
you cant use:
def sally = bob - bob[1]
you have to make a:
def bob1 = average(close(period = AggregationPeriod.THREE_DAYS)[1], 20)
then sally = bob - bob1
kinda a pain, but that's how thinkscript thinks you should do it
I did discover an unfortunate thing about AggregationPeriod. You cant bury it inside a function then use the function to reference historical data using open[1] type notation.
if you have a function:
def bob = average(close(period = AggregationPeriod.THREE_DAYS), 20)
you cant use:
def sally = bob - bob[1]
you have to make a:
def bob1 = average(close(period = AggregationPeriod.THREE_DAYS)[1], 20)
then sally = bob - bob1
kinda a pain, but that's how thinkscript thinks you should do it