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 Hwop38, 05-04-2026, 07:02 PM
        0 responses
        169 views
        0 likes
        Last Post Hwop38
        by Hwop38
         
        Started by CaptainJack, 04-24-2026, 11:07 PM
        0 responses
        326 views
        0 likes
        Last Post CaptainJack  
        Started by Mindset, 04-21-2026, 06:46 AM
        0 responses
        252 views
        0 likes
        Last Post Mindset
        by Mindset
         
        Started by M4ndoo, 04-20-2026, 05:21 PM
        0 responses
        353 views
        0 likes
        Last Post M4ndoo
        by M4ndoo
         
        Started by M4ndoo, 04-19-2026, 05:54 PM
        0 responses
        180 views
        0 likes
        Last Post M4ndoo
        by M4ndoo
         
        Working...
        X