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 cmoran13, 04-16-2026, 01:02 PM
        0 responses
        46 views
        0 likes
        Last Post cmoran13  
        Started by PaulMohn, 04-10-2026, 11:11 AM
        0 responses
        28 views
        0 likes
        Last Post PaulMohn  
        Started by CarlTrading, 03-31-2026, 09:41 PM
        1 response
        163 views
        1 like
        Last Post NinjaTrader_ChelseaB  
        Started by CarlTrading, 04-01-2026, 02:41 AM
        0 responses
        98 views
        1 like
        Last Post CarlTrading  
        Started by CaptainJack, 03-31-2026, 11:44 PM
        0 responses
        158 views
        2 likes
        Last Post CaptainJack  
        Working...
        X