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

Changing plot styles and colors on same data series

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

    Changing plot styles and colors on same data series

    Hi everyone

    Thanks for all the recent help but there's something I haven't looked at before that I really can't crack on my own.

    For various arcane reasons (and believe me, there is some logic behind this!) I would like a line from the same data series on a chart to switch for the n most recent bars from PlotStyle.Line to PlotStyle.Dot and to a different color.

    The attached graphic is what I hope to achieve though I've 'doctored' it in Paint to make it look like what I'm aiming for. (I've used an EMA here but the indicator I'm intending this for is one of my own.)

    I've tried everything I can think of but nothing has worked.

    As always, much obliged in advance for any help.
    Attached Files

    #2
    Hi arbuthnot,

    To accomplish this you will need two plots. Set the first plot when you would like to view the line and do not set the second plot. Then when you want the dots, set the second plot and not the first.
    Chelsea B.NinjaTrader Customer Service

    Comment


      #3
      Thanks very much for your prompt reply, Chelsea.

      I have indeed coded two series for the same data on one indicator sheet. What I'm trying to achieve is to make one plot line invisible or transparent when the other is visible and, at the desired point, say, for the ten most recent data points, switch this.

      Whatever I've tried has only resulted in having the PlotStyle.Line being overlayed by PlotStyle.Dot.

      I've just realised that I'm sure I can achieve this by 'Saving As' to give my indicator an amended name (so I'd have, say, 'Indicator' and 'IndicatorA'). Then I would then load both 'Indicator' and 'IndicatorA' onto the chart and use the 'return' method to render the 'unwanted' line invisible for the required period.

      But my goal is to achieve this on one single indicator sheet, if you see what I mean. You said,
      "To accomplish this you will need two plots"
      Do you mean two plots on two distinct indicator sheets. I can't see a way of doing this on just one indicator sheet.

      Thanks again for any pointers.

      Comment


        #4
        Hello arbuthnot,

        Thank you for your response.

        This would be done through two plots in one indicator.
        For example:
        Code:
        if(conditions to plot line)
        {
        Plot0.Set(); // plot the line
        }
        else
        {
        Plot1.Set(); // plot the dot
        }

        Comment


          #5
          Thanks so much, Patrick. That works a treat.

          I think what must have happened is that I coded up something very close to that but must have made a small mistake somewhere and so assume the whole approach wasn't going to work.

          Much obliged.

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by jaybedreamin, Today, 05:56 PM
          0 responses
          3 views
          0 likes
          Last Post jaybedreamin  
          Started by DJ888, 04-16-2024, 06:09 PM
          6 responses
          18 views
          0 likes
          Last Post DJ888
          by DJ888
           
          Started by Jon17, Today, 04:33 PM
          0 responses
          1 view
          0 likes
          Last Post Jon17
          by Jon17
           
          Started by Javierw.ok, Today, 04:12 PM
          0 responses
          6 views
          0 likes
          Last Post Javierw.ok  
          Started by timmbbo, Today, 08:59 AM
          2 responses
          10 views
          0 likes
          Last Post bltdavid  
          Working...
          X