Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Are Plots the only way to get prices highlighted in the Price Scale?

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

    Are Plots the only way to get prices highlighted in the Price Scale?

    Hi,

    Is it possible to get this to display in the Price Scale without using a Plot?

    Code:
    protected override void OnStateChange()
    {
    if (State == State.SetDefaults)​
    {
    
    AddLine(new Stroke(new SolidColorBrush((Color)ColorConverter.ConvertFromS tring("#90FFFF00")), DashStyleHelper.Dash, 1), 250, "250");
    AddLine(new Stroke(new SolidColorBrush((Color)ColorConverter.ConvertFromS tring("#FF464A55")), DashStyleHelper.Dash, 2), 100, "100");
    Thanks​

    #2
    Hello davydhnz,

    Thank you for your post.

    Price markers are only generated for plots and only when the PaintPriceMarkers property is set to true. AddLine() results in a line that is added to the chart without a price marker. You will have to use a plot if you'd like a price marker to be displayed in the price scale.

    Please let us know if we may be of further assistance.

    Comment


      #3
      NinjaTrader_Emily,

      thank you for your reply. It was helpful.

      Follow up question, is there a way to set plots so that they don't have to be constantly updated in OnBarUpdate?

      i.e. set them once.

      Something like:

      Code:
      protected override void OnBarUpdate()
      {
      if (FirstRun)
      {
      // Assign values to your plots
      Values[0][0] = 250; // Plot250
      Values[1][0] = 100; // Plot100
      
      FirstRun = false;
      }
      
      }
      except it's static.

      Much appreciated,
      David​

      Comment


        #4
        Hello David,

        Thank you for your reply.

        Since plot values are held in a Series<double> object, you would need to assign the value continuously and not just one time. You could call them once per bar using a script that calculates On Each Tick or On Price Change by checking if IsFirstTickOfBar is true:
        Code:
        protected override void OnBarUpdate()
        {​
        if (IsFirstTickOfBar)
        Values[0][0] = 250;
        Values[1][0] = 100;
        }
        This will assign the plot's value for the current bar only on the close of each bar rather than for every time that OnBarUpdate() is called.

        Please feel free to reach out with any additional questions or concerns.

        Comment


          #5
          Thanks NinjaTrader_Emily

          One last question, famous last words

          Is there a way to make plot lines transparents, but retain their set colours in the price markers in the price scale?

          Thanks.

          Comment


            #6
            Originally posted by davydhnz View Post
            Thanks NinjaTrader_Emily

            One last question, famous last words

            Is there a way to make plot lines transparents, but retain their set colours in the price markers in the price scale?

            Thanks.
            For that use case, the PlotStyle.PriceBox should be used. This will use the stroke color fo the price box in the price scale and will not plot any lines on the chart itself. The AddPlot() page contains a list of the available plotStyle options:


            Feel free to reach out with any additional questions or concerns.

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by Geovanny Suaza, 02-11-2026, 06:32 PM
            0 responses
            571 views
            0 likes
            Last Post Geovanny Suaza  
            Started by Geovanny Suaza, 02-11-2026, 05:51 PM
            0 responses
            331 views
            1 like
            Last Post Geovanny Suaza  
            Started by Mindset, 02-09-2026, 11:44 AM
            0 responses
            101 views
            0 likes
            Last Post Mindset
            by Mindset
             
            Started by Geovanny Suaza, 02-02-2026, 12:30 PM
            0 responses
            549 views
            1 like
            Last Post Geovanny Suaza  
            Started by RFrosty, 01-28-2026, 06:49 PM
            0 responses
            549 views
            1 like
            Last Post RFrosty
            by RFrosty
             
            Working...
            X