Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

How to detect, if current Bars/Chart is "last/bid/ask" type?

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

    How to detect, if current Bars/Chart is "last/bid/ask" type?

    When we choose (from Dataseries format window) the chart to be based on either Last/Bid/Ask,
    then inside indicator, how we detect whichever one is chosen for current Bars? `Bars.BarsPeriod.BarsPeriodType` only returns the period-type, but not MarketDataType. So, how to retrieve that MDT property?

    #2
    Hello ttodua,
    You can do as below:
    Code:
    protected override void OnMarketData(MarketDataEventArgs mdt)
    {
    if(mdt.MarketDataType == MarketDataType.Last)
    {
    // your code
    }
    Hope it helps!

    Comment


      #3
      BarsPeriod.MarketDataType

      See here.

      Comment


        #4
        bltdavid thanks for you helpful answer again !
        strange, I had mislooked that.
        Last edited by ttodua; 07-04-2021, 12:56 PM.

        Comment


          #5
          Hello ttodua,

          Thanks for your post.

          As stated by s.kinra and bltdavid, you could use BarsPeriod.MarketDataType to get the primary Bars object time frame (period type and interval).

          See this help guide documentation for more information: https://ninjatrader.com/support/help...barsperiod.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

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by Mindset, 04-21-2026, 06:46 AM
          0 responses
          52 views
          0 likes
          Last Post Mindset
          by Mindset
           
          Started by M4ndoo, 04-20-2026, 05:21 PM
          0 responses
          71 views
          0 likes
          Last Post M4ndoo
          by M4ndoo
           
          Started by M4ndoo, 04-19-2026, 05:54 PM
          0 responses
          38 views
          0 likes
          Last Post M4ndoo
          by M4ndoo
           
          Started by cmoran13, 04-16-2026, 01:02 PM
          0 responses
          99 views
          0 likes
          Last Post cmoran13  
          Started by PaulMohn, 04-10-2026, 11:11 AM
          0 responses
          60 views
          0 likes
          Last Post PaulMohn  
          Working...
          X