This week we're rolling out a new feature: batch transforms. One of the most frequent requests from our members has been for more flexibility with trailing time frames. For example, our built-in moving average transforms are pretty nifty, but what if you want to use a 3-day moving average on some operations and a 5-day moving average on others? Or what if you want your volume-weighted average to use a volume-based window instead of a date-based window? The answer is to use batch transforms.
Think of a batch transform as a trailing window of data. You can define how many days are in the trailing window. You can define how often the window is refreshed. Obviously, the bigger and more frequent, the slower the backtest performance will be. The trailing window has price data and volume data. Every time the batch is refreshed, it also runs any calculations that you have requested. Least squares calculations, aggregations, averages, etc. are all possible.
Imagine an algorithm where every month you re-calculate the signals, and then trade on those signals for a month, and then recalculate again, and so on. Batch transform is built for that.
You can read a bit more documentation in our updated help doc.
To get started, you can also clone the example below. In this example, the refresh period is one day. The trailing window is 10 days. So, every day, the last 10 days of data is loaded. The batch transform finds the max price and min price in that window. The algorithm uses those as trading signals - it goes long when the price hits a min, and it goes short when the the price hits a max.