Jump to content

Welcome to the new Traders Laboratory! Please bear with us as we finish the migration over the next few days. If you find any issues, want to leave feedback, get in touch with us, or offer suggestions please post to the Support forum here.

  • Welcome Guests

    Welcome. You are currently viewing the forum as a guest which does not give you access to all the great features at Traders Laboratory such as interacting with members, access to all forums, downloading attachments, and eligibility to win free giveaways. Registration is fast, simple and absolutely free. Create a FREE Traders Laboratory account here.

iwannatoscript

How to Built Continuos Contract

Recommended Posts

Hi guys,

 

i need help to merge these futures to built continuos contracts.

 

The main is to test trading system and see the difference between

 

feed of interactivebrokers and zenfire.

 

I use interactivebrokers and zen-fire.

 

I read that each single futures has own rule to built a continuos contract.

 

Is it possible a clear explaination and a step by step guide to do it.

 

I see that there also many algotrader, how do you manage your database?

 

I write down the main futures.

 

cbl: zt, zf, zn, zb,zq, dd, re, zdj, ym,

 

cme: 6e, 6s, 6n, rp, ry, rf, hc, 6j, 6b, e7, j7, nq, glb ge, pjy,

 

eurex: fdax, fstx,fesx, fgbm, fgbl, fgbs,

Share this post


Link to post
Share on other sites

1) I would suggest just posting a question in one place - that way it makes more sense to anyone trying to help you.

2) Everyone's continuous contract WILL BE DIFFERENT - it depends on when you roll, how you adjust etc;

3) understand why you need the continuous data. If you are comparing two data streams that you already have in a test - then you dont need to adjust the data yourself. Understand how the data adjustments work, why and this should answer a lot of your questions on how to.

(we did a lot of work in excel for it and its easy for this sort of stuff)

 

There is a website providing information such as unfair Advantage - CSI data and esignal that i know off to start.

I have some cut and paste notes that I made previously (probably from these sites)

....read and learn.

Back Tested Data Information essay.doc

Share this post


Link to post
Share on other sites

I find this rules

 

General Information on Futures Rollover CME CBOT

 

Quick Facts about Rollover Day

 

The following applies to many (if not most) futures contracts especially those from the Chicago Mercantile Exchange (CME) and Chicago Board of Trade (CBOT).

 

Rollover is 8 days before expiration.

Expiration is the third Friday of each quarter month (March, June, September, December)

The contract letter associated with each month is: March=H June=M September=U December=Z

Rollover is on a Thursday.

Rollover is usually on the second Thursday of the month but will be on the first Thursday if the first day of the month falls on a Friday

Volume shifts to the new contract at market open (09:30 EST) on Rollover day

New day trading or swing trading positions opened on rollover day should use the new contract month irrespective of when you plan to close it.

New swing positions might be better opened using the new contract if opened within a few days of rollover day.

Market myths abound at rollover and expiration. Check the source and confirm the probabilities before believing anything

 

Rollover day is when we switch from trading the contract that will expire this quarter to the contract that will expire the following quarter.

 

The futures contract that we focus on (the e-mini S&P500 or ES) expires on the third Friday of the months of March (H), June (M), September (U) and December (Z). The rollover days, however, are 8 days before expiration on the second Thursday of each of these months. These months have the letter designations H, M, U, and Z. Depending on the charting and trading platform that you're using you would usually have to switch your reference to the following month by letting the software know the contract and expiry month/year. On eSignal "ES H5" refers to the e-mini S&P contract that expires on the third Friday March 2005. Using eSignal and the #F designation it will switch to the new contract on the rollover day for you.

 

I have bit more to explain about how eSignal uses the #F designation to make rollover day easier for you. On Globex, the trading day starts at 16:30 EST the evening before the "day" and ends at 16:15 EST on the "day." So, for example, Thursday's trading session starts at 16:30 EST on Wednesday and ends at 16:15 EST on Thursday. If you have a chart that is plotting the symbol ES #F, then this chart will switch the symbol that is being plotted at the start of the Rollover Day which in this case is actually 16:30 EST before the "day" which in our case is the second Thursday in each quarter. So the symbol swap happens at 16:30 EST on the Wednesday before that Thursday.

 

Why is this useful? If you have 15 charts that plot several E-mini contracts on several timeframes then you have to manually edit each chart and change the symbol from the current to the next quarter. If you've specified #F then this will happen automatically for you and save you from forgetting or missing a chart - especially if you have multiple pages/layouts of charts that you load.

 

When and why you should switch from trading one contract to the next?

 

Liquidity switches from the current contract to the next contract at 09:30 EST on rollover day. This can be seen by comparing the volume (number of contracts traded) in the old and new contracts in the charts below. [Note that the scale on the volume part of the charts is different for the near and far expiry months because of the rollover effect and traders switching to the far contract.]

 

If you are opening a new position in the ES before 09:30 that you plan to close during the day or perhaps before 09:30 you could use the near contract but you must remember that the spread will start widening as traders start switching out of this contract and you will struggle to get as favorable a price as you would with the next contract.

 

The general rule here is that you want to get into the next contract as liquidity moves from one to the other. At this point in time (09:30 EST on rollover day) the spreads will be tightest and you will lose the least amount on the spread as you switch contracts. This is especially important for swing and longer term traders that may want to carry their positions past the expiry date.

 

If you are opening a new position that you intend to carry for more than an hour and it's 09:00 EST on rollover day then you are better off trading the next (new) contract.

 

What else happens on rollover day?

 

You may hear plenty of myths and "truths" about rollover and expiry days. Don't believe any of it until you have seen it several times or have back tested this and verified it. I have heard many traders say: "They always mark it up on rollover day" or "stay away from rollover day because it is choppy and impossible to trade."

 

First of all do your own back testing and investigations before you believe any of this. Start off by looking at the charts on this page and see if any of them (all from rollover days) match what you have heard. Then get some data from previous rollover days and see what happen on those days. Even daily data will allow you to compute the change from open to close or from previous close to rollover day close.

 

There is no reason for the market to act any differently on rollover days. Scalpers, day traders, swing traders and longer term investors balance each other out. Traders trading large size contracts know that they risk moving the market if they are rolling from one contract to the other and so they break their positions up into more manageable sizes and move their contracts in partials in order to get the best execution prices. Traders are not focusing on the rollover process but instead on strategies that will make them money. They want to move to the next contract at the best possible prices and lowest possible costs. The rollover process is merely a mechanical necessity of the market.

 

There are (allegedly) pit traders that just specialize in the days around rollover. They only trade these days (I have no idea what they do for the other 10 weeks in between rollovers but this is what I've been told) and they trade the widening spread in the expiring contracts. For whatever reason there are longer term traders that don't close out and roll their contracts at the optimum time. These rollover "specialists" will make a market (at a wider than normal spread) in the expiring contract and (apparently) make a very good living out of the rollover process.

Share this post


Link to post
Share on other sites

good .....read, all this, understand what it is all about, then ask specific questions, as otherwise you will get a lot of repetitive information without learning anything new if you dont understand the basics.

Knowing a little about rollovers, why and how etc is a start. BUT it is not going to actually build a continuous contract.

 

To build a continuous contract, you basically need to back adjust all the previous months data to eliminate the backwardation and contago and treat the data as though it was one continuous contract. This will mean that a continuous contract when adjusted will not look anything like the past data contracts - but will in fact give a "true" return on what the contract looked like had you rolled - based on the rules set for the adjustments for the rollover - everytime. Just as if you had bought and held a contract.

 

Hint: to understand it use a small section of data in an excel column over a period where a rollover occurs, and adjust the data to see what happens and how it charts to give you a better idea.

Share this post


Link to post
Share on other sites

I also managed to stumble across this today from another forum. Note the second paragraph which mentions proportional adjusting....

 

"Futures are back adjusted correctly in a simple arithmetic fashion, in that the spread is removed during the splicing. So the entire data series is adjusted up or down so that the P&L is correct when holding a position over a long period of time, and over many rolls. It is OK in this case for the data to go negative.

 

If you adjust your futures data proportionally in order to avoid negative prices, you are changing the actual P&L amounts for longer term trades. And in addition the early date trades will be less profitable than actual due to the compression of the price data. This is the incorrect way to back adjust futures data. "

Share this post


Link to post
Share on other sites

Here's an old explanation of the various back adjusting options by a guy from the TS2000 forum's, Bob Fulks.

 

FWIW my personal approach is:

 

1. swap to the new contract when the volume is/will be higher that day

2. look at the opening, closing, and some recent highs and lows to seek a consensus price.

3. adjust the old contracts based on this.

 

Why do I use consensus rather than open or close? Because I care about Support and Resistance and if the swing highs and lows suggest a different adjustment then its probably right for S&R comparisons.

 

My 2c.

 

.

cntcontr.pdf

Share this post


Link to post
Share on other sites

thanks Kiwi - I wish I had the Bob Fulks article when we did it - might have saved some time.

 

The consensus adjustment is an interesting one, as I assume you are talking about trying to work out a fair adjustment value - not just the difference in close prices on the day of the adjustment.

(If this is the case) it makes sense to add a bit of discretion - do you do this everytime there is a roll when building continuous contracts from the past - or only on the ones AS you are building going forward? (hope that makes sense)

Also I would have thought the most accurate adjustment going forward would be one whereby when you decide to roll the actual price differentials between the last trades (or the bid/ask) as if you actually did the trade would be preferable?

Share this post


Link to post
Share on other sites

Its all a matter of why you're doing it.

 

If testing long term systems you are trying to approximate the actual results. So in 2000 I would have told my broker "roll at open" and he would have. So I'd use opens.

 

Now I'm interested in creating a contract where the S&Rs from the recent past are meaningful. But only to an extent ... so I don't overdo the work side of it. I build my contract as it goes but if I have to start fresh I do exactly the same thing ...

 

I put both contracts up then follow the process above to set the adjustment on the first one.

Then I do it for the continuous + the next month

and so on :)

Share this post


Link to post
Share on other sites

CSI data - unfair advantage offers this - but its not cheap.

Ultimately you should use excel and build your own as there are many ways to do it.

I dont know of any indicators that do it (I am not very good in this area though)

 

Plus how in the hell do you expect to be able to build a continuous contract without a data feed of some sort.....???? randomly generated numbers.

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Topics

  • Posts

    • Date: 22nd November 2024.   BTC flirts with $100K, Stocks higher, Eurozone PMI signals recession risk.   Asia & European Sessions:   Geopolitical risks are back in the spotlight on fears of escalation in the Ukraine-Russia after Russia reportedly used a new ICBM to retaliate against Ukraine’s use of US and UK made missiles to attack inside Russia. The markets continue to assess the election results as President-elect Trump fills in his cabinet choices, with the key Treasury Secretary spot still open. The Fed’s rate path continues to be debated with a -25 bp December cut seen as 50-50. Earnings season is coming to an end after mixed reports, though AI remains a major driver. Profit taking and rebalancing into year-end are adding to gyrations too. Wall Street rallied, led by the Dow’s 1.06% broadbased pop. The S&P500 advanced 0.53% and the NASDAQ inched up 0.03%. Asian stocks rose after  Nvidia’s rally. Nikkei added 1% to 38,415.32 after the Tokyo inflation data slowed to 2.3% in October from 2.5% in the prior month, reaching its lowest level since January. The rally was also supported by chip-related stocks tracked Nvidia. Overnight-indexed swaps indicate that it’s certain the Reserve Bank of New Zealand will cut its policy rate by 50 basis points on Nov. 27, with a 22% chance of a 75 basis points reduction. European stocks futures climbed even though German Q3 GDP growth revised down to 0.1% q/q from the 0.2% q/q reported initially. Cryptocurrency market has gained approximately $1 trillion since Trump’s victory in the Nov. 5 election. Recent announcement for the SEC boosted cryptos. Chair Gary Gensler will step down on January 20, the day Trump is set to be inaugurated. Gensler has pushed for more protections for crypto investors. MicroStrategy Inc.’s plans to accelerate purchases of the token, and the debut of options on US Bitcoin ETFs also support this rally. Trump’s transition team has begun discussions on the possibility of creating a new White House position focused on digital asset policy.     Financial Markets Performance: The US Dollar recovered overnight and closed at 107.00. Bitcoin currently at 99,300,  flirting with a run toward the 100,000 level. The EURUSD drifts below 1.05, the GBPUSD dips to June’s bottom at 1.2570, while USDJPY rebounded to 154.94. The AUDNZD spiked to 2-year highs amid speculation the RBNZ will cut the official cash rate by more than 50 bps next week. Oil surged 2.12% to $70.46. Gold spiked to 2,697 after escalation alerts between Russia and Ukraine. Heightened geopolitical tensions drove investors toward safe-haven assets. Gold has surged by 30% this year. Haven demand balanced out the pressure from a strong USD following mixed US labor data. Silver rose 0.9% to 31.38, while palladium increased by 0.9% to 1,040.85 per ounce. Platinum remained unchanged. Always trade with strict risk management. Your capital is the single most important aspect of your trading business.   Please note that times displayed based on local time zone and are from time of writing this report.   Click HERE to access the full HFM Economic calendar.   Want to learn to trade and analyse the markets? Join our webinars and get analysis and trading ideas combined with better understanding of how markets work. Click HERE to register for FREE!   Click HERE to READ more Market news. Andria Pichidi HFMarkets Disclaimer: This material is provided as a general marketing communication for information purposes only and does not constitute an independent investment research. Nothing in this communication contains, or should be considered as containing, an investment advice or an investment recommendation or a solicitation for the purpose of buying or selling of any financial instrument. All information provided is gathered from reputable sources and any information containing an indication of past performance is not a guarantee or reliable indicator of future performance. Users acknowledge that any investment in FX and CFDs products is characterized by a certain degree of uncertainty and that any investment of this nature involves a high level of risk for which the users are solely responsible and liable. We assume no liability for any loss arising from any investment made based on the information provided in this communication. This communication must not be reproduced or further distributed without our prior written permission.
    • A few trending stocks at support BAM MNKD RBBN at https://stockconsultant.com/?MNKD
    • BMBL Bumble stock watch, pull back to 7.94 support area with high trade quality at https://stockconsultant.com/?BMBL
    • LUMN Lumen Technologies stock watch, pull back to 7.43 support area with bullish indicators at https://stockconsultant.com/?LUMN
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.