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.

    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.

            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

                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.

                        Comment

                        Latest Posts

                        Collapse

                        Topics Statistics Last Post
                        Started by kaywai, 09-01-2023, 08:44 PM
                        5 responses
                        601 views
                        0 likes
                        Last Post NinjaTrader_Jason  
                        Started by xiinteractive, 04-09-2024, 08:08 AM
                        6 responses
                        22 views
                        0 likes
                        Last Post xiinteractive  
                        Started by Pattontje, Yesterday, 02:10 PM
                        2 responses
                        19 views
                        0 likes
                        Last Post Pattontje  
                        Started by flybuzz, 04-21-2024, 04:07 PM
                        17 responses
                        230 views
                        0 likes
                        Last Post TradingLoss  
                        Started by agclub, 04-21-2024, 08:57 PM
                        3 responses
                        17 views
                        0 likes
                        Last Post TradingLoss  
                        Working...
                        X