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

Dynamically Change PlotStyle

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

    Dynamically Change PlotStyle

    Is it possible to dynamically change PlotStyle, for example from PlotStyle.Line to PlotStyle.Dot, while plotting to create plots like the one in the attached screen image where the solid portion is known values and the dotted portion is predicted? That plot was created using two different plots which is inefficient compared to being able to merely change the PlotStyle of a single plot dynamically, but I haven't been able to find a supported way to do that.


    #2
    Hello caveat_lector,

    Thank you for the post.

    I am not aware of any suggested way to change the actual plot style while plotting, using more than one plot would likely be the best alternative. You could also use OnRender if you didn't want to use more than one plot, OnRender can be used to hide plots and do custom rendering in their place.


    I look forward being of further assistance.
    JesseNinjaTrader Customer Service

    Comment


      #3
      TradeStation, Thinkorswim, and several other user-programmable platforms support dynamically changing plot styles. The capability has many applications and would be a valuable improvement.

      Comment


        #4
        Will you submit a feature request to support dynamic PlotStyle changes?

        Comment


          #5
          Hello caveat_lector,

          Yes I will put in a feature request for this item.


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

          Comment


            #6
            Please add my vote for dynamic PlotStyle changes. Also, by adding more plots for each style will I run out of available plots? Is there a max number of Plots? Does adding more plots even if the plots are empty or not used affect performance?

            Comment


              #7
              Hello plutotrader,

              There is not a limit that I am aware of, if you are just adding a few plots to have different styles that wouldn't really make much of a difference.

              If you were doing something where you needed a huge number of plots like 1000 plots that would likely cause a performance impact and should instead be using OnRender to display the data.

              OnRender could be used in contrast to the original question to display different plots or display the data in a dynamic way however that is beyond the scope of the asked question. The PlotStyle specifically for the actual plot cannot be dynamic and two plots could be used in that situation / feature has been requested.

              If you wanted to use only a single plot you could instead use OnRender for that purpose and render a plot on your own. You could choose to style the path any way you wanted or make multiple paths with different styles. This would be a more advanced task and would not be as simple as the asked for feature in post 1. If you wanted to explore this concept take a look at the Pivots indicator and how it makes use of the Plots but also how it makes use of OnRender to hide the plots and render custom visuals.


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

              Comment


                #8
                Thank you very much Jesse. I ended up using a difference style for even and odd numbered series and putting zeros in the lines that are not needed. This may be a little off topic, but is there a way to plot one bar into the future, i.e. Values[-1] this would solve a big issue for me as with using plots for multiple timeframes, the higher timeframe plots don't get theiir lines extended until the bar closes. for a 1min chart plotted with a 60min that means that looking that the 1 min with a 60m series, I don't see the line(indicator) extended until the 60m closes. Just want to extend out one bar into the future so I can see it. Thanks.

                Comment


                  #9
                  Oh, I see that you have a number of posts related to this, i.e. https://ninjatrader.com/support/foru...-extend-a-line

                  Comment


                    #10
                    Hello plutotrader,

                    Thank you for the reply.

                    There is not a specific system in place for plotting in the future however you can calculate drawings into the future. I have one previous post saved that could help here for 1 or more bars into the future: https://ninjatrader.com/support/foru...th?postcount=3
                    If you wanted to project a line into the future similar logic to that sample could be used. Rather than using BarsAgo that makes use of OnRender to calculate a ray to a certain distance.

                    If you wanted to change the sample you could make a modification where a horizontal reference ray is drawn at the price you wanted, a ray with the same start and end prices and 1 bars between anchors. This could then be used to extend the drawing by 1 bar and give a flat appearance. You could also project a direction similar to how the sample works as well.


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

                    Comment


                      #11
                      Thank you very much Jesse, that looks like just what I need.

                      Comment

                      Latest Posts

                      Collapse

                      Topics Statistics Last Post
                      Started by Barry Milan, Yesterday, 10:35 PM
                      5 responses
                      16 views
                      0 likes
                      Last Post NinjaTrader_Manfred  
                      Started by DanielSanMartin, Yesterday, 02:37 PM
                      2 responses
                      13 views
                      0 likes
                      Last Post DanielSanMartin  
                      Started by DJ888, 04-16-2024, 06:09 PM
                      4 responses
                      12 views
                      0 likes
                      Last Post DJ888
                      by DJ888
                       
                      Started by terofs, Today, 04:18 PM
                      0 responses
                      11 views
                      0 likes
                      Last Post terofs
                      by terofs
                       
                      Started by nandhumca, Today, 03:41 PM
                      0 responses
                      8 views
                      0 likes
                      Last Post nandhumca  
                      Working...
                      X