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

SuperDOM Indicator

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

    SuperDOM Indicator

    Hello, I am trying to get this indicator to plot lines on the SuperDOM similar to what the Bollinger band does. Thank you in advance, Robert
    Attached Files

    #2
    Hello rturner86,

    Thanks for your post.

    In order for an indicator to display on the SuperDOM, we must set IsOverlay to true (the script is doing this already) and then add plots for the lines you want to display. You indicator is using Drawing methods and would need to assign the values to plots instead.

    Our indicator tutorials and AddPlot Documentation will be a great place to start.

    Indicator tutorials - https://ninjatrader.com/support/help...indicators.htm

    AddPlot - https://ninjatrader.com/support/help...ml?addplot.htm

    Let us know if there is anything else we an do to help.
    JimNinjaTrader Customer Service

    Comment


      #3
      Could you please instruct me what needs to be changed in this setting? Thank, you Robert

      double risk01 = (c1*100) + r01;
      HorizontalLine riskLine01 = Draw.HorizontalLine(this, "Line01" , risk01 , Spot , true);
      riskLine01.Stroke = new Stroke(Spot, DashStyleHelper.Solid, width);

      Comment


        #4
        Hello Robert,

        Those lines of code are going to place a line drawing object on a chart. Those lines of code will not work on the SuperDOM.

        Instead of drawing the value with Draw.HorizontalLine(), you need to add a plot, and assign values to the plot. So you will need to remove uses of Draw.HortizontalLine() and replace them with indicator plotting code.

        The AddPlot documentation given in post #2 will show you how to create plots and assign values to these plots.

        The indicator tutorials in post #2 will also walk you through building an indicator and setting up plots.

        Going through those resources will give you the tools needed to replace the code that uses the Drawing methods with the plotting code.

        Let us know if you have any additional questions.
        JimNinjaTrader Customer Service

        Comment


          #5
          Hello, could you please give an example on what's needed? I worked on this all weekend with no luck.


          Thanks in advance,

          Robert turner

          Comment


            #6
            Hello Robert,

            Were you having trouble going through the indicator tutorial, and setting up an indicator that simply adds plots and assigns values?

            This should be the first step in being able to understand what would be involved for having your indicator plot the values instead of drawing horizontal lines with them.

            It will be best to attain all of the building blocks before building indicators or making modifications, otherwise it will be difficult to know what changes to make. Let us know if you have questions on those resources, and then try what is mentioned below:

            How plots are assigned...

            Plots are added with AddPlot in OnStateChange under State.SetDefaults.

            Values are then assigned to the plot value in OnBarUpdate.

            Values[0][0] = Close[0];

            The above would assign the close price of the bar to the first plot's value associated with that bar.

            Values[1][0] = Open[0];

            The above would assign the open price of the bar to the second plot's value associated with that bar.

            What your script is doing...

            Your script is not assigning plots, it is just drawing horizontal lines at different levels.

            Code:
            double risk01 = (c1*100) + r01;
            HorizontalLine riskLine01 = Draw.HorizontalLine(this, "Line01" , risk01 , Mark , true);
            What to do instead...

            1. Add a plot to represent each line in OnStateChange under State.SetDefaults:

            Code:
            AddPlot(Brushes.Orange, "Risk01");
            AddPlot(Brushes.Orange, "Spot01");
            AddPlot(Brushes.Orange, "Risk02");
            ...
            2. Assign risk01 to the current value of the first plot when it gets calculated in OnBarUpdate:

            Code:
            double risk01 = (c1*100) + r01;
            Values[0][0] = risk01;
            do this for spot01, spot02, risk02, risk03, etc.

            Code:
            double spot01 = (c1*100) + s01;
            Values[1][0] = spot01;
            JimNinjaTrader Customer Service

            Comment


              #7
              Hello Jim,

              I have added 4 plots but they still not display. I have attached the new script. Any more help is greatly appreciated!

              Thank you in advance,

              Robert Turner
              Attached Files

              Comment


                #8
                Hello Robert,

                I have received your note.

                Please make sure you are assigning values to the correct plot:

                Values[0][0] represents the current bar value associated with the first plot

                Values[1][0] represents the current bar value associated with the second plot

                Values[2][0] represents the current bar value associated with the third plot

                Setting up the logic as seen in my attached screenshot shows the gold plot is being plotted.

                Also be sure to check the values being assign to the plot to know where the line will show up.

                If you do not see results on your SuperDOM window, the process to checking the indicator would be to:

                1. Check the log tab of the Control Center to see if you are hitting any run time errors in your code
                2. Use debugging prints in the script to confirm: A.) the values being assigned to the plot, and B.) the code is reaching that plot assignment.

                Debugging tips - https://ninjatrader.com/support/help...script_cod.htm
                Attached Files
                JimNinjaTrader Customer Service

                Comment


                  #9
                  Hello Jim,

                  This did not work correctly. The gold plot style line should plot at the NQ 02 below current price and the NQ 02 above current price. The plots should move to to the next 100 block as current price moves to the next 100 block up or down. This based of the attached indicator. I am not sure why the gold plot is at 4472. My goal here is to have the plots on the SuperDOM match the drawn lines on the chart. I copied your example and it did not plot any lines. I really appreciate your help.

                  Thanks,
                  Robert
                  Attached Files

                  Comment


                    #10
                    Hello Robert,

                    The plot will reside at the value assigned to it.

                    The code calculates the value and assigns it as we see here:

                    Code:
                    double risk01 = (c1*100) + r01;
                    Values[0][0] = risk01;
                    Prints can be added to the script to show the value of "risk01" and you can confirm this printed value from the NinjaScript Output window to the SuperDOM and you will see the print matches where the line is plotted in the SuperDOM window.

                    If you do not see a plot line where you expect, the steps would be:

                    1. Check where that plot is assigned in code
                    2. Print out the values being assigned to the plot to confirm the printed value matches the value on the chart (This is mostly a sanity test to show that the value you assign is the value that gets displayed.)
                    3. Then you would trace the variables back to see how those are calculated to understand how that value came up.

                    Notice that I changed the Position variable in order to see the value on the chart.

                    If making these changes are too difficult, you may also consider enlisting the services of a NinjaScript Consultant to make these modifications for you. If that is something that interests you, please let me know and we can have an EcoSystem representative provide additional information.
                    JimNinjaTrader Customer Service

                    Comment


                      #11
                      Hello Jim,


                      I have added 4 plots but they still not display. I have attached the new script. Any more help is greatly appreciated!

                      Thank you in advance,

                      Robert Turner

                      Comment


                        #12
                        Hello Jim,

                        I am sorry about the last post. I am interested in the Ninjascript Consultant and EcoSystem representative to provide additional information.

                        Thanks, Robert

                        Comment


                          #13
                          Hello,

                          Thank you for your post.

                          You can search our list of NinjaScript consultants through the link below. Simply enter a consultant name or search by using our filter categories. Once you have identified your consultants of choice, please visit each consultant's site for more information or contact them directly to learn more:
                          You can locate the contact information for the consultants on their direct websites for any additional questions you may have. Since these consultants are third-party services for NinjaTrader, all pricing and support information will need to be obtained through the consultant.

                          The NinjaTrader Ecosystem website is for educational and informational purposes only and should not be considered a solicitation to buy or sell a futures contract or make any other type of investment decision. The companies and services listed on this website are not to be considered a recommendation and it is the reader's responsibility to evaluate any product, service, or company. NinjaTrader Ecosystem, LLC is not responsible for the accuracy or content of any product, service or company linked to on this website.

                          Let me know if I may be of further assistance.
                          Thomas C.NinjaTrader Customer Service

                          Comment


                            #14
                            Originally posted by NinjaTrader_Jim View Post
                            Hello Robert,

                            The plot will reside at the value assigned to it.

                            The code calculates the value and assigns it as we see here:

                            Code:
                            double risk01 = (c1*100) + r01;
                            Values[0][0] = risk01;
                            Prints can be added to the script to show the value of "risk01" and you can confirm this printed value from the NinjaScript Output window to the SuperDOM and you will see the print matches where the line is plotted in the SuperDOM window.

                            If you do not see a plot line where you expect, the steps would be:

                            1. Check where that plot is assigned in code
                            2. Print out the values being assigned to the plot to confirm the printed value matches the value on the chart (This is mostly a sanity test to show that the value you assign is the value that gets displayed.)
                            3. Then you would trace the variables back to see how those are calculated to understand how that value came up.

                            Notice that I changed the Position variable in order to see the value on the chart.

                            If making these changes are too difficult, you may also consider enlisting the services of a NinjaScript Consultant to make these modifications for you. If that is something that interests you, please let me know and we can have an EcoSystem representative provide additional information.
                            Jim,

                            Please, could you post your full version of the KundanTonyNQ script.

                            lolu

                            Comment


                              #15
                              Hello, I have attached the full version of the KundanTonyNQ script.

                              Thanks, Robert
                              Attached Files

                              Comment

                              Latest Posts

                              Collapse

                              Topics Statistics Last Post
                              Started by kevinenergy, 02-17-2023, 12:42 PM
                              117 responses
                              2,766 views
                              1 like
                              Last Post jculp
                              by jculp
                               
                              Started by Mongo, Today, 11:05 AM
                              5 responses
                              15 views
                              0 likes
                              Last Post NinjaTrader_ChelseaB  
                              Started by SightCareAubetter, Today, 12:55 PM
                              0 responses
                              3 views
                              0 likes
                              Last Post SightCareAubetter  
                              Started by traderqz, Today, 12:06 AM
                              8 responses
                              16 views
                              0 likes
                              Last Post traderqz  
                              Started by SightCareAubetter, Today, 12:50 PM
                              0 responses
                              2 views
                              0 likes
                              Last Post SightCareAubetter  
                              Working...
                              X