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 habeebft, Today, 07:27 AM
            1 response
            14 views
            0 likes
            Last Post NinjaTrader_ChristopherS  
            Started by AveryFlynn, Today, 04:57 AM
            1 response
            12 views
            0 likes
            Last Post NinjaTrader_Erick  
            Started by Max238, Today, 01:28 AM
            4 responses
            38 views
            0 likes
            Last Post Max238
            by Max238
             
            Started by r68cervera, Today, 05:29 AM
            1 response
            10 views
            0 likes
            Last Post NinjaTrader_ChelseaB  
            Started by geddyisodin, Today, 05:20 AM
            1 response
            14 views
            0 likes
            Last Post NinjaTrader_Gaby  
            Working...
            X