Future functions no longer use the previous close

As reported in several threads the future functions like Future%Chg() were using Fridays close as the starting point. They now use the next close.

Using any values from the past when calculating a future return introduces some biases for short periods (less than a month). For example Future%Chg(5) ran on a weekend was doing Friday’s close to the next Friday’s close. It now does Monday’s close to the next Monday’s close.

We also fixed weekday and weekly to do the same.

The related posts are
Future%Chg needs an offset otherwise its only able to use “previous close”
Data download the day of rebalance for machine learning
DataMiner and incorrect future prices

NOTE We are still working on fixing negative offsets that should be NA when stocks stop trading for example or when you are going too far into the future for the Close function.

NOTE Future%Chg_W() uses the future Friday’s closes, so Future%Chg_W(1) is the next Friday to the Friday after that. Which is a bit strange but it’s consistent.

You can verify by running this on any weekend, no stocks should be returned (using 3 decimal precision). I’m using _D which is consistent with holidays (5 is always one calendar week).


Thank You

1 Like

Great fix, Marco. Does the fix apply to FutureRel%Chg as well?

1 Like

yes, both