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:	227
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 Mindset, 04-21-2026, 06:46 AM
        0 responses
        63 views
        0 likes
        Last Post Mindset
        by Mindset
         
        Started by M4ndoo, 04-20-2026, 05:21 PM
        0 responses
        92 views
        0 likes
        Last Post M4ndoo
        by M4ndoo
         
        Started by M4ndoo, 04-19-2026, 05:54 PM
        0 responses
        48 views
        0 likes
        Last Post M4ndoo
        by M4ndoo
         
        Started by cmoran13, 04-16-2026, 01:02 PM
        0 responses
        106 views
        0 likes
        Last Post cmoran13  
        Started by PaulMohn, 04-10-2026, 11:11 AM
        0 responses
        63 views
        0 likes
        Last Post PaulMohn  
        Working...
        X