Announcement

Collapse

Looking for a User App or Add-On built by the NinjaTrader community?

Visit NinjaTrader EcoSystem and our free User App Share!

Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less

Partner 728x90

Collapse

Accessing MarketDepth events in a ChartStyle?

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

    Accessing MarketDepth events in a ChartStyle?

    Hi,

    I am suspecting I went down the wrong path here - I want to create a view that looks like the one attached - a heatmap of the order book over time. I started off as a ChartStyle, which feels like a reasonable choice, but I cannot get access to market data as far as I can tell?

    If I go back to creating this as an indicator I have a few questions:

    1. Can I programmatically turn off the drawing off the ChartStyle - if I go back to a vanilla candlestick chart, and then add a heatmap indicator, can I turn off the candles?

    2. If I can turn off the candles, will there by any performance impact of doing this? Will the candles still compute but not print? Ideally I would want no wasted cycles computing the candles - have a feeling the framework doesnt support this?

    3. Is there any performance impact drawing the full view (as soon) as an indicator?

    Many thanks,

    Nick.

    #2
    Hello ptpatrader,

    Yes for this you will want to use an indicator if you need to access the market data.

    The chartstyle or bar rendering can be turned on or off by making its visibility false. That could be controlled using the chart styles properties.
    https://ninjatrader.com/support/help...sub=chartstyle
    https://ninjatrader.com/support/help...hart_style.htm

    Code:
     ChartBars.Properties.ChartStyle.IsVisible = false;
    There wouldn't be a performance impact on making in invisible but the scale will change. You can control the scale with OnCalculateMinMax: https://ninjatrader.com/support/help...ightsub=minmax

    For the last question I am not certain I understand how that was worded. Can you rephrase the third question please?



    I look forward to being of further assistance.
    Last edited by NinjaTrader_Jesse; 07-01-2020, 09:27 AM.
    JesseNinjaTrader Customer Service

    Comment


      #3
      Thanks Jesse, and apologies for the last question - should have proof-read.

      I think my question was about needing to potentially draw blocks across the whole screen (a block per Tick x Time bucket) - is there any performance impact doing an indicator over it being a chartstyle - as a general question about performance? Both would be rendering in the OnRender so I cant imagine a difference but wanted to ask.

      I do have another related question. Is there a fast way of computing the nearest tick from the top? Right now I start at a Y position of 0 and then call chartControl.Get ValueByY to work out the price value. However those returned values are not aligned to the tick. I would like to draw from the top (rows x columns), tick-aligned, but I am unsure how to compute it with the API?

      Thanks Jesse!

      Nick

      Comment


        #4
        Figured it out, thanks.

        Nick.

        Comment


          #5
          Hello Nick,

          It looks like you got it before I could reply back. You are correct, there should be no real performance difference as OnRender is still being used, the main performance impact would be your own code and how efficient that is.

          Here are a few links to some related resources in case you have not seen these items. You can also use the SampleCustomRender indicator or any of the drawing objects/chart styles for reference for OnRender topics.

          https://ninjatraderecosystem.com/user-app-share-download/sharpdxhelper-wrapper/




          I look forward to being of further assistance.
          JesseNinjaTrader Customer Service

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by Tin34, Today, 03:30 AM
          2 responses
          13 views
          0 likes
          Last Post Tin34
          by Tin34
           
          Started by sastrades, Yesterday, 09:59 AM
          2 responses
          27 views
          0 likes
          Last Post brucerobinson  
          Started by ETFVoyageur, Today, 12:52 AM
          1 response
          12 views
          0 likes
          Last Post Leeroy_Jenkins  
          Started by lollers, Today, 03:26 AM
          0 responses
          10 views
          0 likes
          Last Post lollers
          by lollers
           
          Started by aliyahany, Today, 03:16 AM
          0 responses
          2 views
          0 likes
          Last Post aliyahany  
          Working...
          X