Autotrading IB : Futures Rollover and Expiration

Forums ProRealTime English forum ProRealTime platform support Autotrading IB : Futures Rollover and Expiration

Viewing 5 posts - 1 through 5 (of 5 total)
  • #221103

    Hi All – I thought to make a topic for this, so it can be a reference.
    This is about AutoTrading Futures with PRT-IB (not -IG).
    Please notice that ProRealTime is working on changes regarding the Roll Over period, so in due time the content of this topic may be amended.


    The subject is especially “difficult” because PRT development don’t trade (Futures) much themselves, and the experience for them has to come through you and me. This, while only once per 3 months the real experience is digested because Financial Future contracts tend to change once per 3 months only – think Nasdaq, S&P500, Russel2000. In Europe we also have a few of those, e.g. DAX40, STOXX50, MIB40. Futures may also have 1-month contracts, like in Europe we have CAC40, IBEX35 and AEX25.

    At the moment a new contract emerges for a Future (all at long in advance pre-set dates), changing our charts can be painful. For ProRealTime development this is apparently so difficult, that for more than 3 years I am trying to tell them how the warning messages about contracts due to-end-and-renew messages should be formed. They still don’t have it right. A newcomer will be lost and won’t know what to do for real, or his/her charts with running contracts (open positions) will have disappeared without knowing why (but caused by giving the wrong/correct answers to the wrong questions by the PRT platform). The “Roll Over” period is quite killing and it does need attention. Doing nothing probably means losing money. Setting things right, can take hours for your various charts in various accounts). Hours of time you must have, and most often are brought to your attention unexpectedly.


    A few terms

    • Contract : A position with a Future with a fixed end date, but where you may end the contract earlier (and a little later too).
    • Expiration : The end date just mentioned.
    • Roll Over : At least for PRT (read : the platform) the one moment in time that the old contract is proposed to (better) be a new contract. It is the date/time that PRT proposes that your old Future charts should be replaced by new Future charts. For an example of an old chart see in attachment-1.  Today it is the last day of an old contract (0923), while 1223 is already active.
    • Roll Over Period : A mere vague definition by myself : the period that it could be better to trade the new contract over the old contract. For 3-month contracts this period is about a week (so the Roll Over (date) for the example you see below was a week ago). But, for 1-month contracts this is 2 days or less.
    • Expiration Date/Time for the various contracts : Different for each Future Contract. The Nasdaq you see below expireD this morning 08:30 (Amsterdam), and the S&P 500 expireS this afternoon 16:15. You can not buy contracts of a Future which is passed its Expiration Date/Time.
    • Slippage : The money you may lose (or gain !) because of insufficient volume on the instrument. Thus, e.g. you sell on a Limit, the price is touched, but before the order is completely filled the price can have changed vastly; nobody wanted to buy your contract(s) and the price changes further.

    I am live for only 3 months. I am not familiar with consequences of Futures contracts expirations. Do you know What happens when a future contract expires? I mean what is the impact for our algos? Does it close all open positions at contract expiration? Is there a unpredictable slippage at closure?

    With this as a live question, and knowing that quite some more people asked the same question already, let’s try to form some answers.
    Keep in mind, this topic is for PRT-IB. With PRT-IG this all does not apply at all.

    We can well say that Slippage is the thing to deal with. Thus, when a contract is near to its end, fewer people will buy new of the same, so the longer you wait, the more Slippage will occur.
    On a side note you can trade on the fact that people, well, trade on this fact. It becomes similar to a penny stocks, and large jumps in price start to occur towards the end of the contract. And you can just benefit from that. It may be a bit of gambling, but there is nothing wrong with trading instruments without real volume. And this is exactly what is important when we try to deal with AutoTrading.

    So, contracts expire, and within PRT-IB there is no provision (yet ?) to automatically renew a contact. This means that your (AutoTrading) System must anticipate the end date/time of the contract. But  what does this mean in practice ?

    First off, your System should normally not hold positions longer than the Roll Over Period. This is actually a clear matter, because if your System may hold a position for 3 weeks, while the Roll Over Period is 7 days, up to less than 2 days for the 1-month contracts, then it will be forced to an end. N.b.: I don’t know how that will turn out for the System itself – I expect that it will be killed from the PRT Server. The Contract itself will just end (your position will be Exited automatically – just like it happens with Manual trading and doing nothing.

    This may all come across as difficult, but it’s really quite fine;
    Nothing prevents you from starting a position in a contact which is, say, a week ahead of the Roll Over. In this regard, notice that there is no law or rule that forces a trader to start trading the new contract  at the date that PRT says the roll over “is”. It is, however, a rule of the thumb that the large institutions will start considering new contracts at that date. But try it a week earlier and you will see that that works too. I hope I can say it like this, for Futures : Just less traders to sell you the position you want to buy (for Short the other way around).  So, just some more Slippage. But, as long as you use Limit orders to buy, there will be other Market orders to fill your position anyway.
    When we again look at the attachment below, we see that that contract involved has already expired. Eh … huh ? yes, same thing as in advance of the Roll Over. It will still work for a couple of days. But, there will be an end to it for sure and because I myself don’t know when exactly that is, you better anticipate this set Expiration date and time (in the first attachment you see this Expiration data/time mentioned, for this Micro Nasdaq).

    In the second attachment you see a virtual situation which you could “trade” as such. This is the Mini Nasdaq and it expires this afternoon 15:30. Now :
    Suppose that this originally was an AutoTrading System, and that towards the Expiration I killed that System. In my settings it is set that the position should stay. I like the now virtual System to make some profit, while it is in a loss. So I await the moment to put a nice Trailing stop, which I 15 minutes ago put there. Thus, I first changed the AutoTrading System to a manual operation, and now make the best of it.
    Compare this with the first attachment, where I let run that AutoTrading System. In that situation I don’t care how it ends, because it *will* end this day (per SL or per the internally set profit) and AutoTrading should do its thing. It will win or it will lose. It is hardly dependent on Slippage and if it is after all, I don’t care much.

    So you see two different approaches on how to let this run to an end, and maybe you know more and better methods. Fact is that you always must be there to deal with it.

    When it is the situation of the first attachment (just let it end), take care that you kill the System from the PRT Server before it opens a new position. And again it is better to do this “yesterday” or even earlier, then on the very last day (you may run out of control because of a lack of volume).

     


    Systems and versions

    While you see the 0923 contracts, PRT provides the XXXX contracts. These are for Backtesting and IMO should never be used for AutoTrading itself. This is again about how PRT deals with the charts, because at the Roll Over Date PRT will replace the underlaying contract with the new one, and your position seems gone. Dangerous of course, because in reality it is still there. And worse : It is the System which is still there, also when it coincidentally is out of a position. This is how you always should use the “Only” contract, like the Only 0923 you see below. If the PRT platform starts and asks you to replace charts, always answer No, because it will never be a good thing, or it already happened because you did so yourself.

    Next up is how to go about with the new contract and your actually still existing fine system. Well, too bad, but you will need to make a copy of it, and load it under the new contract (1223 in this case). Do (again) never make the mistake to load it under an XXXX virtual contract, never mind you used exactly that for Backtesting**; would you use the XXXX contract to load new Systems, then you will never know under which contract you fire it up. You must always do this explicitly, be that for the old contract or be that for the new contract. This means that you must be able to see it, and this is not possible with XXXX in the name.
    Anyway, if you try to start the old System under the new contract, it won’t work. So internally the “Only” name must match the name in the System – which internally bears the “Only” name and which you can see in the ProOrder screen (once it has been put there by you).

    **): Using an “Only” contract for backtesting is not possible because of the lack of historical data (3-4 months max). Well, it is possible, but you won’t have good results because of all of the gaps which start to emerge further back in history. Notice that “the lack of historical data” is just the contract which is not traded any more. And you can do the test regarding when it really expires : run a backtest of 6 months on 0923 on say October 1, and you will see that there is still data. This is because my first attachment still ran and sold somewhere underway. :-). I recall that one month of old contract data is always there (thus trades too).

    Never forget to kill the System from the PRT Server (hence ProOrder) because it will keep on trading until the Expiry date/time. Logically you would perform this kill definitely when the new System is up and running. Also notice that during the Roll Over Period, two Systems on the same instrument are allowed – one for the old contract and one for the new contract. Never forget that logically you will have one “Only” chart on screen, if that is not the one and only existing XXXX to begin with. In either case you will see one position only, while you might have allowed for two.
    Of course you can have both the old and new contracts/charts on screen, which is what I always do until I got rid of the position (and System) of the old contract. And Save. And Save to an extra Template because of all the effort in changing all.


    When to hop over

    Although this is merely a question for manual trading (the AutoTrading you can deal with now), I see many people wondering about this. Keep in mind, this is almost exclusively about Slippage only;

    During the week after the Roll Over date, more and more traders will trade the new contract. This means that more and more you will get the prices you see (at least for your Market orders). But what is the cross over point ?
    Well, that will be the point that the new contract bears more volume than the old contract. Easy ! (and the volume you can watch as an indicator in its separate pane). Of course you need the two “Only”” versions side by side for this.


    One final point about the difference in price for the old and new contract. Look in the third attachment.

    Apart the gaps you see emerging in the old contract (in the top) you also see a difference in price. This is the interest you pay in advance. In layman terms (because I don’t know all about it myself) you can see it such that you buy the new contract today, but are expected to sell it after 3 months. So you are expected to keep it for 3 months just the same. As you can see, the difference in price is significant.

    I am not exactly sure how this unwinds, but let’s say that if I’d have the new contract and sell it next week, the price is about the same, but dropped a little anyway. So I get back less than when I bought it and the difference is the interest I must pay (which in itself is significant lately). So you can nicely see by means of the third attachment how the price of the old contract dropped significantly, because of all the interest I payed over 3 months (envision that I had that contract for 3 months indeed and that I payed more back then, than what it is worth today and that the difference is per the amount what you see here).
    I don’t think there’s any trading deals in this interest difference, but of course I’m thinking “what happens when I had bought today’s new contract one month ago ?”. I never looked into that.

    If you enjoyed this “article”, give me a thumbs up and I will know and I might do other articles (with various subjects in mind, encouraged by questions I see passing by).

    Happy Futures Auto Trading !
    Peter

    4 users thanked author for this post.
    #221121

    One thing to add already :

    The Expiration Dates/Times are not consistent for Mini and Micro versions. Also, they seem to be local to the country of origin. Thus, the 08:30 shown for the MNQ appears to be 15:30 (Amsterdam) for us.
    How do I know ? because that came to a stand still at that time. No price movement. Thus no “few days more” trading either.

    Additional information :

    The System in ProOrder kept on running. At least for this afternoon.
    I killed that System and the position became virtually tradeable (the red cross – at first greyed out – now became red).
    Nothing can be done with that position. Try to cross it away and a Market order appears – not greyed out, but also not doing anything. Cross away that Market order and the platform resets (this implies a communication malfunction between PRT and IB).
    So the position is still there. At 15:30 – when in standstill already – it had a profit of  USD 361. That changed 30 minutes later to 113. The Market order also changed with 10 or so points for the worse.

     

    Conclusion

    It is definitely not advisable to wait until the expiration. Start in time with unwinding. Keep in mind that the 1 month contracts give less than 2 days of Roll Over Period, and that you most probably want to be ahead of *that*.
    If you don’t have charts open in 3 months contracts, you will not be warned “early” (by those which give you a week) for the 1-month due expiring Futures, unless 2 days is enough for you. But keep in mind that you first need to start the PRT platform in order to receive the warning messages. This is how 2 days become less than 2 days.
    Notice that the expiry days of the week are almost equal for 3-months and 1-month contracts (the difference may be Thursday vs Friday always of the same week). So you can be warned indeed by 3-months “open charts” for the 1-month Futures you have positions in.

    If you have open positions that are expiring “today”, you will receive emails like you see below.
    And … If it goes like coincidentally this morning, you can’t get rid of them, as I tried to explain today in an other topic. Thus, you should also take into account (more rare) external failure like this morning; if you can’t start the PRT platform and you did not arrange for the Future endings, then there you are.
    Thus be in time !

    2 users thanked author for this post.
    #221215

    Hello,

    It is only recent so i guess it’s not available yet on PRT Trading but as you can see in the attachment, on PRT Software we can now see on the full contract the positions and orders of every other contracts, it is also easier to switch between one and the other. I guess it will help you considering your problematic.

    I hope it will soon be available on PRT Trading 🙂

    Theo.

    1 user thanked author for this post.
    #234070

    Hello

    Do you know if any function has been implemented that can handle the roll over on the new contract? I am in the condition of having an open position since last week on the MES future and the system still has not triggered a close signal so I need to roll over tomorrow on the new contract. If I kill the system, then the position is not reopened.
    If there is no function yet, I think PRT should come up with something because it is unthinkable to offer the possibility of having systems on futures without having roll over management mechanisms. How to ask this?

    Thanks

    #234071

    Hi there,

    Unfortunately that is a No.

     

    PRT should come up with something because it is unthinkable

    Don’t worry because more misery will cross your path – like that the change since June 17 (see your email from a couple of weeks back) will cause your positions to be closed when whatever of the numerous communication errors with the broker occur. For now this is about IBKR only (this is stipulative). Mind you please, this is despite the setting “Leave position open when the system stops” – if that setting still exists in the first place. Just looking … for IBKR indeed it does not. See below. The blue is PRT-IBKR, green is PRT-IG.

    I already promised ProRealTime legal issues (and lawsuits) and the fact that they now even omit the text that positions will be closed no matter what the cause, is really over the top for me.

    The ivory tower near Paris just has become lead and unlike the tower of Pizza it may fall over.

    I did not spend a separate topic on it because I had hoped that someone else would be the bad messenger, but it seems that nobody cares (or is not seriously into AutoTrading anyway) and so now I drop it in between the lines.

    In case it is not clear : if for some reason all the AutoTrading systems are closed (or one by one) then each of the positions in them will be closed no matter whether they are in a loss of 20K+. Technically you will lose that money at that moment; it is just taken from you and mentally you would not be able to restart that system in order to earn back that 20K. You would, however, easily be able to let it sit and hope for the better (a most normal trading technique).

    Even if your code performs the Quit command (which would stop the AutoTrading system from ProOrder), your position will be closed. But hey, by the grace of god I was able to let the positions stay if you’d manually close the system. But that is all, and the rest can not be understood by ProRealTime for miles.

    What do you mean “it is unthinkable” … It is ridiculous.

Viewing 5 posts - 1 through 5 (of 5 total)

Create your free account now and post your request to benefit from the help of the community
Register or Login