I was trying to indicate a high volume...but in the morning time, the system uses the premarket volume in the calculation which is extremely low or in some cases, none at all.....so using a 5 minute schedule, when I say calculate volume [3] at 9:30am, its going into the premarket and if there is no volume 15 minutes into the premarket, then it was returning an error and not calculating at all.
please post your complete code and tell us what stocks you are looking at.
if you use an offset of 3, tos should go back 3 bars and read data. it is possible, going back 3 bars doesn't exist at the time period you think it should be, if some time periods had no trades,
this post is a good example of why we want people to post the complete study, not just a line or 2.
i am pretty sure something else is causing your code issues, because what you are saying doesn't seem right to me.
a candle can't exist with 0 volume. every candle has some volume. if it didn't, the candle wouldn't exist. in after hours times,
the quantity of AH candles will vary on every stock on every day. you can't look back x bars into premarket, on multiple days, and read from the same time period.
anyway, what i am saying is, if you use a positive offset on a variable, it should read a valid value. unless the offset is > 2000, which is the limit.
if you are using some method to read a variable, from a specific time period, that could cause problems in after hours.
here is a test code, that looks for 0 volume bars and bars at 9:15am.
on low daily volume stocks, i don't see a bar at 9:15. i do with csco, daily vol > 10m.
i don't see any errors with this.
i used the max offset and it read data.
Code:
# chg bubble to green if 9:15 time exists
# chg bubble to yellow if volume is 0
def abc = if secondstillTime(0915) == 0 then 1 else 0;
def v= volume;
def off = 1999;
addchartbubble(1, v[off], v[off] + "\n" + abc, ( if abc then color. green else if v[off] == 0 then color.yellow else color.gray), yes);
#