• 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

Create a Window Similar to NinjaTrader's ???

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

    Create a Window Similar to NinjaTrader's ???

    Hi,

    I want to make a custom alert window for my indicators.
    I find NinjaTrader's windows very elegant and professional with a nice red-box title at the left top.

    Can we create a NinjaTrader-style window, then add our custom contents?
    Does NinjaTrader support us to do this?

    Thank you very much.
    ninZa
    NinjaTrader Ecosystem Vendor - ninZa.co

    #2
    Yes, you can and this is supported through the new AddOn framework.

    You can use the NTWindow class which will allow you to style your windows like NinjaTrader 8's.

    You can also use various controls like the instrument and interval selector.

    Please see the attached AddOn which will demonstrate how this can be done.

    There is also some limited documentation available which is currently a work in progress while we're in beta.

    http://ninjatrader.com/support/helpG...-us/add_on.htm
    Attached Files
    MatthewNinjaTrader Product Management

    Comment


      #3
      Originally posted by NinjaTrader_Matthew View Post
      Yes, you can and this is supported through the new AddOn framework.

      You can use the NTWindow class which will allow you to style your windows like NinjaTrader 8's.

      You can also use various controls like the instrument and interval selector.

      Please see the attached AddOn which will demonstrate how this can be done.

      There is also some limited documentation available which is currently a work in progress while we're in beta.

      http://ninjatrader.com/support/helpG...-us/add_on.htm
      It's great that NT supports this. I will check and learn from the documentation to build a custom NT-style alert window.

      Basically, I will have to create an addon file, and in my indicator I call the addon, right? Can you let me know if NT automatically includes the addon file in the indicator export, and then users can import it normally using the indicator import feature of NT?

      Thanks.
      ninZa
      NinjaTrader Ecosystem Vendor - ninZa.co

      Comment


        #4
        Yes, I would expect it to but found a bug while I was confirming that and have reported using ID # 9091
        MatthewNinjaTrader Product Management

        Comment


          #5
          Originally posted by NinjaTrader_Matthew View Post
          Yes, I would expect it to but found a bug while I was confirming that and have reported using ID # 9091
          Thanks Matthew.

          Is it a correct approach if I don't write an addon. Instead I write the class directly in my indicator source code:

          internal class AlertWindow : NTWindow {

          public AlertWindow() {

          Caption = "Alert window";
          Width = 300;
          Height = 300;
          }
          }
          Then create an AlertWindow object and Show() it when needed in the indicator?

          Just a quick idea coming to my mind.

          Thanks.
          Last edited by ninZa; 11-11-2015, 01:43 AM.
          ninZa
          NinjaTrader Ecosystem Vendor - ninZa.co

          Comment


            #6
            Hello ninZa,

            You could go that route. I have seen this used with NT 8 indicators in the manner you detailed.
            Patrick H.NinjaTrader Customer Service

            Comment


              #7
              Originally posted by NinjaTrader_PatrickH View Post
              Hello ninZa,

              You could go that route. I have seen this used with NT 8 indicators in the manner you detailed.
              Wonderful. Where do you see that, Patrick? Is it possible to post the indicator's code here as a reference/guide?

              Thank you very much.
              ninZa
              NinjaTrader Ecosystem Vendor - ninZa.co

              Comment


                #8
                Hello ninZa,

                Thank you for your patience.

                Attached is an example of adding a button to the chart that can open a new window from the indicator. If you have any questions please let me know.
                Attached Files
                Patrick H.NinjaTrader Customer Service

                Comment


                  #9
                  Originally posted by NinjaTrader_PatrickH View Post
                  Hello ninZa,

                  Thank you for your patience.

                  Attached is an example of adding a button to the chart that can open a new window from the indicator. If you have any questions please let me know.
                  Thank you Patrick.

                  Because I could not manage to build the custom window based on NTWindow, I've build it from Window class. But thanks to your code I will definitely resume investigating the possibility with NTWindow. No special codes different from mine, but my version didn't work while yours work. Maybe it's Globals.RandomDispatcher that makes the difference?

                  I will study this and let you know.

                  Thank you.
                  ninZa
                  NinjaTrader Ecosystem Vendor - ninZa.co

                  Comment


                    #10
                    Update: I've successfully built a custom NTWindow, no matter I use Globals.RandomDispatcher, this.Dispatcher, or ChartControl.Dispatcher to BeginInvoke (or Invoke) the action.

                    My original codes (that didn't work) are not different from yours. What was wrong with it ! Perhaps I made a stupid mistake somewhere.

                    Thanks Patrick.
                    ninZa
                    NinjaTrader Ecosystem Vendor - ninZa.co

                    Comment


                      #11
                      I know the reason
                      • I put the NTWindow-based class inside the indicator class
                      • You put the NTWindow-based class OUTSIDE the indicator class


                      So we have to put it at the same level as our indicator classes, inside the namespace NinjaTrader.NinjaScript.Indicators.

                      Using a naming convention (e.g. with a prefix) can prevent the error "The namespace already contains a definition for...", but this is not something really cool.
                      ninZa
                      NinjaTrader Ecosystem Vendor - ninZa.co

                      Comment


                        #12
                        I am glad you found the resolution here.
                        Patrick H.NinjaTrader Customer Service

                        Comment

                        Latest Posts

                        Collapse

                        Topics Statistics Last Post
                        Started by mittie3, Today, 03:33 AM
                        0 responses
                        5 views
                        0 likes
                        Last Post mittie3
                        by mittie3
                         
                        Started by Againmain1, Today, 03:04 AM
                        0 responses
                        7 views
                        0 likes
                        Last Post Againmain1  
                        Started by tonytimpa, Today, 01:33 AM
                        0 responses
                        5 views
                        0 likes
                        Last Post tonytimpa  
                        Started by kiwidtrader, Yesterday, 11:49 PM
                        0 responses
                        5 views
                        0 likes
                        Last Post kiwidtrader  
                        Started by jmahon, Yesterday, 11:44 PM
                        0 responses
                        7 views
                        0 likes
                        Last Post jmahon
                        by jmahon
                         
                        Working...
                        X