Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Changing Price Marker Y-Value

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

    Changing Price Marker Y-Value

    I have an indicator which i must run on COBC = false, however, I would like the Price Marker to be plotted at the value of the last completed bar, not the current bar in progress. Is there any way to add code to the FormatPriceMarker() method that would allow me to set the y-value of the Price Marker directly?

    Thanks!

    #2
    You should be able to format it this way by reference the Plot value one bar ago, rather than the current bar.

    Code:
     Plot0.Set(Close[1]);
    You may also be able to use FirstTickOfBar to filter the logic being used when updating the value you're plotting as per the following reference sample:

    MatthewNinjaTrader Product Management

    Comment


      #3
      Originally posted by Srgtroy View Post
      I have an indicator which i must run on COBC = false, however, I would like the Price Marker to be plotted at the value of the last completed bar, not the current bar in progress. Is there any way to add code to the FormatPriceMarker() method that would allow me to set the y-value of the Price Marker directly?

      Thanks!
      You could add the indicator twice, once in COBC = true and once in COBC = false. Then disable the price markers for the instance that runs in COBC = false.

      Comment


        #4
        Thanks for the idea, but it is a bit of complex indicator and returns different results based on whether it is run on COBC = false or COBC = true, so in this case, that wouldn't work.

        Comment


          #5
          Originally posted by NinjaTrader_Matthew View Post
          You should be able to format it this way by reference the Plot value one bar ago, rather than the current bar.

          Code:
           Plot0.Set(Close[1]);
          That would result in the price marker reflecting the value of the last completed bar; however, it would also offset the whole plot by one bar, which i don't want.

          I did try the following:

          Code:
          public override string FormatPriceMarker(double price)
          		{
          		
          		return Plot0[1].ToString("N2");
          					
          		}
          Now, the value of the price marker reflects the value of the plot at the last completed bar; however, the actual price marker itself still shifts up and down along the y-scale at each tick and is painted at the current value of the plot, not the last completed bar value, so this only works halfway. I'm still looking for a complete solution if anyone has one.

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by argusthome, 03-08-2026, 10:06 AM
          0 responses
          103 views
          0 likes
          Last Post argusthome  
          Started by NabilKhattabi, 03-06-2026, 11:18 AM
          0 responses
          52 views
          0 likes
          Last Post NabilKhattabi  
          Started by Deep42, 03-06-2026, 12:28 AM
          0 responses
          34 views
          0 likes
          Last Post Deep42
          by Deep42
           
          Started by TheRealMorford, 03-05-2026, 06:15 PM
          0 responses
          37 views
          0 likes
          Last Post TheRealMorford  
          Started by Mindset, 02-28-2026, 06:16 AM
          0 responses
          74 views
          0 likes
          Last Post Mindset
          by Mindset
           
          Working...
          X