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

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

    changing color of a plot

    I have code that does the following:

    Add(new Plot(new Pen(Color.FromKnownColor(KnownColor.MediumSlateBlu e), 3), "FirstPlot"));
    Add(new Plot(new Pen(Color.FromKnownColor(KnownColor.HotPink), 3), "SecondPlot"));

    This appears to work fine, the lines being drawn are the correct color.

    Later in my code I add:

    Plots[0].Pen.Color = Color.Gray;
    Plots[1].Pen.Color = Color.Gray;

    However, the colors don't change. Is what I'm doing incorrect?

    Thanks in advance

    #2
    Changing plot colors directly is supported in NT7. For 6.5, please see this reference sample: http://www.ninjatrader-support2.com/...ead.php?t=3227
    Josh P.NinjaTrader Customer Service

    Comment


      #3
      When to use Plot() vs OnBarUpdate()

      I can't find any documentation on the Plot() method, yet I see it is used by some indicators that I have. When should I use this vs. OnBarUpdate()? When does Plot() get fired in the chain of events that NT handles?

      Comment


        #4
        I'm not sure I follow, Plots is just a plot object collection defining how the visualization is done - http://www.ninjatrader-support.com/H...eV6/Plots.html

        BertrandNinjaTrader Customer Service

        Comment


          #5
          No, the Plot() method, like this

          PHP Code:
          public override void Plot(Graphics graphicsRectangle boundsdouble mindouble max
          Some indicators I run across implement this method, overriding the Plot() method in the Indicator class. My question is how/when would I override this method as opposed to performing drawing logic on OnBarUpdate()? When does this method get called by NT? Every tick? Every bar close?

          Comment


            #6
            shodson,

            The Plot() method is not supported. It is called any time the chart would paint (i.e. indicator value updates the plot). People use it to draw things themselves or plot in different methods than what is provided by default.
            Josh P.NinjaTrader Customer Service

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by pibrew, Today, 06:37 AM
            0 responses
            1 view
            0 likes
            Last Post pibrew
            by pibrew
             
            Started by rbeckmann05, Yesterday, 06:48 PM
            1 response
            14 views
            0 likes
            Last Post bltdavid  
            Started by llanqui, Today, 03:53 AM
            0 responses
            6 views
            0 likes
            Last Post llanqui
            by llanqui
             
            Started by burtoninlondon, Today, 12:38 AM
            0 responses
            11 views
            0 likes
            Last Post burtoninlondon  
            Started by AaronKoRn, Yesterday, 09:49 PM
            0 responses
            16 views
            0 likes
            Last Post AaronKoRn  
            Working...
            X