Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

How do I get volume?

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

    How do I get volume?

    I even used ChatGPT and it kept giving me big syntax problems with trying to write a volume indicator.



    int buyVolume = barsType.Volumes[CurrentBar].TotalBuyingVolume;
    int sellVolume = barsType.Volumes[CurrentBar].TotalSellingVolume;​


    I try to compile this, but it tells me "the name barsType doesn't exist in the current context.'

    Please tell me what does. I literally just want to populate my variable with the total buy volume or total sell volume for the current bar.


    #2
    Hello Darth_Trader,

    Thank you for your post.

    The BuySell Volume indicator could be used to get the buy and sell volume for a bar that is referenced with a barsAgo index (not CurrentBar). Here is the help guide page with the syntax information:


    Returns buy volume
    BuySellVolume().Buys[int barsAgo]
    BuySellVolume(ISeries<double> input).Buys[int barsAgo]

    Returns sell volume
    BuySellVolume().Sells[int barsAgo]
    BuySellVolume(ISeries<double> input).Sells[int barsAgo]
    Otherwise, you could use the OnMarketData() method to get buy and sell volume information. The source code for the BuySell Volume indicator may be viewed inside of the NinjaScript Editor for an idea of how the indicator gets that calculation. For more information about OnMarketData() please see the following page:


    Please let us know if we may be of further assistance.

    Comment

    Latest Posts

    Collapse

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