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

charting custom series/ indicators

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

    charting custom series/ indicators

    Hello. I'm confused around how to add custom series to my chart from my NinjaScript. I was looking at the AddPlot / Values methodology, but wasn't clear to me how I specify which panel the value gets displayed on.

    Specifically, I would like to plot a value on the main panel which is an arithmetic function of the SMA, and another value in a separate panel which is an arithmetic function of the RSI.

    So two questions:
    1) Do i need to set these up as custom indicators/ ISeries, or is it sufficent to just define them using Values[x][y]?
    2) How do i specify where they get plotted? I don't see any parameters in the AddPlot/ Values framework that would enable me to say which panel they show up on.

    Thanks

    #2
    Hello stewarco,

    Thanks for the post.

    An indicator can only plot to one panel with the exception that Drawing Objects. For two separate panels with plots to be used you could use two indicators. You can also use a strategy to host two indicators with separate settings to automate applying them.

    The panel will be controlled by the indicators IsOverlay property, if you set that to false a new panel is generated by default when it is applied. You could create two indicators, one which uses IsOverlay and a second which does not. A strategy can also use AddChartIndicator to automate adding two indicators in its code to be displayed. https://ninjatrader.com/support/help..._a_ninjasc.htm

    If you can use drawing objects for one of the datas you want to display you could use IsOverlay = false and DrawInPricePanel = true to draw the plot in a second panel and the drawing objects in the price panel.

    I look forward to being of further assistance.


    JesseNinjaTrader Customer Service

    Comment


      #3
      thanks these are good ideas

      Comment


        #4
        Hey Jesse. So far I've been able to draw plots on my Price panel, so thanks for that. However, I'm trying to do something else which should be basic, I think, but after reviewing the sample strategy and trying to incorporate the snippets I'm still running into trouble.

        I have two indicator panels showing separate RSIs. All I'm looking to do is draw a horizontal line on the RSI panels, but can't figure out how to do it. Is there a simple command to do this from within NinjaScript?

        Thanks

        Comment


          #5
          Hello stewarco,

          Thanks for the post.

          This would be a situation where you would want to make a custom RSI indicator for that purpose. The strategies drawings are going to be placed in the price panel or panel the strategy resides in. The indicator would need to draw the line for it to show up in that specific indicators panel.

          If your strategy is the reason the line is being triggered and the RSI doesn't contain the logic to make the line you could make an input in a custom RSI to accept some type of input from the strategy to know when to draw the line. It can be as simple as duplicating the RSI and renaming it and adding the line also.

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

          Comment


            #6
            hey Jessie. I was just about to suggest a similar idea... so if I understand you correctly, the easiest approach would probably be for me to customize the existing RSI indicator, just adding some logic where I pass an additional parameter that's used to calculate my line, and then add an additional Value output corresponding to that line?

            Comment


              #7
              Hello stewarco,

              Right you would just draw the line from the custom RSI. You could pass anything needed in as a parameter like you mentioned and then do the calculation/drawing right from that indicator.

              As long as the custom RSI draws the object it should be able to show up in that panel as long as the custom RSI also has DrawInPricePanel = false.

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

              Comment


                #8
                thanks. I think I'm converging on what I need. last question:
                My indicator is returning the correct values, and the indicator panel shows that the values I want to display are configured, but the actual panel is empty. what is the actual command I use within the indicator. Draw?

                Comment


                  #9
                  Hello stewarco,

                  Can I clarify, do you mean that you can see the price marker on the right but the Plot is not appearing? Can you provide an image?


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

                  Comment


                    #10
                    never mind, everything is working now. thanks!

                    Comment


                      #11
                      hey Jesse. one last (I hope) related question: how do I specify the scale for the indicator y-axis? it appears to be auto-scaling somehow, but I would prefer to have it fixed.
                      thanks

                      Comment


                        #12
                        Hello stewarco,

                        You can adjust the Y scale using the OnCalculateMinMax override:


                        If you mean instead to manipulate the charts properties to become fixed that would require other syntax, using the OnCalculateMinMax is generally the suggested route to make a fixed or otherwise different scale from what autoscale provides
                        ​​​​​​​

                        I look forward to being of further assistance.

                        JesseNinjaTrader Customer Service

                        Comment

                        Latest Posts

                        Collapse

                        Topics Statistics Last Post
                        Started by algospoke, Today, 06:40 PM
                        0 responses
                        10 views
                        0 likes
                        Last Post algospoke  
                        Started by maybeimnotrader, Today, 05:46 PM
                        0 responses
                        8 views
                        0 likes
                        Last Post maybeimnotrader  
                        Started by quantismo, Today, 05:13 PM
                        0 responses
                        7 views
                        0 likes
                        Last Post quantismo  
                        Started by AttiM, 02-14-2024, 05:20 PM
                        8 responses
                        168 views
                        0 likes
                        Last Post jeronymite  
                        Started by cre8able, Today, 04:22 PM
                        0 responses
                        10 views
                        0 likes
                        Last Post cre8able  
                        Working...
                        X