I am working on a multi-instrument trading strategy that will use the simple 1:1 crack spread as its price input as follows:
CrackClose[0] = 42 * Closes[1][0] - Closes[0][0];
I have made a simple Indicator (attached) that calculates the spread using above formula and happily runs with Calculate.OnPriceChange on a 15 min chart and updates the spread in real time. The values I see usually fall between the Bid-Ask as given by the TWS Intermarket Spread RB.CL OCT'16, which is as expected.
If I then set this indicator to Calculate.OnBarClose and let it run in real-time for a few 15min bars, the values it produces no longer match those from TWS. To add to the confusion, when I refresh the chart, the plot values that were built in real-time magically change and appear to again match those from TWS!
I am guessing this is a simple sync issue between the two instruments at bar close and not a bug, but I have no idea how to correct for this to ensure the correct spread value is available at the close of a 15MIN bar for a Strategy input...
Any help highly appreciated!
Thanks.
Im running B12 with IB data feed using TWS (latest).
Comment