• 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

Master Instrument TickSize in BarsType

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

    Master Instrument TickSize in BarsType

    Hi,

    Is there a way to access the Master Instrument TickSize value for the instrument in OnStateChange() when creating a custom BarsType?

    #2
    Hello Zeos6,

    In OnStateChange when State.DataLoaded or later you can get the bars period of any added series.


    Below are public links to the help guide.
    https://ninjatrader.com/support/help...arsperiods.htm
    https://ninjatrader.com/support/help...barsperiod.htm

    The BarsPeriod has an Instrument object to get the TickSize.
    https://ninjatrader.com/support/help...t_ticksize.htm

    BarsPeriods[0].Instrument.MasterInstrument.TickSize.
    Chelsea B.NinjaTrader Customer Service

    Comment


      #3
      Thank you for the reply ChelseaB. I appreciate your response but unfortunately it misses the point of my question. I am painting a custom bar type.The tick size for the instrument is available in the db even before any bars are painted. I would like to access the value of the tick size stored in the db in State.Configure before any bars are built.As far as I am aware, I cannot use Bars as no Bars exist yet; they haven't been built yet. So how do I access the tick size value stored in the db?

      Comment


        #4
        Hello Zeos6,

        Thank you for specifying in which state you are wanting this value.

        In State.Configure the bar and instrument is not yet available meaning you would need to get the instrument another way.

        You could use
        Cbi.Instrument.GetInstrument(string name)

        Below is a public link to the help guide.
        https://ninjatrader.com/support/help...instrument.htm
        Chelsea B.NinjaTrader Customer Service

        Comment


          #5
          Hi Chelsea,

          Thank you. I have tried that but the error I get is that the object referenced has not been instantiated. is there any way to do this?

          Comment


            #6
            Hello Zeos6,

            I am not able to reproduce this behavior.

            Attached is a test script that gets the AAPL instrument and prints the TickSize in State.Configure.

            Are you finding this test script does not print on your end?
            Attached Files
            Chelsea B.NinjaTrader Customer Service

            Comment


              #7
              Hi ChelseaB.
              Will try it out again. But is there a way to do this without explicitly typing in the name of the instrument as a string. I'd like the retrieve the name of the instrument without typing it in explicitly as I plan to use the code on a variety of instruments.

              Comment


                #8
                Hello Zeos6,

                It depends on how you are getting this list of instruments.

                If its coming from a text file, the text is going to be read as a string.

                I guess it would be possible to have a static list of Instrument objects.

                The primary bar, however, is not available in State.Configure. Meaning it would not be supported to use the Bars.Instrument until State.DataLoaded.
                Chelsea B.NinjaTrader Customer Service

                Comment


                  #9
                  Thanks ChelseaB.
                  Yes. I will check this out. Thank you for your help.

                  Comment

                  Latest Posts

                  Collapse

                  Topics Statistics Last Post
                  Started by Newtrader101, Today, 10:46 AM
                  0 responses
                  1 view
                  0 likes
                  Last Post Newtrader101  
                  Started by tecmisc1, Today, 10:42 AM
                  0 responses
                  2 views
                  0 likes
                  Last Post tecmisc1  
                  Started by behindthewheel, Today, 10:39 AM
                  0 responses
                  2 views
                  0 likes
                  Last Post behindthewheel  
                  Started by ballboy11, Today, 10:35 AM
                  0 responses
                  5 views
                  0 likes
                  Last Post ballboy11  
                  Started by fredfred, Today, 10:30 AM
                  0 responses
                  4 views
                  0 likes
                  Last Post fredfred  
                  Working...
                  X