Help - Indicator to calculate basis between spot index value and future price - NinjaTrader | futures io social day trading
futures io futures trading


Help - Indicator to calculate basis between spot index value and future price
Updated: Views / Replies:1,191 / 11
Created: by shansen Attachments:7

Welcome to futures io.

(If you already have an account, login at the top of the page)

futures io is the largest futures trading community on the planet, with over 90,000 members. At futures io, our goal has always been and always will be to create a friendly, positive, forward-thinking community where members can openly share and discuss everything the world of trading has to offer. The community is one of the friendliest you will find on any subject, with members going out of their way to help others. Some of the primary differences between futures io and other trading sites revolve around the standards of our community. Those standards include a code of conduct for our members, as well as extremely high standards that govern which partners we do business with, and which products or services we recommend to our members.

At futures io, our focus is on quality education. No hype, gimmicks, or secret sauce. The truth is: trading is hard. To succeed, you need to surround yourself with the right support system, educational content, and trading mentors Ė all of which you can find on futures io, utilizing our social trading environment.

With futures io, you can find honest trading reviews on brokers, trading rooms, indicator packages, trading strategies, and much more. Our trading review process is highly moderated to ensure that only genuine users are allowed, so you donít need to worry about fake reviews.

We are fundamentally different than most other trading sites:
  • We are here to help. Just let us know what you need.
  • We work extremely hard to keep things positive in our community.
  • We do not tolerate rude behavior, trolling, or vendors advertising in posts.
  • We firmly believe in and encourage sharing. The holy grail is within you, we can help you find it.
  • We expect our members to participate and become a part of the community. Help yourself by helping others.

You'll need to register in order to view the content of the threads and start contributing to our community.  It's free and simple.

-- Big Mike, Site Administrator

Reply
 7  
 
Thread Tools Search this Thread
 

Help - Indicator to calculate basis between spot index value and future price

  #1 (permalink)
Elite Member
Melbourne, Australia
 
Futures Experience: Intermediate
Platform: NinjaTrader
Favorite Futures: ES
 
Posts: 16 since Aug 2013
Thanks: 1 given, 4 received

Help - Indicator to calculate basis between spot index value and future price

Forum,

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).
As you can see, basis converges to zero at contract expiry. While not required for this discussion, the reasons can be found in CME - Understanding stock index futures.

Please find attached
  • The spread chart for the current contract ES 03-16 (ESH6) over the period when it is the front month contract (18 December - current). It shows basis has ranged between -11 and -6 points.
  • The output from the TestSyncSeries Indicator, which aims to replicate this analysis (noting the only data of interest is on/after 18 December). It shows basis has ranged from -150 to 0 points.
Thus, I believe the two series ES 03-16 and ^SP500 are not aligned.

Any ideas on how to correctly calculate basis in NT8 would be greatly appreciated. If it is of help, the NT data provider is Interactive Brokers (IB).

This conversation is also at the NT Forum.

As always, thanks
Shannon

Attached Thumbnails
Help - Indicator to calculate basis between spot index value and future price-esz5-spx.png   Help - Indicator to calculate basis between spot index value and future price-esh6-spx.png   Help - Indicator to calculate basis between spot index value and future price-nt-testsyncseries.png  
Reply With Quote
 
  #2 (permalink)
Elite Member
Omer עומר / Israel י
 
Futures Experience: Master
Platform: NinjaTrader, Proprietary,
Broker/Data: Ninjabrokerage/IQfeed + Synthetic datafeed
Favorite Futures: 6A, 6B, 6C, 6E, 6J, 6S, ES, NQ, YM, AEX, CL, NG, ZB, ZN, ZC, ZS, GC
 
rleplae's Avatar
 
Posts: 2,489 since Sep 2013
Thanks: 1,704 given, 3,694 received
Forum Reputation: Legendary


shansen View Post
Forum,

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).
As you can see, basis converges to zero at contract expiry. While not required for this discussion, the reasons can be found in CME - Understanding stock index futures.

Please find attached
  • The spread chart for the current contract ES 03-16 (ESH6) over the period when it is the front month contract (18 December - current). It shows basis has ranged between -11 and -6 points.
  • The output from the TestSyncSeries Indicator, which aims to replicate this analysis (noting the only data of interest is on/after 18 December). It shows basis has ranged from -150 to 0 points.
Thus, I believe the two series ES 03-16 and ^SP500 are not aligned.

Any ideas on how to correctly calculate basis in NT8 would be greatly appreciated. If it is of help, the NT data provider is Interactive Brokers (IB).

This conversation is also at the NT Forum.

As always, thanks
Shannon


You are looking at the contango and backwardation values.

These values are fundamentally driven by :
- time (period left up to the expiry of the future)
- volatility

In a correct situation, the indicator most likely will calculate the spread between the two instruments based on a tick basis.

During the cash market, that should not be an issue
however the future trades 23/24 and 5/7 while the cash market does not

Outside the cash market, you will see the spread widening and going back
to normal at the opening of the cash market

The result shown in NT8 is most likely not correctly handling the fact that both series don't align...
The easiest way is to manually calculate a few points (draw both charts seperate)

Reply With Quote
 
  #3 (permalink)
Elite Member
Melbourne, Australia
 
Futures Experience: Intermediate
Platform: NinjaTrader
Favorite Futures: ES
 
Posts: 16 since Aug 2013
Thanks: 1 given, 4 received


rleplae,

Thank you for your response. I agree:
  • the result shown in NT8 is most likely not correctly handling the fact that both series don't align.
  • it is be possible to manually calculate.

However, I require the calculation to be automated.
Any ideas / experience in automating the calculation would be greatly appreciated.

Thanks again
Shannon

Reply With Quote
 
  #4 (permalink)
Elite Member
Omer עומר / Israel י
 
Futures Experience: Master
Platform: NinjaTrader, Proprietary,
Broker/Data: Ninjabrokerage/IQfeed + Synthetic datafeed
Favorite Futures: 6A, 6B, 6C, 6E, 6J, 6S, ES, NQ, YM, AEX, CL, NG, ZB, ZN, ZC, ZS, GC
 
rleplae's Avatar
 
Posts: 2,489 since Sep 2013
Thanks: 1,704 given, 3,694 received
Forum Reputation: Legendary


shansen View Post
rleplae,

Thank you for your response. I agree:
  • the result shown in NT8 is most likely not correctly handling the fact that both series don't align.
  • it is be possible to manually calculate.

However, I require the calculation to be automated.
Any ideas / experience in automating the calculation would be greatly appreciated.

Thanks again
Shannon

This is not too difficult, when the cash market is closed, you just need to take the last available price
knowing that this is not correct, the spread will be correct when cash market is open

Reply With Quote
 
  #5 (permalink)
Elite Member
Melbourne, Australia
 
Futures Experience: Intermediate
Platform: NinjaTrader
Favorite Futures: ES
 
Posts: 16 since Aug 2013
Thanks: 1 given, 4 received


rleplae View Post
This is not too difficult, when the cash market is closed, you just need to take the last available price
knowing that this is not correct, the spread will be correct when cash market is open

Rleplae,

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.

Reply With Quote
 
  #6 (permalink)
Elite Member
Melbourne, Australia
 
Futures Experience: Intermediate
Platform: NinjaTrader
Favorite Futures: ES
 
Posts: 16 since Aug 2013
Thanks: 1 given, 4 received

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).


Any suggestions are welcome.

Regards
Shannon

Attached Files
Register to download File Type: zip TestSyncSeries.zip (3.0 KB, 3 views)
Reply With Quote
 
  #7 (permalink)
Elite Member
Birmingham UK
 
Futures Experience: Intermediate
Platform: NinjaTrader
Broker/Data: IG/eSignal
Favorite Futures: Dax
 
ratfink's Avatar
 
Posts: 3,336 since Dec 2012
Thanks: 11,276 given, 7,090 received


shansen View Post
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.

Any suggestions are welcome.

Regards
Shannon

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[0] 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.


Cheers

Travel Well
Attached Thumbnails
Help - Indicator to calculate basis between spot index value and future price-dax-30-min-14h37m53s.png  

Last edited by ratfink; January 17th, 2016 at 10:39 AM.
Reply With Quote
 
  #8 (permalink)
Elite Member
Melbourne, Australia
 
Futures Experience: Intermediate
Platform: NinjaTrader
Favorite Futures: ES
 
Posts: 16 since Aug 2013
Thanks: 1 given, 4 received

ratfink,

Thanks to your response.

I am happy to see it is just me experiencing this problem.
Could I press you for a copy of your old NT7 difference indicator via the forum (or PM).

Again, thank you
Shannon

Reply With Quote
The following user says Thank You to shansen for this post:
 
  #9 (permalink)
Elite Member
Miami, USA
 
Futures Experience: Advanced
Platform: Abdominal Plank
Favorite Futures: Energy Drinks
 
zmaj's Avatar
 
Posts: 626 since Jan 2016
Thanks: 379 given, 878 received

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 05:45 PM.
Reply With Quote
 
  #10 (permalink)
Elite Member
Birmingham UK
 
Futures Experience: Intermediate
Platform: NinjaTrader
Broker/Data: IG/eSignal
Favorite Futures: Dax
 
ratfink's Avatar
 
Posts: 3,336 since Dec 2012
Thanks: 11,276 given, 7,090 received


Hi @shansen,

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.

Cheers

Travel Well
Attached Files
Register to download File Type: zip PlotDiff.zip (2.3 KB, 3 views)
Reply With Quote
The following user says Thank You to ratfink for this post:

Reply



futures io > > > > Help - Indicator to calculate basis between spot index value and future price

Thread Tools Search this Thread
Search this Thread:

Advanced Search



Upcoming Webinars and Events (4:30PM ET unless noted)

Jigsaw Trading: TBA

Elite only

FuturesTrader71: TBA

Elite only

NinjaTrader: TBA

Jan 18

RandBots: TBA

Jan 23

GFF Brokers & CME Group: Futures & Bitcoin

Elite only

Adam Grimes: TBA

Elite only

Ran Aroussi: TBA

Elite only
     

Similar Threads
Thread Thread Starter Forum Replies Last Post
How to calculate price of a contract? jirakst Commodities Futures Trading 6 July 14th, 2015 12:23 PM
Contract price not matching underlying index price. Bukwang Emini Index Futures Trading 12 July 3rd, 2015 10:04 AM
Indicator for predicting future stock price movement? 00Frenchy00 ThinkOrSwim 5 April 8th, 2015 02:59 PM
Natural Gas (NG) Spot Price marcopolo1 Commodities Futures Trading 9 June 30th, 2014 05:08 PM
Trading Price Action on EURUSD Spot FX isaacsu Trading Journals 22 May 14th, 2014 05:47 PM


All times are GMT -4. The time now is 02:35 AM.

Copyright © 2017 by futures io, s.a., Av Ricardo J. Alfaro, Century Tower, Panama, +507 833-9432, info@futures.io
All information is for educational use only and is not investment advice.
There is a substantial risk of loss in trading commodity futures, stocks, options and foreign exchange products. Past performance is not indicative of future results.
no new posts
Page generated 2017-12-14 in 0.16 seconds with 20 queries on phoenix via your IP 54.221.76.68