Login Page - Create Account

Support Board


Date/Time: Sun, 05 May 2024 23:14:52 +0000



Post From: Is it possible to exclude last (current) bar from Moving Average calculations?

[2020-09-09 00:50:11]
gjockey - Posts: 47
Hello,

Using a 1 minute chart, I have a "Number of Trades" study on which I apply a "simple moving average" study to with length = 4 (ie. calculate # of trades per minute over 4 minutes). I then use a "Text Display" study to display this average. In the case that the current bar is just beginning, I do not want the current bar's "number of trades" zero or near zero value to skew the entire moving average. Is there a way to force a moving average study to only calculate on completion of time bars, or have it offset one bar somehow and always skip the current bar in it's calculations?

In case somebody has a better/different approach, here’s more background on why I am asking. On volatile stocks, I like to pull up tick charts but I need a quick way to figure what the tick (number of trades) setting should be, which is why I want to know the trades/minute average it is doing in the immediate timeframe. When I mean volatile, a stock could normally make 40 trades per minute and suddenly be doing 1,000 trades per minute. Using an approach like I mentioned above would work except the calculation of that last bar can really screw up the # of trades average if the current bar is just starting when you are only looking at 4 bars/minutes back.

Thanks.
Date Time Of Last Edit: 2020-09-09 01:12:05