• If this is your first visit, you will have to register before you can post. To view messages, please scroll below and select the forum that you would like to visits. Questions? Be sure to check out the Forum FAQ.

Announcement

Collapse
No announcement yet.

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, 05:26 PM.

              Comment

              Latest Posts

              Collapse

              Topics Statistics Last Post
              Started by benjamind10, Today, 07:27 PM
              0 responses
              2 views
              0 likes
              Last Post benjamind10  
              Started by YevhenShynkarenko, Today, 06:07 PM
              0 responses
              4 views
              0 likes
              Last Post YevhenShynkarenko  
              Started by StevenNelson, Today, 04:07 PM
              3 responses
              10 views
              0 likes
              Last Post NinjaTrader_ShawnB  
              Started by Matthew Spositi, Today, 03:28 PM
              2 responses
              8 views
              0 likes
              Last Post Matthew Spositi  
              Started by faisamtrader, Today, 01:30 PM
              2 responses
              20 views
              0 likes
              Last Post NinjaTrader_ChrisL  
              Working...
              X