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 rjbtrade1, 11-30-2023, 04:38 PM
            2 responses
            77 views
            0 likes
            Last Post DavidHP
            by DavidHP
             
            Started by Stanfillirenfro, Today, 07:23 AM
            3 responses
            13 views
            0 likes
            Last Post NinjaTrader_ChelseaB  
            Started by FitSpressoHonest, Today, 09:14 AM
            0 responses
            4 views
            0 likes
            Last Post FitSpressoHonest  
            Started by Davide999, 05-18-2023, 03:55 AM
            4 responses
            557 views
            1 like
            Last Post kcwasher  
            Started by rexsole, Today, 08:39 AM
            2 responses
            9 views
            0 likes
            Last Post NinjaTrader_Erick  
            Working...
            X