Announcement

Collapse

Looking for a User App or Add-On built by the NinjaTrader community?

Visit NinjaTrader EcoSystem and our free User App Share!

Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less

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.



    The BarsPeriod has an Instrument object to get the TickSize.


    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.
        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 KennyK, 05-29-2017, 02:02 AM
                  3 responses
                  1,281 views
                  0 likes
                  Last Post NinjaTrader_Clayton  
                  Started by AttiM, 02-14-2024, 05:20 PM
                  11 responses
                  184 views
                  0 likes
                  Last Post NinjaTrader_ChelseaB  
                  Started by fernandobr, Today, 09:11 AM
                  1 response
                  3 views
                  0 likes
                  Last Post NinjaTrader_Erick  
                  Started by timmbbo, Today, 08:59 AM
                  1 response
                  3 views
                  0 likes
                  Last Post NinjaTrader_ChelseaB  
                  Started by itrader46, Today, 09:04 AM
                  1 response
                  6 views
                  0 likes
                  Last Post NinjaTrader_Clayton  
                  Working...
                  X