• If this is your first visit, you will have to register before you can post. To view messages, please scroll below and select the forum that you would like to visits. Questions? Be sure to check out the Forum FAQ.

Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

First Add On

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

    #16
    Hello stephensams,

    The changes should be made after a compile.

    Please verify that no errors appear in the Log tab of the Control Center. Additionally, check for any output in the New -> NinjaScript Output Window.

    Additionally, verify that your XAML syntax is correct. Revert back to a previously working XAML as well and test as well.
    Zachary G.NinjaTrader Customer Service

    Comment


      #17
      With no edits to any of the sampleAddon files (4 add ons, one XAML), I got this log error...still getting it:

      Error in realtime market data handling: System.NullReferenceException: Object reference not set to an instance of an object.
      at NinjaTrader.NinjaScript.AddOns.SampleAddonWindowTa bPage.marketData_Update(Object sender, MarketDataEventArgs e)
      at NinjaTrader.Data.MarketData.OnMarketData(Object sender, MarketDataEventArgs e)
      at NinjaTrader.Cbi.Instrument.<>c__DisplayClass180_0. <OnRealtimeDataTimerElapsed>b__1(SubscribedThrea d[] threads, Int32 i, RealtimeEvents evts)


      Any advice?

      Comment


        #18
        Hello stephensams,

        I have tested the Sample Addon on my end and was able to reproduce that run-time error.

        To correct this, add a null check within the marketData_Update() method within the SampleAddonWindowTabPage for marketData.Ask and marketData.Bid:
        Code:
        // This event handler is called when new market data happens, the following statements are used to update the user interface. 
                private void marketData_Update(object sender, MarketDataEventArgs e)
                {
        	            if (askLabel != null && marketData.Ask != null)
        	            {
        	                askLabel.Content = marketData.Ask.Price;
        	            }
        	            if (bidLabel != null && marketData.Bid != null)
        	            {
        	                bidLabel.Content = marketData.Bid.Price;
        	            }
        	            if (askVolLabel != null && marketData.Ask != null)
        	            {
        	                askVolLabel.Content = marketData.Ask.Volume;
        	            }
        	            if (bidVolLabel != null && marketData.Bid != null)
        	            {
        	                bidVolLabel.Content = marketData.Bid.Volume;
        	            }
                }
        Zachary G.NinjaTrader Customer Service

        Comment


          #19
          Originally posted by NinjaTrader_ZacharyG View Post
          Hello stephensams,

          I have tested the Sample Addon on my end and was able to reproduce that run-time error.

          To correct this, add a null check within the marketData_Update() method within the SampleAddonWindowTabPage for marketData.Ask and marketData.Bid:
          Code:
          // This event handler is called when new market data happens, the following statements are used to update the user interface. 
                  private void marketData_Update(object sender, MarketDataEventArgs e)
                  {
          	            if (askLabel != null && marketData.Ask != null)
          	            {
          	                askLabel.Content = marketData.Ask.Price;
          	            }
          	            if (bidLabel != null && marketData.Bid != null)
          	            {
          	                bidLabel.Content = marketData.Bid.Price;
          	            }
          	            if (askVolLabel != null && marketData.Ask != null)
          	            {
          	                askVolLabel.Content = marketData.Ask.Volume;
          	            }
          	            if (bidVolLabel != null && marketData.Bid != null)
          	            {
          	                bidVolLabel.Content = marketData.Bid.Volume;
          	            }
                  }
          Thanks for this.
          The syntax gets a bit nicer with C# 6.0, and there are a lot of other C# 6.0 niceties I'm missing now. What are prospects for your supporting it? Thanks.

          e.g.
          if (askLabel != null)
          {
          askLabel.Content = marketData.Ask?.Price;
          }

          Comment


            #20
            Originally posted by dalebru View Post
            if (askLabel != null)
            {
            askLabel.Content = marketData.Ask?.Price;
            }
            I believe, you could even shorten it further to:
            Code:
             
            askLabel?.Content = marketData.Ask?.Price;
            Anyway +1 for the upgrade

            My feeling is that this single feature (null conditional) will be used most extensively in NinjaScript and if it won't be upgraded to .NET 4.6 before final release it won't be upgraded at all because of fear of users' scripts compatibility issues between 4.5 and 4.6. I may be wrong - just a feeling.
            Last edited by gregid; 03-03-2016, 07:55 AM.

            Comment


              #21
              Hello,

              We currently do not have any plans to implement .NET 4.6 as of yet.
              Zachary G.NinjaTrader Customer Service

              Comment


                #22
                adding menu separator - how to apply NT theme on controls

                How to apply default NT theme on the controls?
                For example

                Separator separator = new Separator();

                existingMenuItem.Items.Add(separator);

                add a windows shell style separator, and not the NT theme style.

                Thanks,
                dotnet

                Comment


                  #23
                  Hello dotnet,

                  Here's an example of how you can create a new Separator that has the same style of NT8's menu separators:

                  Code:
                  private Separator theSeparator;
                  
                  theSeparator = new Separator { Style = Application.Current.TryFindResource("MainMenuSeparator") as Style };
                  Zachary G.NinjaTrader Customer Service

                  Comment

                  Latest Posts

                  Collapse

                  Topics Statistics Last Post
                  Started by bmdenton23, Today, 09:28 AM
                  1 response
                  2 views
                  0 likes
                  Last Post NinjaTrader_PatrickG  
                  Started by neoikon, Today, 09:44 AM
                  0 responses
                  1 view
                  0 likes
                  Last Post neoikon
                  by neoikon
                   
                  Started by robertlaub, Today, 09:44 AM
                  0 responses
                  1 view
                  0 likes
                  Last Post robertlaub  
                  Started by Swing123, Today, 09:44 AM
                  0 responses
                  1 view
                  0 likes
                  Last Post Swing123  
                  Started by bmdenton23, Today, 09:39 AM
                  0 responses
                  3 views
                  0 likes
                  Last Post bmdenton23  
                  Working...
                  X