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

BarsRequest custom instrument

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

    BarsRequest custom instrument

    I have added a new contract month "GC 11-22" to the gold contract month list in the instrument settings.
    However, when I try to load bars with the BarsRequest method, I get an error "Unknown instrument 'GC 11-22'".
    How can I fix this error?
    The contract GC 11-22 exists on the CME website, so I guess there should be data available.

    #2
    Hello Bobin,

    Thank you for your reply.

    I'm able to load GC 11-22 via Kinetick after adding the 11-22 contract in the Instruments window. Are you able to open a GC 11-22 chart ? Who is your data provider? How much data is your BarsRequest trying to get?

    Thanks in advance; I look forward to assisting you further.
    Kate W.NinjaTrader Customer Service

    Comment


      #3
      I thought the 'GC 11-22' contract would be one of those that
      is not really used ... like how 'ES 11-22' is in the list but also
      not used. Right?

      Comment


        #4
        Hello bltdavid,

        Thank you for your reply.

        Yes, it's not really used, but it is possible to load, via Kinetick anyway. I don't believe it's traded much.

        Please let us know if we may be of further assistance to you.
        Kate W.NinjaTrader Customer Service

        Comment


          #5
          Hello Kate,
          I'm using Continuum.
          Those niche contracts are very important to me.
          I tried the free Kinetick connection and I'm able to load a chart for GC 11-22.
          However, I need to use the BarsRequest method.
          I found out that using MergePolicy "DoNotMerge" results in my action method not getting called at all.
          When I use "MergeBackAdjusted​", the action method is called, but doesn't contain any bars. ("request.Bars.Count" equals 0.)


          This is my code.
          Code:
          Instrument instrument = Instrument.GetInstrument("GC 11-22");
          new BarsRequest(instrument, DateTime.Parse("2022-09-15"), DateTime.Parse("2022-09-21")) {
              MergePolicy = MergePolicy.MergeBackAdjusted​,
              BarsPeriod = new BarsPeriod {Value = 1, BarsPeriodType = BarsPeriodType.Day},
              TradingHours = instrument.MasterInstrument.TradingHours,
          }.Request((request, errorCode, errorMessage) => {
              // ...
          }​
          ​

          Comment


            #6
            Hello Bobin,

            Thank you for your reply.

            I've done some further digging and while the 11-22 contract does exist, NinjaTrader Continuum doesn't support it because of low volume. The current volume is all on GC 12-22 right now if you look at this publicly available link:

            Find information for Gold Futures Quotes provided by CME Group. View Quotes


            That being said, I'm able to see daily bars returned using this indicator that uses a daily bar request on Kinetick EOD, do you see the same?

            Thanks in advance; I look forward to assisting you further.
            Attached Files
            Kate W.NinjaTrader Customer Service

            Comment


              #7
              Hello Kate,
              I've found that my rollover date in the instrument settings affects whether I get bars or not.
              I have to set the rollover date to the past in order to get bars. When I set it to the future, I don't get any bars.
              That's not what I would expect, because I can request other instruments too which have a rollover date in the future.

              Example:
              I set the rollover date of GC 11-22 to year 2023 --> I don't get any bars​​
              I set the rollover date of GC 11-22 to year 2021 --> I get bars​​
              I request GC 12-23 --> I get bars

              GC 12-23 has a rollover date in 2023 too. So I don't understand why I wouldn't get bars for 11-23.

              Thank you very much for your help!

              Comment


                #8
                Hello Bobin,

                The rollover date is used for merging of the data.

                Below is a link to a forum post that goes into detail.



                Setting the rollover date to 2023 for that specific contract month of 11-22 would not allow data to load on the chart until today's date is that date in 2023..
                Chelsea B.NinjaTrader Customer Service

                Comment

                Latest Posts

                Collapse

                Topics Statistics Last Post
                Started by timmbbo, Today, 08:59 AM
                1 response
                2 views
                0 likes
                Last Post NinjaTrader_ChelseaB  
                Started by KennyK, 05-29-2017, 02:02 AM
                2 responses
                1,279 views
                0 likes
                Last Post marcus2300  
                Started by fernandobr, Today, 09:11 AM
                0 responses
                0 views
                0 likes
                Last Post fernandobr  
                Started by itrader46, Today, 09:04 AM
                1 response
                3 views
                0 likes
                Last Post NinjaTrader_Clayton  
                Started by bmartz, 03-12-2024, 06:12 AM
                5 responses
                33 views
                0 likes
                Last Post NinjaTrader_Zachary  
                Working...
                X