Help - Indicator to calculate basis between spot index value and future price
In NinjaTrader 8 (B8), I am hoping to create an Indicator (or AddOn) which will return the basis between a spot index value and its associated front month future contract (where basis = future price - spot index value). I hope to use the basis in recent history to approximate the fair value of the future price (i.e. Spot index value + basis). Thus allowing me to execute a limit order futures trade (e.g. ES 03-16) from the index (e.g. ^SP500). For this application, the basis calculation must be correct (accepting that it is approximate)
Please find attached a spread chart of ES 12-15 vs ^SP500 (i.e. ESZ5 vs SPX).
The x-axis covers the period when ESZ5 was the front month futures contract (18 September - 17 December 2015).
The top frame shows the close prices of ESZ5 and SPX during NYSE trading hours (9:30am - 4:00pm ET) (1:30am - 8:00am Australia time) with a period of 30mins.
The bottom frame shows the basis (i.e. ESZ5 - SPX).
Again, thank you. I understand the mechanics of calculating basis, I understand the implications outside of cash hours.
I am looking for help in calculating it in NT8 via an Indicator (or AddOn). While it should simple, one DataSeries (future) minus another DataSeries (index), there appears to be an issue with the DataSeries being out of sync.
I imagine I am not the first to have encountered this problem and am looking for help.
I believe the below chart will help explain the issue I am looking to resolve.
The top frame shows the close prices for ^SP500 and ES 03-16 during cash hours.
The bottom frame shows TesSyncSeries which is calculated as ES 03-16 minus ^SP500 (attached).
At noted on the chart with two example points, TestSyncSeries returns something very different to ES 03-16 minus ^SP500.
Please register on futures.io to view futures trading content such as post attachment(s), image(s), and screenshot(s).
Looks like the second series you are adding in the indicator code is for a 1 minute period, this will not synchronise with a 30 minute base chart as Ninja infuriatingly uses end of bar timestamps not start of bar. (In NT7 and I'm assuming they have carried it over to NT8).
I correct for this in some of my stuff, but you would be simpler/better to ensure you use all same data series periods.
edit: I'm not sure this is what's happening as you aren't using Time in the calculation, so I'm probably just as puzzled, but I know it's a general issue to avoid.
edit2: In fact so puzzled that I just found an old difference indicator I had for NT7 and it works fine with 30 minute or 1 minute secondary series, maybe ask Ninja.
Last edited by ratfink; January 17th, 2016 at 09:39 AM.
Sierra charts calculating + indicating fib candle levels indicator?
2nd weWow! This place is truly overwhelming. Information overload!!
Pardon my ignorance, would anyone be kind enough to point me in the direction of an indicator for Sierra charts platform that is calculating and indicating the fibonacci candle levels please ?
Or provide an input if such an indicator exists for the Sierra platform or Ninja or Trade Station or TOS.
A humble thank you for your time responding to this query.
Oops, just realised my mistake in posting this query in here. Sincere apologies.
Last edited by zmaj; January 18th, 2016 at 04:45 PM.
My NT7 PlotDiff attached, it's pretty basic. I still don't really understand what you are seeing in NT8 unless it is the end of bar timestamps, but they're not used in the code you posted so I remain puzzled.
The following user says Thank You to ratfink for this post: