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

TradingHours.Name Error

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

    TradingHours.Name Error

    I am trying to add a dataseries and I am using the following:
    AddDataSeries(Instrument.FullName,p,2400000,Tradin gHours.Name,true)

    TradingHours.Name is returning "<Use instrument settings>" in the newest version of NT8. In the previous versions it used the actual Template. Is there anyway to get the real TradingHours session template name now?

    #2
    Hello habibalex, and thank you for your question. When I tried the attached script using the ES 03-17 instrument on the latest build of NinjaTrader, my output was

    CME US Index Futures ETH
    Could you run the attached script on your system? If you get different results, this should be resolved with the next release of NinjaTrader. If you can modify the attached script so that it causes the same thing you were seeing earlier, or there are any other ways we can help, please let us know so we may assist further.
    Jessica P.NinjaTrader Customer Service

    Comment


      #3
      Where is the attached script? i'm having trouble finding it.

      Comment


        #4
        Changed from

        TradingHours.Name

        to

        BarsArray[0].TradingHours.Name

        solved my problem

        Comment


          #5
          I am glad you were able to resolve your query. It looks like my attachment failed to attach yesterday.
          Jessica P.NinjaTrader Customer Service

          Comment


            #6
            Hi Jessica,

            Sorry to resurrect this old thread, but is there a way to automatically update the trading hours on the chart dynamically?

            Example: We created some custom buttons to select a symbol (say ES or CL), but we also want to have the Data Series window on the chart switch automatically to CME US Index Futures RTH if we select ES. If we click on CL we want to have the session/Trading Hours in the Data Series window change to Nymex Energy RTH. Is that possible you think?

            Comment


              #7
              Thank you for your question successfulmike . So that other forums users can benefit, please begin a new thread if there are other related questions we can answer, or if you would like one of us to go into more detail. Please quote both your post and mine in the new topic.

              What you are describing is ambitious, because you will ultimately need to reload historical data and your script in order to reload your primary series' data, as filtering by session template needs to be done during this initial load. Doing so may be possible e.g. through automation (publicly available documentation linked), but describing how to do so is beyond the scope of the support we may provide.

              It may be simpler to use 24/7 session templates, and to restrict your trading hours directly by using code similar to what is inside this forums sample. For example, only running OnBarUpdate during certain times of day if the instrument selected is CL, and other times when ES is selected.

              https://ninjatrader.com/support/forum/showthread.php?t=3226

              Please let us know if there are any other questions we may answer, and either I or one of my colleagues will be happy to assist further.
              Jessica P.NinjaTrader Customer Service

              Comment


                #8
                I am providing some additional detail for reference for those referring back to this thread.

                What is described in the original post by habibalex is considered dynamically adding a series in the script which is not supported nor recommended.

                Per our Help Guide page on AddDataSeries():
                Arguments supplied to AddDataSeries() should be hardcoded and NOT dependent on run-time variables which cannot be reliably obtained during State.Configure (e.g., Instrument, Bars, or user input). Attempting to add a data series dynamically is NOT guaranteed and therefore should be avoided. Trying to load bars dynamically may result in an error similar to: Unable to load bars series. Your NinjaScript may be trying to use an additional data series dynamically in an unsupported manner.
                Please refer to the following link for information on AddDataSeries(): https://ninjatrader.com/support/help...dataseries.htm

                Comment

                Latest Posts

                Collapse

                Topics Statistics Last Post
                Started by trilliantrader, 04-18-2024, 08:16 AM
                4 responses
                18 views
                0 likes
                Last Post trilliantrader  
                Started by mgco4you, Today, 09:46 PM
                1 response
                7 views
                0 likes
                Last Post NinjaTrader_Manfred  
                Started by wzgy0920, Today, 09:53 PM
                0 responses
                9 views
                0 likes
                Last Post wzgy0920  
                Started by Rapine Heihei, Today, 08:19 PM
                1 response
                10 views
                0 likes
                Last Post NinjaTrader_Manfred  
                Started by Rapine Heihei, Today, 08:25 PM
                0 responses
                10 views
                0 likes
                Last Post Rapine Heihei  
                Working...
                X