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

PaintPriceMarkers Questions

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

    PaintPriceMarkers Questions

    Is there a way to selectively enable or disable individual price markers ("PaintValueMarkers" would be better terminology) in multiple-plot indicator code?

    If not, is there a way to set the painting sequence so one that is most important will paint over others.

    #2
    Hello caveat_lector,

    Thanks for your note.

    There currently isn't a property that would allow users to disable individual price markers. The property PaintPriceMarkers applies to all price markers from the indicator.

    To set the painting sequence or ZOrder, you can use SetZOrder(). SetZOrder() is used to assign a unique identifier representing the index in which chart objects are drawn on the chart's Z-axis (front to back ordering). Objects with a higher ZOrder are drawn first.

    Here is the SetZOrder() Help Guide to assist you further.
    Shawn B.NinjaTrader Customer Service

    Comment


      #3
      Good solution. Thanks for the quick help.

      Comment


        #4
        Well, I thought that was a good solution, but I haven't been able to make it work. One of my indicator plots is named "Bandpass". Can you provide example code that will set SetZOrder(int.MaxValue) for that plot to make its ending value print on top?

        Comment


          #5
          Hello caveat_lector,

          Thanks for your reply.

          My apologies, after further testing, I can confirm that SetZOrder() does not provide the option to change the ZOrder of individual price markers or plots. However, this could be controlled by the order the plots are added. For example, adding the plot or price marker last in the list of plots that you want on top. In the example below, the MAL2 plot would display on top of the other two plots by default as it is listed last.

          Code:
           if (State == State.SetDefaults)
                      {            
                          AddPlot(Brushes.SeaShell, "MAL1");             
                          AddPlot(Brushes.Red, "MAL3");
                          AddPlot(Brushes.Goldenrod, "MAL2")
                      }
          Shawn B.NinjaTrader Customer Service

          Comment


            #6
            I tried that without success before starting this thread, but my code is a bit complicated and I may not have made the change that I thought I had made. I will try that again.

            Comment


              #7
              I tried that again and it didn't fix the painting sequence in my code, although it might in cases where brush colors are not being changed dynamically within OnBarUpdate(). The following changes fixed the problem:

              1) I re-ordered the AddPlot sequence like you suggested;

              2) Changed Values[n] numbering in "#region Properties" for each plot to match; and

              3) Moved the following code after similar code that dynamically changes the colors of other plots during run-time:

              Code:
                          if (PlotBandpass)
                          {
                              if (IsRising(BPF))
                                  PlotBrushes[2][0] = Brushes.Green;
                              else if (IsFalling(BPF))
                                  PlotBrushes[2][0] = Brushes.Red;
                              else
                                  PlotBrushes[2][0] = Brushes.Yellow;
                          } else {
                              PlotBrushes[2][0] = Brushes.Transparent;
                          }
              Last edited by caveat_lector; 11-14-2019, 06:26 PM.

              Comment

              Latest Posts

              Collapse

              Topics Statistics Last Post
              Started by fiddich, Today, 05:25 PM
              0 responses
              3 views
              0 likes
              Last Post fiddich
              by fiddich
               
              Started by gemify, 11-11-2022, 11:52 AM
              6 responses
              803 views
              2 likes
              Last Post ultls
              by ultls
               
              Started by ScottWalsh, Today, 04:52 PM
              0 responses
              4 views
              0 likes
              Last Post ScottWalsh  
              Started by ScottWalsh, Today, 04:29 PM
              0 responses
              7 views
              0 likes
              Last Post ScottWalsh  
              Started by rtwave, 04-12-2024, 09:30 AM
              2 responses
              22 views
              0 likes
              Last Post rtwave
              by rtwave
               
              Working...
              X