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, 08: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 GLFX005, Today, 03:23 AM
                  0 responses
                  1 view
                  0 likes
                  Last Post GLFX005
                  by GLFX005
                   
                  Started by XXtrader, Yesterday, 11:30 PM
                  2 responses
                  11 views
                  0 likes
                  Last Post XXtrader  
                  Started by Waxavi, Today, 02:10 AM
                  0 responses
                  6 views
                  0 likes
                  Last Post Waxavi
                  by Waxavi
                   
                  Started by TradeForge, Today, 02:09 AM
                  0 responses
                  14 views
                  0 likes
                  Last Post TradeForge  
                  Started by Waxavi, Today, 02:00 AM
                  0 responses
                  3 views
                  0 likes
                  Last Post Waxavi
                  by Waxavi
                   
                  Working...
                  X