Having spent some time getting more details through the comment section of the question I have some bad news. Extended hours data is only available using intraday time frames. The only way to get pre-market data is to first have access to extended hours data. So while we are using the daily time frame it is impossible to access anything but regular session hours.
Many times there is a way to adapt the code to perform the same calculations from an intraday time frame. However not in this case. You code applies a 14 period moving average to the volume, shifted 10 bars to the left. Which means we have a 14 DAY moving average of the volume, shifted 10 DAYS to the left.
We cannot reference secondary time frames from within a study filter of a scan (same with a watchlist). So we can’t get there using the current technology available in the platform.
I have no idea where to start without seeing the code you are working with. However I will mention that in Thinkorswim this is no such thing as “pre-market”. There is only extended hours, which include both the after-market and pre-market trade data. So any solution that tries to work with only pre-market data will require the use of start and end times, defining the pre-markets hours.
My code is modified volume rate of change which I use in a watchlist:
input length = 14;
def volsma = SimpleMovingAvg(volume[10], length);
assert(length > 0, “‘length’ must be positive: ” + length);
plot VolROC = if volsma 0 then (volume / volsma ) * 100 else 0;
When I use this I don’t get the updated volume of the morning. I understand what you are saying that the morning volume is tied to the last days volume but I have no idea how to split it.
Ok this helps. But what time frame is your watchlist column set to?
There appears to be a typo in your last line: plot VolROC = if volsma 0 then (volume / volsma ) * 100 else 0;
I believe it should be: plot VolROC = if volsma <> 0 then (volume / volsma ) * 100 else 0;
Once I know what time frame you are using in the watchlist column I’ll finalize my analysis to determine if you are close to meeting the stated goal.
The watchlist timeframe is daily.
I could be going blind as I cant see a different between my last line and yours!
Sorry, I forgot to apply the adjustment when I pasted that line of code with the typo. It was missing the ” signs between volsma and 0.