Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Show Data Box indicator value on chart

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

    Show Data Box indicator value on chart

    I have an indicator value that I would like to show as text on a chart. But I don't want it to be for the current bar, I want it to be for the bar that the cursor is highlighting like in the data box. I have seen this on other indicators but can't find the method needed to do it. Any help is appreciated

    #2
    Hello cre8able,

    Thank you for your inquiry.

    There is an example of getting a series value by the mouse position via a mouse hover event here:
    https://forum.ninjatrader.com/forum/...77#post1157077

    Using the ideas from that example should help you to render the desired text on the chart. For more details on using SharpDX for custom chart rendering as well as some other relevant resources, please see the help guide links below:Please let us know if we may be of further assistance.

    Comment


      #3
      I almost got it. I'm printing 3 different lines but want them all on the right side of the chart. They are staggered left as they go up.

      Here is the code where I think this happens, but I'm not sure what to change.


      // find the lowerTextPoint for where we want to actually put our text
      SharpDX.Vector2 lowerTextPoint = new SharpDX.Vector2(ChartPanel.W - textLayout2.Metrics.Width - 5,
      ChartPanel.Y + (ChartPanel.H - textLayout2.Metrics.Height));

      // do the drawing of the text to the chart
      RenderTarget.DrawTextLayout(lowerTextPoint - 50, textLayout2,
      aSeries.GetValueAt(barHover) ? upColorDx : downColorDx,
      SharpDX.Direct2D1.DrawTextOptions.NoSnap);
      RenderTarget.DrawTextLayout(lowerTextPoint - 25, textLayout2,
      bSeries.GetValueAt(barHover) ? upColorDx : downColorDx,
      SharpDX.Direct2D1.DrawTextOptions.NoSnap);
      RenderTarget.DrawTextLayout(lowerTextPoint, textLayout2,
      cSeries.GetValueAt(barHover) ? upColorDx : downColorDx,
      SharpDX.Direct2D1.DrawTextOptions.NoSnap);


      help please


      Click image for larger version

Name:	image.png
Views:	211
Size:	41.5 KB
ID:	1257898
      Attached Files

      Comment


        #4
        Hello cre8able,

        With the x and y value obtained from the mouse pointer (demonstrated in the ExampleGetSeriesValueByMousePosition) supply these to the SharpDX.Vector2() so that the text is drawn at those coordinates.

        I'm noticing that this example doesn't get the y value, and I have another example that does provide the y value you may find helpful.
        Chelsea B.NinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

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