Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Databox Price

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

    Databox Price

    Hello,

    I have a question regarding the Price in the Databox: I cannot identify where the value comes from. I am trying to access it from a share service. I have access to the ChartPanel, ChartControl, Bars, but the only thing I could find is ChartBars.LastPrice but it is only one value, I was expecting an array. I need to be able to go back to a specific bar and get its price value.

    Does someone know how I can access the price value of a specific bar from code?

    Thank you.

    Kind regards,
    Victor
    Attached Files

    #2
    Hello Devside_Victor,

    Thank you for your post.

    You could use Bars.GetClose, Bars.GetOpen, etc to get the OHLC values for a given bar index. To do so, you would need to loop through the rendered bars on the chart and then call something like Bars.GetClose(barIndex) to get the Close price at the selected bar index.

    See the help guide documentation below for examples and more information.
    Bars.GetClose - https://ninjatrader.com/support/help...8/getclose.htm
    Bars.GetOpen - https://ninjatrader.com/support/help...t8/getopen.htm
    Bars.GetHigh - https://ninjatrader.com/support/help...t8/gethigh.htm
    Bars.GetLow - https://ninjatrader.com/support/help...nt8/getlow.htm

    Let us know if we may assist further.
    <span class="name">Brandon H.</span><span class="title">NinjaTrader Customer Service</span><iframe name="sig" id="sigFrame" src="/support/forum/core/clientscript/Signature/signature.php" frameborder="0" border="0" cellspacing="0" style="border-style: none;width: 100%; height: 120px;"></iframe>

    Comment


      #3
      Hello Brandon,

      Thank you very much for your quick response.

      I can get the OHLC values without problems. My question was regarding the entry "Price" in the Databox (marked in yellow in attachment in the original post). Is there a way to get this value (or calculate if needed)?

      Thank you again.

      Kind regards

      Comment


        #4
        Hello Devside_Victor,

        Thank you for that clarification.

        Accessing the Data Box programmatically would not be possible. The Price value in the Data Box refers to the price where your cursor is. To get this value, you would need to use mouse coordinates and ChartScale.

        Please see the attached example script that demonstrates how this would be accomplished. Note that ChartPanel.MouseMove is subscribed when the State == State.DataLoaded and unsubscribed when State == State.Terminated. OnRender() captures ChartScale into a private property. ChartingExtensions.ConvertToVerticalPixels converts the coordinate to device pixels. MyChartScale.GetValueByY converts to a price.

        The output would be viewed in a New > NinjaScript Output window.

        Also, see the help guide documentation below for more information.

        ChartPanel - https://ninjatrader.com/support/help...chartpanel.htm
        OnRender() - https://ninjatrader.com/support/help...8/onrender.htm
        ChartScale - https://ninjatrader.com/support/help...chartscale.htm
        GetValueByY - https://ninjatrader.com/support/help...etvaluebyy.htm
        ChartingExtensions - https://ninjatrader.com/support/help...extensions.htm
        Working with pixel coordinates - https://ninjatrader.com/support/help...oordinates.htm


        Let us know if we may assist further.
        Attached Files
        <span class="name">Brandon H.</span><span class="title">NinjaTrader Customer Service</span><iframe name="sig" id="sigFrame" src="/support/forum/core/clientscript/Signature/signature.php" frameborder="0" border="0" cellspacing="0" style="border-style: none;width: 100%; height: 120px;"></iframe>

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by Geovanny Suaza, 02-11-2026, 06:32 PM
        0 responses
        595 views
        0 likes
        Last Post Geovanny Suaza  
        Started by Geovanny Suaza, 02-11-2026, 05:51 PM
        0 responses
        343 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
        556 views
        1 like
        Last Post Geovanny Suaza  
        Started by RFrosty, 01-28-2026, 06:49 PM
        0 responses
        554 views
        1 like
        Last Post RFrosty
        by RFrosty
         
        Working...
        X