Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Cumulative Delta vs Buy Sell Volume

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

    Cumulative Delta vs Buy Sell Volume

    I'm comparing the NT supplied indicators:

    1. Order Flow Cumulative Delta (Bid Ask) set to display Period Bar rather than Session so that I can see the net volume (hitting at or above the ask minus that which is hitting at or below the bid ).
    2. Buy sell volume

    The Buy sell volume indicator is plotting to things:
    1. the total volume transacting at or above the ask. plotted as "Buys"
    2. the total volume transacting at or below the bid. plotted as "Sells"

    I'm expecting that subtracting sells from buys would produce the same delta value that's being plotted by the Order Flow Cumulative delta as I have it configured. But that's not what I'm seeing. The values are different.
    For example see this screenshot:
    Click image for larger version  Name:	CummulativeDelta vs Buy Sell Volume.png Views:	0 Size:	111.8 KB ID:	1261421

    Here we see Order Flow's Delta Close plotting 14.
    Buy sell volume is plotting buys 248, sells 117. The math: 248 - 117 = 131

    EDIT: I was expecting the result to be 14 to match Delta Close plotting. Also I just noticed that the Volume for the bar is also 248. I would expect the sum of the Buys and Sells to equal 248.

    The code for Buy sell volume is:

    Code:
    protected override void OnMarketData(MarketDataEventArgs e)
    {
    if(e.MarketDataType == MarketDataType.Last)
    {
    if(e.Price >= e.Ask)
    buys += (Instrument.MasterInstrument.InstrumentType == Cbi.InstrumentType.CryptoCurrency ? Core.Globals.ToCryptocurrencyVolume(e.Volume) : e.Volume);
    else if (e.Price <= e.Bid)
    sells += (Instrument.MasterInstrument.InstrumentType == Cbi.InstrumentType.CryptoCurrency ? Core.Globals.ToCryptocurrencyVolume(e.Volume) : e.Volume);
    }
    }
    ​
    How can this code be changed to produce the same values plotted by Delta Close?
    Last edited by Brillo; 07-21-2023, 03:27 PM. Reason: See my EDIT in bold for additional comments.

    #2
    Hello Brillo,

    May I confirm you have the Cumulative Delta - Period set to Bar, and the Delta type set to BidAsk?

    The Cumulative Delta does process differently than the BuySellVolume. The BuySellVolume is driven by market updates in OnMarketData, while the Cumulative Delta is driven by ticks updating OnBarUpdate. Market updates can different from Ask/Bid stamped Ticks. There also can be slight differences when ticks are received with the same timestamp.

    This example provided by Jim has some general details on how this indicator builds.
    Hi, i'm trying to build my first strategy. I want to use the values of the BuySellVolume indicator, but it seems like the DataSeries from the indicator are empty. No trade entry happens with this strategy.... The code looks like this: namespace NinjaTrader.NinjaScript.Strategies { public class DeltaRatioKursDivergenz :
    Chelsea B.NinjaTrader Customer Service

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by Geovanny Suaza, 02-11-2026, 06:32 PM
    0 responses
    571 views
    0 likes
    Last Post Geovanny Suaza  
    Started by Geovanny Suaza, 02-11-2026, 05:51 PM
    0 responses
    330 views
    1 like
    Last Post Geovanny Suaza  
    Started by Mindset, 02-09-2026, 11:44 AM
    0 responses
    101 views
    0 likes
    Last Post Mindset
    by Mindset
     
    Started by Geovanny Suaza, 02-02-2026, 12:30 PM
    0 responses
    548 views
    1 like
    Last Post Geovanny Suaza  
    Started by RFrosty, 01-28-2026, 06:49 PM
    0 responses
    549 views
    1 like
    Last Post RFrosty
    by RFrosty
     
    Working...
    X