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 colors of a plot

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

    Changing colors of a plot

    I am trying to make a plot with PlotStyle.Dot change the colors of the dot on a range bar chart. After looking at the sample code using SMA I am able to get the colors changed but I need to have OnBarUpdate = false. I am comparing Close[1] to Close[0]. Close[1] > Close[0] I want the plot to be red. Close[1] < Close[0] I want the plot to be green.

    I am having a problem when the Close[0] goes above and below Close[1] on the same bar but the final close is below Close[1]. I end up with both a green and a red dot but since the green dot is the first plot item I get a green dot when I want a red dot.

    Is there some way to erase the green dot so the red dot plots?

    #2
    Hello BobTN,

    Thank you for your post.

    You're getting updates to the colors while the bar is forming and you'd only like to view when the bar is closed?

    You can set CalculateOnBarClose to true to have it work like this.

    If it's something else could you post the snippet you're using and expected behavior?
    Ryan M.NinjaTrader Customer Service

    Comment


      #3
      I found the problem. I was following the sample code that used SMA and changed the color. With the dot plot I am using i didn't need the connecting code I only needed the set for the current value. The I was able to use the dataseries.Reset to clear plot I didn't need.

      if (Rising(SMA(Period)))
      {
      // Connects the rising plot segment with the other plots
      RisingPlot.Set(1, SMA(Period)[1]);
      This is what I removed

      // Adds the new rising plot line segment to the line
      RisingPlot.Set(SMA(Period)[0]);
      }
      Last edited by BobTN; 02-24-2010, 04:07 PM.

      Comment


        #4
        Thanks for the update, Bob!
        Ryan M.NinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by Mongo, Today, 11:05 AM
        1 response
        5 views
        0 likes
        Last Post NinjaTrader_ChelseaB  
        Started by Tim-c, Today, 10:58 AM
        1 response
        2 views
        0 likes
        Last Post NinjaTrader_Jesse  
        Started by traderqz, Yesterday, 09:06 AM
        4 responses
        25 views
        0 likes
        Last Post traderqz  
        Started by traderqz, Today, 12:06 AM
        4 responses
        7 views
        0 likes
        Last Post traderqz  
        Started by f.saeidi, Today, 10:19 AM
        1 response
        6 views
        0 likes
        Last Post NinjaTrader_BrandonH  
        Working...
        X