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

Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

TWS Variable minimum price increment error (stock)

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    TWS Variable minimum price increment error (stock)

    Dear forum,

    I have been trying to submit live limit orders to TWS (Traders Workstation) automatically using ninjascript. The problem is that occasionally the orders are rejected because they do not comply with the minimum price increment of the given instrument. I found out that that NinjaTrader does round the price of the orders you submit to the nearest valid tick size, which is specified in the corresponding instrument's configuration and by default set to 0.01. However, the stock instruments I am planning to trade (AEB) all have a complex tick size table, which specifies the tick size based on the current price of the instrument (see example below).

    Therefore, it is impossible to correct the minimum increment errors by filling in a specific single value in the instrument's configuration. I found out that the TWS API does have methods to request the minimum increment for instruments/contracts (see https://interactivebrokers.github.io...increment.html), but I could not find any documentation on NT's side. Is there any known way to retrieve the correct price increment, either from TWS or the internet? Or is there a logical underlying structure that can be hard-coded in ninjascript?

    Thank you for your consideration!

    Example tick size table (retrieved from the IB contract database: https://www.interactivebrokers.co.uk...ex.php?f=463):

    Click image for larger version

Name:	example_ticksize_table.png
Views:	8
Size:	31.7 KB
ID:	1047880
    Attached Files

    #2
    Hello frankrood,

    Thank you for the note.

    The TickSize property in NinjaScript is readonly, so it is not possible to vary the tick size of an instrument from within code. I will submit a feature request to have this functionality added in a future update so that we can support instruments that vary in tick size. Currently, the only way to change the tick size of an instrument would be Tools>Instruments>Double click the desired instrument>change the Tick Size field.

    Please let me know if I can assist further.

    Chris L.NinjaTrader Customer Service

    Comment


      #3
      Hi Chris,

      Thank you for your quick response. It would be great to see such a feature in the future, so thank you for submitting it to the dev team.

      As it is currently not possible to configure the TickSize property of the Instruments as coded in NinjaTrader, a different strategy is needed to submit orders to TWS with the correct tick size. As TWS has the correct tick size information available (according to the official TWS API reference, there is a function that can be used to request the correct tick size, see https://interactivebrokers.github.io...increment.html), there must be some way to access this information through NinjaTrader.

      My question is: Is there any way in which the tick size information from TWS can be accessed/retrieved in NinjaScript? As there already exists an API function for this specific purpose, is there a way to access this function in NinjaScript?

      Comment


        #4
        frankrood,

        Thank you for the reply.

        Yes, you can access the TickSize in NinjaScript but it is read-only. The request I submitted was to have that property editable through a script. Currently, it is not supported to change the tick size programmatically. Even though Interactive brokers provides an API call for this item, it does not mean that is implemented in the Interactive Brokers connection adapter for NinjaTrader (the code that runs when you connect to your IB account through the platform).

        I received the feature tracking ID for future reference:

        SFT-1212

        Please check the release notes upon each release to track added features:

        https://ninjatrader.com/support/help...ease_notes.htm

        Please let me know if I can assist further.
        Chris L.NinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by tvaughan4, 12-13-2019, 10:46 PM
        2 responses
        17 views
        0 likes
        Last Post tvaughan4  
        Started by digibob, 12-13-2019, 10:01 PM
        3 responses
        12 views
        0 likes
        Last Post digibob
        by digibob
         
        Started by ldissinger, Yesterday, 12:55 PM
        1 response
        19 views
        0 likes
        Last Post ldissinger  
        Started by pstrusi, Yesterday, 09:06 AM
        1 response
        28 views
        0 likes
        Last Post marcus2300  
        Started by vpzdcv, Yesterday, 02:31 AM
        0 responses
        14 views
        0 likes
        Last Post vpzdcv
        by vpzdcv
         
        Working...
        X