I have been trying to figure out why this script won't work. I'm working on defining a variable that will limit a system to entering a trade based on its next earnings report, but first I need to make number of bars variable depending on time scale. def AG = getAggregationPeriod(); def thelimit; if AG = AggregationPeriod.HOUR { thelimit = 60; } else { thelimit = 20; } Thanks for the hby epsymp - Trading Discussion