• If this is your first visit, you will have to register before you can post. To view messages, please scroll below and select the forum that you would like to visits. Questions? Be sure to check out the Forum FAQ.


No announcement yet.

Partner 728x90


IB and GetAtmStrategyPositionAveragePrice()

  • Filter
  • Time
  • Show
Clear All
new posts

    IB and GetAtmStrategyPositionAveragePrice()

    I've written a strategy that accesses ATM templates. I am trading RB which trades at x.0001

    When a trade triggers the entry price is retrieved with GetAtmStrategyPositionAveragePrice() and printed on the chart. Well it is supposed to.

    In Sim101 everything works fine, the entry price and position are properly displayed on the chart and in the Dynamic DOM. If I use AtmStrategyClose(), stops and targets are cancelled and the position is closed.

    If I am trading my IB account, the entry is neither displayed on the chart nor in the DOM, although the stop is shown. If I use AtmStrategyClose(), the stop is cancelled, but the order remains active in TWS. I must use the IB TWS to close any orders opened by the strategy.

    snaphook, is this with NT7 R11 and the TWS 927.7?

    If you check - which mapping is RB using for the IB entry on your NT? Which contract expiry is the position showing for in TWS? Do the expiries match?
    BertrandNinjaTrader Customer Service


      NT 7.0.1000.11 (Live)

      IB 927.7 Oh, and that # is tough to get when logged in on NT. NT closes the About dialog on each new tick (I presume), so I have a second or less to find the number. If I log off in NT, the TWS About dialog stays up. It also screws around when trying to set parameters in TWS by exiting param boxes, such as shutdown time.

      NT is mapping RB to RB using 2-13 expiry. Both expirys are the same, Chart and DOM, else stop wouldn't show either. I did have to alter the default Definition to show 42,000.00 for point value instead of the 10,000.00 default. Merge Policy is UseGlobalSettings. NYMEX exchange.


        Ok, thanks.

        Issue likely here is that RB is expiring in Jan (31st) so IB is naming those differently than us - if you reset Instruments in NT7 (and thus RB is mapped to RB|||1) under Tools > Options > Data and then recheck would visualization is as expected?
        BertrandNinjaTrader Customer Service



          What kind of an answer is that? Are you telling me that NT and IB will/may desynch at some point every month? Doesn't that kinda mean NT is unreliable when trading some futures contracts? The only change I made was in the $ per point, which you guys should fix, anyway.

          And why not forward my observations vis-avis NT interactions with TWS dialogs. That has been a pain in the rear for quite a while.

          I'll reset 'em tonight and let you know what happens tomorrow. This is really lame.


            snaphook, the $ change you did is already reflected in the updated sources you would use with the resetted instruments on R11. Same would go for the instrument map needed - what you unfortunately saw here is a known limitation in the IB API where the naming is not done per industry standard. NT7 offers a way to address this via the symbol map the update contains for RB and which I posted here for you to use.

            I will surely add your feedback into our tracking lists run in product management - a workaround for now can be opening up TWS first, logging in and then connecting in NT to the already opened TWS.

            Please let me know how it goes after the reset of instruments.

            BertrandNinjaTrader Customer Service


              I reset the symbols this morning (mapping now RB||| 1), but the entry price is still not registering. Stops do show in the DOM and in the TWS.

              EDIT: I did not remove symbols from Default List and re-add them. Is that necessary?

              EDIT 2: I removed and re-added the symbols to the Default List, rebooted NT, but still no Entry price is registering.

              EDIT 3: Disconnected IB Live to go to IB Paper to see if Targets show up. Now I get nothing showing in the DOM, not even Bid/Ask/Last. I am connected because the chart is updating and is current with the TWS. This applies to Paper or Live. Rebooted NT with no change. Both 2-13 and 3-13 expirys are showing this. CL and NG are fine.
              Last edited by snaphook; 01-15-2013, 10:03 AM.


                Placed a Target order and both the Stop and Target show up in the TWS, but the DOM is blank. and I mean blank,


                  I just opened an old copy of Bracket Trader and everything shows in that DOM.


                    Hi snaphook, could you submit in your trace / log files for close review to us? Easiest would be done via Help >> Mail to Support and then referencing ticket 773076.

                    Thanks much
                    BertrandNinjaTrader Customer Service


                      Early morning update.

                      Saw RB 03-13 volume was higher than 02-13 so flipped my chart to the 03 expiry. It is identical to the 02 expiry including current Last prices.

                      Also, If I try to open either a new 5 min 02 or 03 expiry, I get an error from IB, both referencing the 02 expiry and identifying Globex as the exchange (not NYMEX?):

                      Error on loading chart data for 'RB 02-13 Globex': IB - Live: Error in requesting historical dataf rom IB: No security definition has been found for the request(200)

                      EDIT: Did a complete reinstall of NT with no change in circumstances. What is funny is that, although I can't open a new chart or change expiry on the existing one, the existing one for 02-13 expiry continues to update.
                      Last edited by snaphook; 01-16-2013, 03:40 AM.


                        Thanks for the update SnapHook, just replied to your direct email sent to support.
                        BertrandNinjaTrader Customer Service


                          Thanks, and just an FYI, NT has the RB futures default to Globex. Switching to NYMEX resolved the issue on my end as well.


                            New Trade Update

                            I got the prices back, however:

                            My strategy placed a trade for RB 03-13 through an ATM Strategy Template and was filled properly by IB @ 2.7359.
                            The Stop order showed up, but not, the entry price, which IB TWS reported as 2.73595. I suspect they are including commissions.
                            When I got to my BE point the NT DOM properly advanced my stop loss order.
                            At no time did I see in the NT DOM an unrealized PnL while in the trade. It did show up as realized PnL once the trade was closed.

                            Could it have something to do with that extra 5th decimal place being reported back from IB?

                            EDIT: And, if so, will a manual change to .00001 Tick Size in Instrument Manager resolve the issue?


                              Hi snaphook, correct values would be including commissions here. On official CME pages I only see reporting up to 4 digits for RB quotes.

                              Would you mind sending the trace and logs again so we could review the sequence of events?

                              Is this on a live or live/paper account at IB?

                              BertrandNinjaTrader Customer Service


                              Latest Posts


                              Topics Statistics Last Post
                              Started by ttodua, Today, 01:52 PM
                              0 responses
                              Last Post ttodua
                              by ttodua
                              Started by muisca, 05-19-2017, 11:49 AM
                              8 responses
                              Last Post NinjaTrader_Tyler  
                              Started by NinjaTrader_Brandon, Today, 12:08 PM
                              0 responses
                              Last Post NinjaTrader_Brandon  
                              Started by iq200, Today, 12:00 PM
                              2 responses
                              Last Post iq200
                              by iq200
                              Started by valhallafutures, Today, 11:33 AM
                              1 response
                              Last Post NinjaTrader_PatrickG