Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

How can i change dynamically osilator level line color?

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

    How can i change dynamically osilator level line color?

    Hello,

    I have an indicator. This indicator has 1 plot and 1 level line(Zero). When my plot crossabove zero line i want to change zero line color blue, crossbelow zero line i want to change zero line color red. How can i do this simply?

    Thanks.

    #2
    Hello aytacasan,

    There is a different approach depending on version.

    Version 6.5 - See multi color plot approach for version 6.5 here.

    Version 7 - See multi color plot approach for version 7 here.
    Ryan M.NinjaTrader Customer Service

    Comment


      #3
      Sory you are right, i have to indicate which version i'm using. I developing my indicators at Ninja 7. So i can use multi color plot approch, i know it too. But this example i don't have a plot i have a line. (Like Indicator wizard last step). If you mean never mind add a line vice add plot for zero line level and adjust its color via PlotColors. Yes I think it. But i want to learn what is your approach for this type requirement. I want to find what is the exact way?

      Thanks.

      Comment


        #4
        Changing your line to a plot is probably the easiest way to go here.

        Horizontal lines added via Initialize Add( new line can't be changed dynamically.

        Set a plot with a single double value and then assign colors with PlotColors[][] index.

        ZeroLine.Set(0);

        if (CrossAbove(Plot0, ZeroLine, 1))
        PlotColors[1][0] = Color.Red;
        Ryan M.NinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by Geovanny Suaza, 02-11-2026, 06:32 PM
        0 responses
        574 views
        0 likes
        Last Post Geovanny Suaza  
        Started by Geovanny Suaza, 02-11-2026, 05:51 PM
        0 responses
        332 views
        1 like
        Last Post Geovanny Suaza  
        Started by Mindset, 02-09-2026, 11:44 AM
        0 responses
        101 views
        0 likes
        Last Post Mindset
        by Mindset
         
        Started by Geovanny Suaza, 02-02-2026, 12:30 PM
        0 responses
        553 views
        1 like
        Last Post Geovanny Suaza  
        Started by RFrosty, 01-28-2026, 06:49 PM
        0 responses
        551 views
        1 like
        Last Post RFrosty
        by RFrosty
         
        Working...
        X