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 Christopher_R, Today, 12:29 AM
          0 responses
          9 views
          0 likes
          Last Post Christopher_R  
          Started by sidlercom80, 10-28-2023, 08:49 AM
          166 responses
          2,235 views
          0 likes
          Last Post sidlercom80  
          Started by thread, Yesterday, 11:58 PM
          0 responses
          3 views
          0 likes
          Last Post thread
          by thread
           
          Started by jclose, Yesterday, 09:37 PM
          0 responses
          8 views
          0 likes
          Last Post jclose
          by jclose
           
          Started by WeyldFalcon, 08-07-2020, 06:13 AM
          10 responses
          1,415 views
          0 likes
          Last Post Traderontheroad  
          Working...
          X