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 AaronKoRn, Today, 09:49 PM
          0 responses
          5 views
          0 likes
          Last Post AaronKoRn  
          Started by carnitron, Today, 08:42 PM
          0 responses
          8 views
          0 likes
          Last Post carnitron  
          Started by strategist007, Today, 07:51 PM
          0 responses
          9 views
          0 likes
          Last Post strategist007  
          Started by StockTrader88, 03-06-2021, 08:58 AM
          44 responses
          3,975 views
          3 likes
          Last Post jhudas88  
          Started by rbeckmann05, Today, 06:48 PM
          0 responses
          9 views
          0 likes
          Last Post rbeckmann05  
          Working...
          X