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

Coding Help Needed

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

    #16
    Hello Mukaddim,

    You are trying to set a series value to,

    Code:
    (barsAgo, sPoints.hPoint);
    Which likley is the problem. Perhaps there is a method that is supposed to be passed this? For example, MyMethod(BarsAgo, sPoints.hPoint);?

    I look forward to you reply.
    Alan P.NinjaTrader Customer Service

    Comment


      #17
      Hi AlanP
      Thanks, I noticed some mistakes I made while copying the codes into my post. There's no such method, just a Set method in NT7. Please see the corrected code below

      NT 7: HighDot.Set(barsAgo, sPoints.hPoint);
      NT 8: HighDot[0] = (barsAgo, sPoints.hPoint);

      I look forward to your reply.
      Thanking
      Mukaddim

      Comment


        #18
        Hello Mukaddim,

        If you print the value of what you are trying to set HighDot[0] to, (barsAgo, sPoints.hPoint), what is the result you are receiving?

        Print((barsAgo, sPoints.hPoint).ToString());

        I look forward to your reply.
        Alan P.NinjaTrader Customer Service

        Comment


          #19
          Hi AlanP,
          Got it sorted, thanks. Would you be able to figure out in which NT8 Nnmespace BarsData resides in? In NT7 it resides in NinjaTrader.Gui.Chart.BarsData. It no longer is in the same namespace in NT8.

          Thanking,
          Mukaddim

          Comment


            #20
            Hello Mukaddim,

            This is not documented.

            What are you attempting to do or can you provide a use case?

            I look forward to your reply.
            Alan P.NinjaTrader Customer Service

            Comment


              #21
              Originally posted by NinjaTrader_AlanP View Post
              Hello Mukaddim,

              This is not documented.

              What are you attempting to do or can you provide a use case?

              I look forward to your reply.
              Hi AlanP,
              It seems most of the NinjaTrader Namespaces are not documented, most of the indicators use classes from NT Namespaces. That's where I'm stuck while trying to convert. Can't get anything out of it. For an example, would you be able to tell me the equivalent code for the following NT7 code?

              ChartControl.ChartPanel.MouseUp += new MouseEventHandler(MouseUpEventHandler);

              Now ChartControl in NT8 has ChartPanels but that doesnot have MouseUp....

              Thanking
              Mukaddim

              Comment


                #22
                Originally posted by Mukaddim View Post
                Would you be able to figure out in which NT8 Nnmespace BarsData resides in? In NT7 it resides in NinjaTrader.Gui.Chart.BarsData. It no longer is in the same namespace in NT8.
                It's possible the name has changed to "ChartBars".
                (But I don't know for sure)

                Good luck!

                Comment


                  #23
                  Hello Mukaddim,

                  To find the NT8 standard namespaces that are used in the type of item in question, please generate an Indicator or the type of file you want in the NinjaScript editor and the standard NT8 namespaces will be at the top of the file. For other namespaces you may want to use, you can use the Intelleprompt in the NinjaScript editor or you may need to use more extensive tools such as Visual Studio which has much more detailed intellesense and object viewers to explore further.

                  The various namespaces for NinjaScript objects are not documented as that would just read like a programming API which would be difficult for most users of NinjaScript. The help guide is instead laid out in sections of types that can be used. Inside of each type are the inherited properties and methods that can be used with that type of NinjaScript object. If you would like a namespace hierarchy where you can view all objects inside of each namespace, you could use Visual studios view -> object browser to see this with the NinjaTrader custom project open.

                  NT8 separates the chart objects more, you can find the various chart objects documented here such as ChartPanel: https://ninjatrader.com/support/help...n-us/chart.htm

                  The event handlers events specifically will not be documented at all as you are venturing into standard C# territory which is not specific to NinjaScript.

                  NT8 now uses WPF instead of Windows Forms, if you are using advanced C# items like control event handlers such as the Mouse Up event, you will likely need to search online for C# related answers. One example would be "C# WPF mouse event examples" which would bring up quite a few examples of the WPF mouse events that are available. Knowing what events are available could help while you explore objects or search for answers.

                  I would also suggest searching the forums for the WPF event you are targeting for further NinjaScript examples that may already exist. For example, if you wanted to know about mouse down events in NT8, you could search the NT8 subforums for mouse events that are in WPF like the following "MouseDown event nt8" which results in https://m.ninjatrader.com/support/fo...8370&styleid=6
                  This post would also help with MouseUp events as they would also exist in that object.


                  I look forward to being of further assistance.
                  JesseNinjaTrader Customer Service

                  Comment


                    #24
                    Originally posted by NinjaTrader_Jesse View Post
                    Hello Mukaddim,

                    To find the NT8 standard namespaces that are used in the type of item in question, please generate an Indicator or the type of file you want in the NinjaScript editor and the standard NT8 namespaces will be at the top of the file. For other namespaces you may want to use, you can use the Intelleprompt in the NinjaScript editor or you may need to use more extensive tools such as Visual Studio which has much more detailed intellesense and object viewers to explore further.

                    The various namespaces for NinjaScript objects are not documented as that would just read like a programming API which would be difficult for most users of NinjaScript. The help guide is instead laid out in sections of types that can be used. Inside of each type are the inherited properties and methods that can be used with that type of NinjaScript object. If you would like a namespace hierarchy where you can view all objects inside of each namespace, you could use Visual studios view -> object browser to see this with the NinjaTrader custom project open.

                    NT8 separates the chart objects more, you can find the various chart objects documented here such as ChartPanel: https://ninjatrader.com/support/help...n-us/chart.htm

                    The event handlers events specifically will not be documented at all as you are venturing into standard C# territory which is not specific to NinjaScript.

                    NT8 now uses WPF instead of Windows Forms, if you are using advanced C# items like control event handlers such as the Mouse Up event, you will likely need to search online for C# related answers. One example would be "C# WPF mouse event examples" which would bring up quite a few examples of the WPF mouse events that are available. Knowing what events are available could help while you explore objects or search for answers.

                    I would also suggest searching the forums for the WPF event you are targeting for further NinjaScript examples that may already exist. For example, if you wanted to know about mouse down events in NT8, you could search the NT8 subforums for mouse events that are in WPF like the following "MouseDown event nt8" which results in https://m.ninjatrader.com/support/fo...8370&styleid=6
                    This post would also help with MouseUp events as they would also exist in that object.


                    I look forward to being of further assistance.
                    Hi Jesse,
                    Thanks very very much, yes I'm venturing into C# while dealing with events such as MouseUp. It is also very helpful that you've provided some example codes which I can get into for further study and investigation on how it is being used specifically in NT8 scripts. I'll go through the links and examples and see what I find. Thanks very much again!

                    Mukaddim

                    Comment


                      #25
                      Hi, I need some assistance regarding the following piece of code to convert to NT8 from NT7

                      private NinjaTrader.Gui.Chart.Plot plotLine = new NinjaTrader.Gui.Chart.Plot(new Pen(Color.Green, 3f), PlotStyle.Line, "8 ");

                      Thanking
                      Mukaddim

                      Comment


                        #26
                        What error message do you get?
                        Is this method located inside a method or outside a method?

                        Removing 'private' and reducing excess wordiness, such as below,

                        Code:
                        Plot plotLine = new Plot(new Pen(Color.Green, 3), PlotStyle.Line, "8 ");
                        works fine for me in NT7.

                        [That is, assuming this variable is meant to be declared inside a function
                        which is why 'private' needs to be removed.]

                        Comment


                          #27
                          Originally posted by bltdavid View Post
                          What error message do you get?
                          Is this method located inside a method or outside a method?

                          Removing 'private' and reducing excess wordiness, such as below,

                          Code:
                          Plot plotLine = new Plot(new Pen(Color.Green, 3), PlotStyle.Line, "8 ");
                          works fine for me in NT7.

                          [That is, assuming this variable is meant to be declared inside a function
                          which is why 'private' needs to be removed.]
                          Hi, I'm converting an NT7 indicator to NT8. The line of code provided is of NT7. While compiling in NT8, that line gives me the following error.

                          The type or namespace name 'Plot' does not exist in the namespace 'NinjaTrader.Gui.Chart' (are you missing an assembly reference?)

                          I would like to know which namespace in NT8 contains Plot, so I could convert accordingly.

                          Thanking
                          Mukaddim

                          Comment


                            #28
                            Hello Mukaddim,

                            Thank you for the post.

                            While converting items from NT7 you will find the code-breaking changes document helpful: https://ninjatrader.com/support/help...ng_changes.htm

                            Add(Plot has been replaced for AddPlot:


                            Not all types are the same in NT8 so using the help guide is going to be important when there is a breaking change. There is a sample on the linked page, otherwise, the easiest way to generate the syntax for core parts of your script is to use the indicator wizard. You can generate a new indicator, and while doing so you can set up plots and other user inputs to avoid having to manually generate that code. You can then copy the generated code into your script, or just start from the generated script.

                            I look forward to being of further assistance.
                            JesseNinjaTrader Customer Service

                            Comment


                              #29
                              Originally posted by NinjaTrader_Jesse View Post
                              Hello Mukaddim,

                              Thank you for the post.

                              While converting items from NT7 you will find the code-breaking changes document helpful: https://ninjatrader.com/support/help...ng_changes.htm

                              Add(Plot has been replaced for AddPlot:


                              Not all types are the same in NT8 so using the help guide is going to be important when there is a breaking change. There is a sample on the linked page, otherwise, the easiest way to generate the syntax for core parts of your script is to use the indicator wizard. You can generate a new indicator, and while doing so you can set up plots and other user inputs to avoid having to manually generate that code. You can then copy the generated code into your script, or just start from the generated script.

                              I look forward to being of further assistance.
                              Thanks Jesse..Will look into it. Do you happen to havs a complete reference on how to convert override void Plot()? It has to do something wiyh OnRender () I suppose. Please give me any example indicator that shows a complete OnRender() method implementation, apart from the one that comes with NT8.

                              Thanking
                              Mukaddim

                              Comment


                                #30
                                Hello Mukaddim,

                                Thank you for the reply.

                                By the one that comes with nt8, are you referring to the SampleCustomRender?

                                That would be the most complete sample that I could provide as that demonstrates all of the core rendering concepts in NinjaTrader. From that sample, you could explore rendering further in the areas that interest you.

                                Alternatively, you could see other indicators or drawing tools which use OnRender. all of the drawing objects use OnRender along with the Pivots indicator as a few examples.

                                I look forward to being of further assistance.
                                JesseNinjaTrader Customer Service

                                Comment

                                Latest Posts

                                Collapse

                                Topics Statistics Last Post
                                Started by ScottWalsh, 04-16-2024, 04:29 PM
                                7 responses
                                34 views
                                0 likes
                                Last Post NinjaTrader_Gaby  
                                Started by cls71, Today, 04:45 AM
                                0 responses
                                5 views
                                0 likes
                                Last Post cls71
                                by cls71
                                 
                                Started by mjairg, 07-20-2023, 11:57 PM
                                3 responses
                                214 views
                                1 like
                                Last Post PaulMohn  
                                Started by TheWhiteDragon, 01-21-2019, 12:44 PM
                                4 responses
                                547 views
                                0 likes
                                Last Post PaulMohn  
                                Started by GLFX005, Today, 03:23 AM
                                0 responses
                                3 views
                                0 likes
                                Last Post GLFX005
                                by GLFX005
                                 
                                Working...
                                X