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

How to avoid decrementing a dataseries

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

    How to avoid decrementing a dataseries

    The blockcountrate variable below is being plotted in the OnBarUpdate() section.

    What I really want to indicate is the highest value of the blockcountrate for a one minute bar.

    How do I avoid the blockcountrate decrementing? What happens is in the beginning of a bar is when I typically see large blocks traded. Then as the ticks keep coming in, the blockcountrate goes down because the trades for these ticks are less then the large block setting I'm using. I have tried creating a dataseries of the blockcountrate then using MAX and HighestBar but no luck, won't compile.

    if (e.MarketDataType == MarketDataType.Last && e.Volume >= 6)
    {
    blockcount++ ;
    blockcountrate = blockcount / Bars.TickCount;
    }

    Thanks for any help. I've spent a couple hours trying to avoid the decrementing, so now I'm reaching out !
    Last edited by gdavis74; 09-01-2013, 09:37 PM. Reason: fix code example

    #2
    Originally posted by gdavis74 View Post
    The blockcountrate variable below is being plotted in the OnBarUpdate() section.

    What I really want to indicate is the highest value of the blockcountrate for a one minute bar.

    How do I avoid the blockcountrate decrementing? What happens is in the beginning of a bar is when I typically see large blocks traded. Then as the ticks keep coming in, the blockcountrate goes down because the trades for these ticks are less then the large block setting I'm using. I have tried creating a dataseries of the blockcountrate then using MAX and HighestBar but no luck, won't compile.

    if (e.MarketDataType == MarketDataType.Last && e.Volume >= 6)
    {
    blockcount++ ;
    blockcountrate = blockcount / Bars.TickCount;
    }

    Thanks for any help. I've spent a couple hours trying to avoid the decrementing, so now I'm reaching out !
    Code:
    blockcountrate = Math.Max(blockcountrate, blockcount / Bars.TickCount);

    Comment


      #3
      gdavis74, can you try the suggestion kindly shared by koganam?
      BertrandNinjaTrader Customer Service

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by popecapllc, 08-09-2023, 07:42 PM
      8 responses
      1,339 views
      0 likes
      Last Post Johng22
      by Johng22
       
      Started by ETFVoyageur, 04-30-2024, 02:04 PM
      11 responses
      100 views
      0 likes
      Last Post ETFVoyageur  
      Started by bubblegum, 03-18-2024, 10:41 AM
      3 responses
      44 views
      0 likes
      Last Post vjsworld  
      Started by JamesK1, Today, 02:48 PM
      1 response
      12 views
      0 likes
      Last Post JamesK1
      by JamesK1
       
      Started by llanqui, Today, 03:51 PM
      0 responses
      10 views
      0 likes
      Last Post llanqui
      by llanqui
       
      Working...
      X