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

why is BuyVolume buys+sells

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

    why is BuyVolume buys+sells

    In the official BuySellVolume, the Buy volume is buys+sells, but why ? Normally buys+sells is the entire volume and BuyVolume should be buys only right ?

    Code:
    protected override void OnBarUpdate()
    {
    if (CurrentBar < activeBar || CurrentBar <= BarsRequiredToPlot)
    return;
    
    // New Bar has been formed
    // - Assign last volume counted to the prior bar
    // - Reset volume count for new bar
    if (CurrentBar != activeBar)
    {
    Sells[1] = sells;
    Buys[1] = buys + sells;
    buys = 0;
    sells = 0;
    activeBar = CurrentBar;
    }
    
    Sells[0] = sells;
    Buys[0] = buys + sells;
    }​

    #2
    Hello alanlopen,

    Because that indicator uses two plots that overlay as bars the buys would not be visible if only the buy data was included in that plot. This indicator is for visual only purposes. You can use similar logic to that in your own script if you wanted to accumulate data from OnMarketData and did not need to visualize it, you would in that case use just the buy volume for buys.
    JesseNinjaTrader Customer Service

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by RaddiFX, Today, 10:15 AM
    2 responses
    14 views
    0 likes
    Last Post RaddiFX
    by RaddiFX
     
    Started by patrickmlee007, Today, 09:33 AM
    2 responses
    17 views
    0 likes
    Last Post patrickmlee007  
    Started by magnatauren, 08-15-2020, 02:12 PM
    5 responses
    206 views
    0 likes
    Last Post RaddiFX
    by RaddiFX
     
    Started by rene69851, 05-02-2024, 03:25 PM
    1 response
    22 views
    0 likes
    Last Post rene69851  
    Started by ETFVoyageur, Yesterday, 07:05 PM
    5 responses
    45 views
    0 likes
    Last Post ETFVoyageur  
    Working...
    X