Resetting intraday MAs


New member
Hello all, I am new here!

I want to develop a moving average for a $TICK chart. As $TICK starts fresh upon market open, the intraday moving average also has to start fresh with market open.

Any help will be greatly appreciated.
Thanks in advance.
Last edited:


Well-known member
There is a setting for each instrument type in Chart Settings where you check the checkbox to start aggregation at market open, as well as other settings like whether to show after hours and premarket data...


New member
I was not very clear about what I want. "Resetting" meant calculating moving averages with completely new data for new day, excluding previous days history data. This is for $TICK chart.


Well-known member

You can display a moving average of any set of data points you choose. If you build yourself a time series in this way:
def series = if SecondsFromTime(0930) >= 0 then CLOSE else Double.NaN;
you effectively tell ToS that if the data point is before the opening bell (or whatever time you choose) then please ignore it and put a NaN (Not A Number or NULL) into my series.
Next you then take a moving average based on that series thusly:
plot MovAvg = MovingAverage(AverageType.SIMPLE, series, 12);
you will have a simple moving average over 12 bars that starts, quite literally, from nothing at 9:30 AM.

N.B. This will not plot anything for the first 12 bars of the day. I'm not sure that's an intended consequence of your request, but moving averages can't start until they have a full length of data points to work with. I'm sure there are forumlae out there that can construct a pseudo-moving average over the interim bars, but this snippet does not.

Nihil ante tempus q.e.d.


Similar threads