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

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 nandhumca, Yesterday, 03:41 PM
        1 response
        12 views
        0 likes
        Last Post NinjaTrader_Gaby  
        Started by The_Sec, Yesterday, 03:37 PM
        1 response
        11 views
        0 likes
        Last Post NinjaTrader_Gaby  
        Started by vecnopus, Today, 06:15 AM
        0 responses
        1 view
        0 likes
        Last Post vecnopus  
        Started by Aviram Y, Today, 05:29 AM
        0 responses
        5 views
        0 likes
        Last Post Aviram Y  
        Started by quantismo, 04-17-2024, 05:13 PM
        3 responses
        27 views
        0 likes
        Last Post NinjaTrader_Gaby  
        Working...
        X