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

Why TradingHours does not work?

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

    Why TradingHours does not work?

    I tried everything but couldnt get it working.
    For example, in Tools>Instruments I see the trading hours is set to 24x7 : https://i.imgur.com/VCLkwbN.png
    However, when I open Chart>DataSeries, I do see it has selected "Use instrument settings" : https://i.imgur.com/mPCC1qo.png

    But there are two problems:
    1) there should be selected automatically the 24x7, because it was selected and user doesn't have to guess to "which timezone that instrument is set"
    or
    2) even if you decide not to change this behavior, and make "Use instrument settings" to remain there, then it should work and in the backgrounds, the `24x7` (or whatever instrument has setting) should be working. However, the problem is that, chart doesn't use 24x7, and Saturday/Sunday bars does not show up, and I have to select `Chart>Dataseries >24x7 ` once again to make it work.

    Can you tell why these problem happens? Literally, on every open of chart I have to select 24x7 manually to make charts work really 24x7, even though it should have done automatically, as in Instruments base settings it's already set.

    Here is a reproducible issue-example:
    1) download the attached example "daily" bars data
    2) create an instrument from addon (inside OnWindowCreate or wherever you want) once with this code.
    3) try to open a daily chart of XYZ_USD

    You will see that it will be skipping from friday-sunday .

    (btw, also please tell me after opening chart, why there are 2 XYZ_USD symbols, one of Crypto and one of Stock type.)

    ----

    Strange thing, I created a sample indicator, where, in "dataloaded" state, i printed "Instrument.MasterInstrument.TradingHours" and it prints "US Equities RTH", even thought what I described above. I can record video too to prove all I say is correct and I don't say any mistake in my steps, even though i provided screenshots.


    If i create an indicator, where in configure state I set `Instrument.MasterInstrument.TradingHours = TradingHours.Get("Cryptocurrency");` then after Full reload of chart, it loads those bars (as the TradingHours is being applied after explicit command). But this is no way a solution.
    Last edited by ttodua; 08-03-2021, 03:16 PM.

    #2
    Hello ttodua,

    When 'Use instrument settings' is selected in the Data Series menu of a chart, it should load the trading hours template that is selected in the instrument settings.

    Do you load the missing data if you right click in the chart and select "Reload All Historical Data" while still have 'Use instrument settings' selected?

    Does the chart load all requested data if you select the "Cryptocurrency" trading hours template instead in the instrument settings (and select 'Use instrument settings' in the Data Series menu of the chart)?

    What NinjaTrader version do you have installed. You can check this at Control Center-->Help-->About (8.0.xx.x).

    Do you experience the issue for all instruments or could it be limited to custom created crypto currency instruments?
    JasonNinjaTrader Customer Service

    Comment


      #3
      NinjaTrader_Jason thanks for quick reply. Your questions seems that you have quite well understand the matter, and gave nice hints. thanks.

      However, here are my answers:
      1) No, "reload all historical data" (while retaining Use-Instrument-Settings) does not reload the missing bars.
      2) No, i've tried to change them to "cryptocurrency", restarted NT , but still same. from friday jumps to monday.
      3) 8.0.24.3 64-bit
      4) On Coinbase built-in adapter, it works well. I have added custom instruments from my addon, and they experience that problem... I've tried to set everything like i see in coinbase insrument settings, but the problem is still...

      Comment


        #4
        Hello ttodua,

        You mention you added custom instruments from an add-on. Is this a 3rd party add-on? Am I correct the issue is limited to these instruments only? Can you please create a custom instrument manually at Control Center-->Tools-->Instruments and select the 'Default 24 x 7' or 'Cryptocurrency' trading hours template in the instrument settings. Subsequently create a chart and check if data is loaded as per the trading hours template you have selected.

        Could it be custom instruments created from the add-on automatically use the 'US Equities RTH' trading hours template which can't changed (even if you change it in the instrument settings in NinjaTrader or Data Series menu of the chart)?
        JasonNinjaTrader Customer Service

        Comment


          #5
          Unfortunately I'm not a programmer myself, so I can't comment on code. Am I correct the issue is limited to custom created instruments by this code? If so, I will re-assign this forum thread to "General Development" so a NinjaScript technician can further assist. If you experience the issue with instruments not created by this add-on, please let me know.
          JasonNinjaTrader Customer Service

          Comment


            #6
            Yes, you are correct, I am experiencing that with custom-created instruments.

            Please move the topic where needed and assign other support person. Thanks

            Comment


              #7
              Hello ttodua,

              Thanks for your post.

              We find that this is working for supported crypto pairs when adding instruments manually. Adding instruments through NinjaScript is not supported, and we also need to be sure that the crypto symbols created are supported crypto pairs.


              Paul H.NinjaTrader Customer Service

              Comment


                #8
                Hi NinjaTrader_PaulH Can you please do a favour and give a bit heplful reply? Your reply didnt help me at all. I've provided the example code and the instructions, and it should work, but doesn't seem to work. So, I say that it is bug, but you say that only supported pairs and this or that. Your answer does not seem correct because it doesnt matter at all if a particular pair is in ninjatrader (btw, does ninjatrader has any "built-in" list of pairs at all, that covers all your brokerages all pairs list? I think no). So, when script does correctly register instrument (you see in sample code, that the "tradinghours" parameter of instrument object, is set to "Cryptocurrency" and moreover in Global settings, the instrument has set tradinghours to that, but while opening the chart, it still misbehaves.
                Do you confirm that you was able to reproduce the issue?

                and if you were able, how it comes that you say it is not a bug? Moreover strange thing is that you say "adding instruments using ninjascirpt is not supported" while it is supported quite well enough and everything works perfect, that TradingHours has issue. So, if you are not able to help me, i do please to redirect ticket to other support rep.
                Last edited by ttodua; 08-02-2021, 10:43 AM.

                Comment


                  #9
                  Hello ttodua,

                  Thanks for your reply.

                  We appreciate the effort to provide sample code and steps to recreate.

                  However, as mentioned " Adding instruments through NinjaScript is not supported". Undocumented code does not carry a guarantee of function as it is not locked into documentation thus is unsupported.

                  If you are unable to do this (adding instruments) manually we will certainly look into that

                  Paul H.NinjaTrader Customer Service

                  Comment


                    #10
                    Hello ttodua,

                    This is Jim responding on behalf of Paul. I am the Team Lead for Scripting Support.

                    As you are aware with other tickets you have had with us in the past, undocumented code is unsupported. You are free to use it, but there is no guarantee offered with its functionality in addition to any direction for usage, and we cannot assist with matters involving undocumented/unsupported code.

                    We looked into this adding instruments manually, through supported means, and there was no issue there.

                    Adding instruments through code is not supported, so there is no means that we could use to make a case for an issue involving adding instruments in that fashion. Additionally, using any code that adds to the database(even instruments) that is not documented/supported can carry a risk of damaging the database file.

                    If you can establish that the issue can be encountered through supported means on a clean database file (I.E. adding through the Instruments window directly) then we will be more than happy to have another look.
                    JimNinjaTrader Customer Service

                    Comment


                      #11
                      i didnt know quite well why that is unsupported, as other broker-adapter (not to name specifically) seem to use that same "programattic" approach.

                      well, thanks guys, I just wanted if there was any chance to hear just any hint (as a friendly gesture of "support") possible hint what could have been wrong with that method... Otherwise, I know that unsupported approaches is not supported. I didnt even emphasize to help with my code (and i repeated that several times), instead I met the bug, while added instrument (doesnt matter how) was not applied accoridng to its settings, while opening chart. that was the story, you just still emphasize that issue might be coming from custom-code, while I say that nevertheless the fact from where it comes, there is issue, that NT chart window doesnt respect global settings.

                      well, thanks anyways, i am still left helpless, but will find some routes myself. regards.
                      Last edited by ttodua; 08-02-2021, 02:38 PM.

                      Comment


                        #12
                        no longer need help. though the NT has internal issue as I said.

                        Comment

                        Latest Posts

                        Collapse

                        Topics Statistics Last Post
                        Started by andrewtrades, Today, 04:57 PM
                        1 response
                        8 views
                        0 likes
                        Last Post NinjaTrader_Manfred  
                        Started by chbruno, Today, 04:10 PM
                        0 responses
                        6 views
                        0 likes
                        Last Post chbruno
                        by chbruno
                         
                        Started by josh18955, 03-25-2023, 11:16 AM
                        6 responses
                        436 views
                        0 likes
                        Last Post Delerium  
                        Started by FAQtrader, Today, 03:35 PM
                        0 responses
                        7 views
                        0 likes
                        Last Post FAQtrader  
                        Started by rocketman7, Today, 09:41 AM
                        5 responses
                        19 views
                        0 likes
                        Last Post NinjaTrader_Jesse  
                        Working...
                        X