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 FrancisMorro, Today, 03:24 AM
          0 responses
          1 view
          0 likes
          Last Post FrancisMorro  
          Started by Segwin, 05-07-2018, 02:15 PM
          10 responses
          1,770 views
          0 likes
          Last Post Leafcutter  
          Started by Rapine Heihei, 04-23-2024, 07:51 PM
          2 responses
          31 views
          0 likes
          Last Post Max238
          by Max238
           
          Started by Shansen, 08-30-2019, 10:18 PM
          24 responses
          944 views
          0 likes
          Last Post spwizard  
          Started by Max238, Today, 01:28 AM
          0 responses
          11 views
          0 likes
          Last Post Max238
          by Max238
           
          Working...
          X