This is a new version , with comments and debugging I been work on. It writes the two orginal files it did before plus one to a hardcoded directory where forecast is not shifted forward, this version can be used by backtesting programs like my TradersStudio or TradeStation as a secondary data series to do a backtest. This version works great running back to 2005, it’s also fairly stable.
This version is the same as the previous except we have added logic so that we can either run a long backtest and create long history file , This is mode 0 or just a short run , to update the backtest version of the file using 12-15 months of data, This is Mode 1 . We have added logic to read the forecast file and then find the last date in the orginal forecast file, find that date in the short run and do a rbind to add the rows to the orginal object and then reupdate the file. I might use different names for debug. But it should overwrite the orginal file when done. The purpose of this project is to get this feature with the mode either long backtest or update working. The code is there and untested. Also I am new to R.
I have a bunch more things to do here still. We will need to discuss so I can explain them to you.