Profile Picture

Lookback to Datastore?

Posted By ophth1 Last Year
Message
Posted Friday April 29 2016
Hi! I want to use in a trading algorithm also the past performance of e.g. the last 3 days. It is easy to setup a second frequency (daily) to the 1m bars of the system. However, using the bars.lookback funktion I can only lookback to those bars which were already aquired during the current trading period of the running system. Thus, using additional bars for 3 days, the trading system would start only on day 4th. However, all the data are already available in the datastore (from historical data IB or from previous runs). Is it anyway possible to have a kind of lookback function into the data of the datastore instead of the aquired bars of the currently running system? Would save so much time and all the data are already there in the datastore... thanks!! best wishes
Posted Monday May 02 2016
Are you doing a backtest or live trading?  In any case in the trading system properties you can configure it to use more data for "lead bars" before the system can start trading.  For backtests, you can set either the "Lead Bars" property or set the "Data Start Date" separately from the "Trade Start Date".  For live systems, you can set the "Live Lead Bars" or the "Live Data Start Date".

Either way, in your system code you can check SystemData.LeadBars to determine whether you are in the lead bars or not, and avoid trading if you are (the position manager will also reject any orders you try to send during the lead bar period).

Thanks,
Daniel
Posted Monday May 02 2016
Hi and thanks! But this does not really answer my question. It's for both, backtesting and live trading. In both cases I have all the data (bars or ticks) for the previous days already in the datastore. Following your way as described, I would have to wait for e.g. 3 days having the system doing nothing, if I want to use in the algorithms the data of the last 3 days. (Because the lead bars would then be all the bars of the first 3 days...). This makes no sense, because everytime you would start the system, you would have to wait e.g. 3 days although all data are already in datastore. Same for backtesting, then you have "virtually" leadbars for the first 3 days. Thus, my question is, can I access in a running system the historical data in the datastore to see the past performance of a symbol in the last days? We can make the story even worst: what about if you want to consider the past performance of the last year, what then, waiting for the lead bars of one year?? THANKS!!!! best wishes
Posted Monday May 02 2016
With live trading, the lead bars are loaded from your historical data and processed by your system before it switches over to live data.  So you don't need to wait 3 days with the system running, you just set the "Live Data Start Date" to 3 days ago, and when you run your system, it will first process the historical bars from the past 3 days as lead bars.

With RightEdge, all of the price data is processed the same way: It comes in from the historical data store or live data, is aggregated into the bar frequencies you are using, gets processed by the paper broker (if applicable) and then your indicators and your system code itself.  I think it's good to be consistent here.  For example, you don't have to worry about what happens if the data in the data store isn't the frequency you want, or how to calculate indicators based on bars from the data store from before the system started.  All of this, as well as a simple lookback, just works as you would expect it with lead bars.

So the simple answer is no, it's not possible to have a lookback before the data start date of the system.  Of course, that's using RightEdge's built-in functionality.  You could always instantiate the IDataStore plugin yourself in your system code and load the data by using the plugin directly.  But I think you'll find it much simpler to just use lead bars for this. :-)

Does this help address your concerns and explain why it works the way it does?

Thanks,
Daniel


Similar Topics


Reading This Topic


2005-2017 © RightEdge Systems