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

Gui.Chart.BarsData error in NT8 from NT7 - HELP PLEASE !

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

    Gui.Chart.BarsData error in NT8 from NT7 - HELP PLEASE !

    When I try to compile the following section of code in NT8 from a previous NT7 code:

    public override void ApplyDefaults(Gui.Chart.BarsData barsData)
    {
    barsData.DaysBack = 3;
    barsData.Period.Value = 10;
    }


    I get the following error:

    The type or namespace BarsData does not exist in the namespace NinjaTrader.GUI.Chart. This is the last error that is preventing the compile so any help would be greatly appreciated.

    Thanks !

    ;-)


    #2
    You really should look at the examples like the built-in BarsType for minute bars (or any of them, really...) - there are several relevant code sections and you can't just cut and paste without thinking it through... you need to set up ApplyDefaultValue() and GetInitialLookbackDays() and ApplyDefaultBasePeriodValue() and then implement OnStateChange when State == State.SetDefaults... look at one of the inbuilt bar types to see how all this should work in NT8.
    Bruce DeVault
    QuantKey Trading Vendor Services
    NinjaTrader Ecosystem Vendor - QuantKey

    Comment


      #3
      Hi,
      Thanks for the response. I am a bit confused since I thought all one would need would be to apply the NT8 syntax for BarsData which is not recognised. Why do all those other changes need to be made?
      Cheers,

      Comment


        #4
        Hi qs12345, Custom bars types were never documented in NinjaTrader 7 but they are fully supported and documented in version 8 and above. If you are trying to convert a custom bars type, you should study all of the existing bars types in the NinjaScript Editor to see how this is done, none of the code used in NinjaTrader 7 for bars types was documented or supported so you will likely find many modules and lines of code that are no longer used and irrelevant.
        Chris L.NinjaTrader Customer Service

        Comment


          #5
          Hi Chris,

          Thank you for your response. I reviewed the documentation in this link ( https://ninjatrader.com/support/help...?bars_type.htm) and also the code in the script editor for the other bar types eg tick. I revised the code for my custom bar based on this. However, I am still getting this exception when I compile even though when I search for barsdata, there is no mention of it in my code which is really weird.

          Any thoughts please ?

          Click image for larger version

Name:	image.png
Views:	109
Size:	248.2 KB
ID:	1247764

          Comment


            #6
            The message you are seeing is a leftover error message from a previous set of errors. In cases like this you would need to close the script editor and re-open it to clear it.
            Bruce DeVault
            QuantKey Trading Vendor Services
            NinjaTrader Ecosystem Vendor - QuantKey

            Comment


              #7
              Thanks Bruce for your help and response to my previous post. It resolved the issue ;-)

              Comment


                #8
                Regarding setting the name try this in State.Configure: Name = string.Format("MyBarsType {0}", BarsPeriod.Value);
                Bruce DeVault
                QuantKey Trading Vendor Services
                NinjaTrader Ecosystem Vendor - QuantKey

                Comment


                  #9
                  Thanks Bruce - that solved the issue!!!

                  I can't thank you enough for all your help

                  ;-) ;-) ;-)

                  100/100

                  Comment

                  Latest Posts

                  Collapse

                  Topics Statistics Last Post
                  Started by Jimmyk, 01-26-2018, 05:19 AM
                  6 responses
                  835 views
                  0 likes
                  Last Post emuns
                  by emuns
                   
                  Started by jxs_xrj, 01-12-2020, 09:49 AM
                  6 responses
                  3,291 views
                  1 like
                  Last Post jgualdronc  
                  Started by Touch-Ups, Today, 10:36 AM
                  0 responses
                  10 views
                  0 likes
                  Last Post Touch-Ups  
                  Started by geddyisodin, 04-25-2024, 05:20 AM
                  11 responses
                  62 views
                  0 likes
                  Last Post halgo_boulder  
                  Started by Option Whisperer, Today, 09:55 AM
                  0 responses
                  9 views
                  0 likes
                  Last Post Option Whisperer  
                  Working...
                  X