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 color on the fly

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

    Changing plot color on the fly

    Hello

    I was wondering about how I could change the color of a plot object on the fly.
    For example I would like to see the Bollinger Band middle line to be red when going down and green when going up.

    Actually the color is set in the Initialize method :

    Add(new Plot(Color.Orange, "Upper band"));
    Add(new Plot(Color.Orange, "Middle band"));
    Add(new Plot(Color.Orange, "Lower band"));

    How could I change that so that the color will be applied dynamically depending on the direction of the market.

    Many thanks for helping.

    #2
    Hello,

    You could do something like this

    Code:
    if(Rising(Values[0][0]))
    {
      PlotColors[0][0] = Color.Blue;
    }
    Rising: http://www.ninjatrader.com/support/h...tml?rising.htm
    PlotColors: http://www.ninjatrader.com/support/h...plotcolors.htm
    Values: http://www.ninjatrader.com/support/h...tml?values.htm

    Let me know if I can be of further assistance.
    LanceNinjaTrader Customer Service

    Comment


      #3
      Thank you very much Lance.
      This is exactly what I needed

      Comment


        #4
        I can't remember exactly, but I think there is also an example in the help file.

        on my phone, or else i'd check.

        Originally posted by blar58 View Post
        Thank you very much Lance.
        This is exactly what I needed

        Comment


          #5
          Hello,

          Yes the PlotColors link provided includes an example like this, thanks for reminding me
          LanceNinjaTrader Customer Service

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          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
          10 views
          0 likes
          Last Post burtoninlondon  
          Started by AaronKoRn, Yesterday, 09:49 PM
          0 responses
          15 views
          0 likes
          Last Post AaronKoRn  
          Started by carnitron, Yesterday, 08:42 PM
          0 responses
          11 views
          0 likes
          Last Post carnitron  
          Started by strategist007, Yesterday, 07:51 PM
          0 responses
          14 views
          0 likes
          Last Post strategist007  
          Working...
          X