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

Visualization order for multi line oscillators

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

    Visualization order for multi line oscillators

    Hi,

    I'm trying to plot an EMA on top of a Bar indicator, but I am getting the line plot "covered" by the Bars that are drawn on top of it.

    How can I set the drawing sequence to determine with series is on top and which in the bottom?

    Thanks a lot for any help!

    #2
    Hello,

    Thank you for the question.

    Are these items both being plotted from the same indicator or are they separate indicators? Generally the order of the plots in the script determines the end result. Between multiple indicators you can run into one being plotted over the other and have to manually adjust the zorder.

    I look forward to being of further assistance.
    JesseNinjaTrader Customer Service

    Comment


      #3
      HI Jesee,

      This is only one indicator, with 2 plots plotted on the same panel, one being the moving average of the other.

      As the "source" plot is a bar plot and the EMA is a line, I would like the EMA to plot on top. If not, when the bars get too close, I cannot see the line anymore.


      Add(new Plot(Color.FromKnownColor(KnownColor.Green), PlotStyle.Bar, "AroonC"));
      Overlay = false;
      Plots[0].Pen.Width = 3;

      Add(new Plot(Color.FromKnownColor(KnownColor.Purple), PlotStyle.Line, "Avg"));
      Overlay = false;
      Plots[1].Pen.Width = 2;

      Comment


        #4
        Hello,

        Thank you for the reply.

        In this case I believe you could just reverse the order you are creating the plots, please try the following to see if the result is what is expected:

        Code:
        protected override void Initialize()
        {
        	Add(new Plot(Color.FromKnownColor(KnownColor.Purple), PlotStyle.Line, "Avg"));
        	Overlay	= false;
        	Plots[0].Pen.Width = 6;
        	
           	Add(new Plot(Color.FromKnownColor(KnownColor.Green), PlotStyle.Bar, "AroonC"));
        	Overlay	= false;
        	Plots[1].Pen.Width = 8;
        }
        
        protected override void OnBarUpdate()
        {
        	Values[0].Set(50);
        	Values[1].Set(100);
        }
        I set default values and increased the pen widths to be able to see that it is on top. In my tests the Purple line is always visible over the Green bars.

        I look forward to being of further assistance.
        JesseNinjaTrader Customer Service

        Comment


          #5
          Thanks Jesee


          I had tried that, but it did noty work at first because I had the order for Plot 0 and Plot 1 inverted. Did not realize it would actually make a difference.

          It is working properly now!

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by MacDad, 02-25-2024, 11:48 PM
          7 responses
          158 views
          0 likes
          Last Post loganjarosz123  
          Started by Belfortbucks, Today, 09:29 PM
          0 responses
          7 views
          0 likes
          Last Post Belfortbucks  
          Started by zstheorist, Today, 07:52 PM
          0 responses
          7 views
          0 likes
          Last Post zstheorist  
          Started by pmachiraju, 11-01-2023, 04:46 AM
          8 responses
          151 views
          0 likes
          Last Post rehmans
          by rehmans
           
          Started by mattbsea, Today, 05:44 PM
          0 responses
          6 views
          0 likes
          Last Post mattbsea  
          Working...
          X