NexusFi: Find Your Edge


Home Menu

 





Auto trading CL futures with Ninja and IB


Discussion in NinjaTrader

Updated
      Top Posters
    1. looks_one sam028 with 5 posts (1 thanks)
    2. looks_two goforbroke01 with 3 posts (0 thanks)
    3. looks_3 Fat Tails with 3 posts (6 thanks)
    4. looks_4 fle__ with 2 posts (4 thanks)
    1. trending_up 15,658 views
    2. thumb_up 11 thanks given
    3. group 10 followers
    1. forum 22 posts
    2. attach_file 0 attachments




 
Search this Thread

Auto trading CL futures with Ninja and IB

  #11 (permalink)
 
Fat Tails's Avatar
 Fat Tails 
Berlin, Europe
Market Wizard
 
Experience: Advanced
Platform: NinjaTrader, MultiCharts
Broker: Interactive Brokers
Trading: Keyboard
Posts: 9,888 since Mar 2010
Thanks Given: 4,242
Thanks Received: 27,102

Just read the chat and took note of webart's problems today, so here is a short attempt to explain the issue:


NinjaTrader 6.5 / IB and Energy Futures

I started a thread on this issue in April 2009 on the NinjaTrader forum, which has 137 posts now and can be found here:

Open position not displayed for CL and COIL - [AUTOLINK]NinjaTrader[/AUTOLINK] Support Forum

The problem is quite simple. It is just the definition for "contract month" used by the API.

Interactive Brokers API -> contract month is the month of the last trading date (expiry month)
NinjaTrader -> contract month is the nominal contract month

Now for most of the futures contracts, you will find that the last trading date falls within the nominal contract month, for example the last trading date for ES 06-10 is the third Friday of June, so both NinjaTrader and Interactive Brokers agree that it is June.

However, for the most liquid energy futures traded at NYMEX (including CL, NG, RB, HO) and for IPE traded Brent Crude (BC) and WTI Crude (WTI), the expiry month is just prior to the nominal contract month. These futures cannot be traded through NinjaTrader 6.5 and Interactive Brokers. I think that this is ridiculuous, and that NT should have provided a solution since a long time instead of explaining again and again that it is all the fault of Interactive Brokers.


NinjaTrader 7.0 / IB and Energy Futures

For NinjaTrader 7 developpers made a small workaround, which requires an alternate symbol mapping, so for Interactive Brokers the correct symbol mapping would be

WTI Crude (Nymex) -> CL||||1
RBOB Gasoline (NYmex) -> RB||||1
Heating Oil (Nymex) -> HO||||1
Henry Hub Natural Gas (Nymex) -> NG||||1
Brent Crude (NYBOT/IPE) -> COIL||||1

However, NT 7.0.0.16 still had problems correctly backfilling these contracts, when Merge Policy was set to "MergeBackAdjusted". My record was 58 data loading requests for my default workspace just to backfill one day of data....


Other cases

The IPE Gasoil contract does not suffer from this problem, as the July contract expires in July, so the symbol mapping would just be GOIL.

The problem might also apply to Nybot Sugar Futures (SB), so in case you want to trade sugar futures through NinjaTrader and Interactive Brokers, you would also need to check which of the two symbol mappings, SB or SB||||1 produces the correct result. I cannot do it now during the weekend, but when the market is open, it is easy to check.

In any case, be careful and first do some simulation trading before you put real money at risk. All problems also occur with the IB simulation account.

Reply With Quote
Thanked by:

Can you help answer these questions
from other members on NexusFi?
NexusFi Journal Challenge - April 2024
Feedback and Announcements
Are there any eval firms that allow you to sink to your …
Traders Hideout
Build trailing stop for micro index(s)
Psychology and Money Management
Futures True Range Report
The Elite Circle
New Micros: Ultra 10-Year & Ultra T-Bond -- Live Now
Treasury Notes and Bonds
 
  #12 (permalink)
 webart 
Australia
 
Experience: Intermediate
Platform: NT
Posts: 106 since Apr 2010
Thanks Given: 48
Thanks Received: 84

Thanks for the info Fat Tails. I can't believe that Ninja Trader would allow their customers to use their platform for months and months when it has a known issue of not reporting an open position and I believe that stops are not entered either.

Not only has the issue not been fixed in the production version of NT, but no warning or popup has been issued to advise their clients of this potentially serious issue. This is an issue that could send you bust !

I've asked for compensation for my loss from the issue, but havn't heard back from them for a week.

Reply With Quote
  #13 (permalink)
 
Fat Tails's Avatar
 Fat Tails 
Berlin, Europe
Market Wizard
 
Experience: Advanced
Platform: NinjaTrader, MultiCharts
Broker: Interactive Brokers
Trading: Keyboard
Posts: 9,888 since Mar 2010
Thanks Given: 4,242
Thanks Received: 27,102


Hi webart,

this is the main problem of NinjaTrader. They are sort of jack of all trades trying to make their product work with any data feed and every broker around. But their developpers are not up to this task. In the end there are hundreds of little problems and bugs that they cannot manage.

Also, depending on your time zone, NinjaTrader cannot correctly display daily data of Interactive Brokers for a different definition of time stamps. So I currently do not have daily data for TF, BC or DX.

There are also some really weird bugs. Two days ago my indicator code did not compile. The compiler errors pointed to the NinjaTrader generated code. Finally I found that the editor also checked the outcommented code in the properties region for syntax errors. I had outcommented with "/*" and "*/" as opposed to "//". Developpers confirmed the bug and that I am not allowed to outcomment with "/*" and "*/" in the properties region. This is standard syntax for C#, you are not allowed to use it, and you will not find any information on this.

So expect the unexpected and never use NT for automated trading.


webart View Post
Thanks for the info Fat Tails. I can't believe that Ninja Trader would allow their customers to use their platform for months and months when it has a known issue of not reporting an open position and I believe that stops are not entered either.


Reply With Quote
  #14 (permalink)
 MXASJ 
Asia
 
Experience: Beginner
Platform: NinjaTrader, TOS
Posts: 796 since Jun 2009
Thanks Given: 109
Thanks Received: 800


Fat Tails View Post
So expect the unexpected and never use NT for automated trading.

Any suggested alternatives?

Reply With Quote
  #15 (permalink)
 
Fat Tails's Avatar
 Fat Tails 
Berlin, Europe
Market Wizard
 
Experience: Advanced
Platform: NinjaTrader, MultiCharts
Broker: Interactive Brokers
Trading: Keyboard
Posts: 9,888 since Mar 2010
Thanks Given: 4,242
Thanks Received: 27,102

I am not into automated trading systems, this is far beyond my capacities.

For discretionary trading NinjaTrader remains an option, as long as you know all the little tricks. As far as I understood MultiCharts might be more reliable and I will probably use it as an alternative front end for my trading account, when it comes with a DOM.


MXASJ View Post
Any suggested alternatives?


Reply With Quote
Thanked by:
  #16 (permalink)
 studio88 
Queensland, Australia
 
Experience: Intermediate
Platform: NinjaTrader, ProRealtime, Others
Broker: IB
Posts: 94 since May 2010
Thanks Given: 102
Thanks Received: 47


Fat Tails View Post
when it comes with a DOM.


Thats a good question, I downloaded MC trial, and then upon hearing what Big Mike had to say then downloaded the Beta, but I cannot find any DOM on it.

Is there any plan that you now of with MC having a DOM (eventually)?

Reply With Quote
  #17 (permalink)
 
sam028's Avatar
 sam028 
Site Moderator
 
Posts: 3,765 since Jun 2009
Thanks Given: 3,825
Thanks Received: 4,629


studio88 View Post
Thats a good question, I downloaded MC trial, and then upon hearing what Big Mike had to say then downloaded the Beta, but I cannot find any DOM on it.

Is there any plan that you now of with MC having a DOM (eventually)?

It's supposed to be here for the version 7 (the latest version available is 6 Beta 3), so not before some months (years ?).

Success requires no deodorant! (Sun Tzu)
Follow me on Twitter Reply With Quote
  #18 (permalink)
 studio88 
Queensland, Australia
 
Experience: Intermediate
Platform: NinjaTrader, ProRealtime, Others
Broker: IB
Posts: 94 since May 2010
Thanks Given: 102
Thanks Received: 47


sam028 View Post
It's supposed to be here for the version 7 (the latest version available is 6 Beta 3), so not before some months (years ?).


Fingers crossed for the months over years there Sam. Thanks for the approximation.

Reply With Quote
  #19 (permalink)
 aviat72 
San Francisco Bay Area
 
Experience: Intermediate
Platform: NT,TOS,IB
Trading: ES,CL,TF
Posts: 281 since Jun 2010
Thanks Given: 161
Thanks Received: 273

I for sure can not figure out why NT can not fix this. It can not be something so big. All it perhaps requires an additional software layer to do the correct translation.

I hope they do realize that people will get fed-up and some one will write their own API for IB orders and publish it.

Once you can place orders directly with IB by linking in your own code, the need for Ninja's paid license goes away to a large extent. Of course you will not get the trade performance metrics etc but you can still trade!

Visit my NexusFi Trade Journal Reply With Quote
  #20 (permalink)
 foodchain 
san jose
 
Experience: Intermediate
Platform: ninjatrader, thinkorswim
Broker: IB
Trading: GC, CL, ES, ZF, ZN, DX, 6E
Posts: 22 since May 2010
Thanks Given: 12
Thanks Received: 1


I wrote an automated system for CL, the strategy is mainly based on range bar with ninjatrader. I just found out IB doesn't provide "real" tick and historic tick data, guys any suggestion?

Reply With Quote




Last Updated on October 29, 2010


© 2024 NexusFi™, s.a., All Rights Reserved.
Av Ricardo J. Alfaro, Century Tower, Panama City, Panama, Ph: +507 833-9432 (Panama and Intl), +1 888-312-3001 (USA and Canada)
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.
About Us - Contact Us - Site Rules, Acceptable Use, and Terms and Conditions - Privacy Policy - Downloads - Top
no new posts