MATLAB: Where did the “lead” and “pivot” parameters for TSMOVAVG go in the Financial Time Series Toolbox 2.1 (R14)

argumentbackwardscompatibilityFinancial Time Series Toolboxfunctionalityfuturepastremoved

In the Financial Time Series Toolbox 2.0 (R13), the TSMOVAVG function could be used with a "lead" parameter when using the simple averaging method, and a "pivot" parameter when using the weighted averaging method.
In the Financial Time Series Toolbox 2.1 (R14), TSMOVAVG does not allow these parameters.

Best Answer

The ability to specify the "lead" and "pivot" parameters is not available in the Financial Time Series Toolbox 2.1 (R14).
As a workaround, you can use the TSMOVAVG function in conjunction with the LEADTS function to simulate these options by "shifting" the data in the time series object.
This method uses TSMOVAVG to find the moving average, and then uses LEADTS to associate the resulting data with earlier times. This approach can be used with all the moving average methods, not just the "simple" and "weighted" methods.
For instance, if you create a Financial Time Series as follows:
lead = 1;
lag = 1;
fts = fints([(now + [1 1.5 2 3 3.25 3.75 4 5])' [2 3 5 5 5 5 6 7]']);
Where you previously would have used:
afts = tsmovavg(fts, 's', lead, lag);
Use the following, instead:
afts = tsmovavg(fts, 's', lead + lag + 1);
afts = leadts(afts, lead, NaN);