Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Extending plot beyond current candle and add text label CurrentDayOHL & PriorDayOHLC

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

    Extending plot beyond current candle and add text label CurrentDayOHL & PriorDayOHLC

    Hi,

    Is it possible to extend the plot a bit more than the current candle and add a text label right after?

    Click image for larger version

Name:	exampleextendandlabel.jpg
Views:	270
Size:	253.0 KB
ID:	1178580


    Thank you in advance.

    Andy
    Attached Files

    #2
    Hi Andy, thanks for posting.

    The "Displacement" property in the indicator's settings can be used to shift the plot forward. For a solution through code that will extend the current plot value without shifting the historical data, you would use OnRender to draw out the lines as the plotting system works on the bars that are rendered to the chart only. The OnRender method will let you extend the plot into the area where no bars exist by using the x/y points on the chart. For an example indicator that draws lines with OnRender, see the "PriceLine" indicator.

    Kind regards,
    -ChrisL

    Comment


      #3
      Ups, my bad, I oversaw the displacement field....Thank you Chris!, how about the test right after the plot?

      Comment


        #4
        Hi Andy, Im not sure about what test you are mentioning. Can you please clarify?

        Best regards,
        -ChrisL

        Comment


          #5
          My bad again, "Text" -> typo....subject: "add text label", description: "and add a text label right after?"

          Comment


            #6
            Hi Andy, I still don't understand the question. Can you share a screen shot of what you are asking about?

            Comment


              #7
              Hi, it was on the first screenshot, here is another one more detailed. Thank you.

              Click image for larger version

Name:	addtexttoplot.jpg
Views:	277
Size:	253.0 KB
ID:	1178613

              Comment


                #8
                Hi, thanks for sharing the screen shot.

                The Draw.Text method lets you draw text anywhere on the chart. The SampleCustomRender script in the indicators folder also shows how to render text on the chart using x/y coordinates rather than time/price values.

                Kind regards,
                -ChrisL

                Comment


                  #9
                  I just want to label the current and prior OHLC which are for example:
                  AddPlot(new Stroke(Brushes.Goldenrod, DashStyleHelper.Dash, 2), PlotStyle.Square, NinjaTrader.Custom.Resource.CurrentDayOHLOpen);

                  How do I add a text label as it's shown on the screenshot?

                  Thanks

                  Comment


                    #10
                    Hi andnand, thanks for your reply.

                    You need to use Draw.Text to add a label to the plot. Although not supported and prone to error, you can pass a negative bar value to draw into the future:
                    private CurrentDayOHL OHL;
                    ...
                    OnBarUpdate:
                    Draw.Text(this, "DayHigh", OHL.CurrentHigh[0].ToString(), -3, OHL.CurrentHigh[0]);

                    A more stable solution would be rendering the text in the OnRender method

                    Kind regards.

                    Comment


                      #11
                      Thank you anyways, I still dont know how to do it....

                      Comment


                        #12
                        Hi, I attached my test script. Place the file within Documents\NinjaTrader 8\bin\Custom\Indicators and compile to test it out.

                        Best regards.
                        Attached Files

                        Comment


                          #13
                          Thank you!!

                          Comment

                          Latest Posts

                          Collapse

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