Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Feature Request - Delta of a bar

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

    Feature Request - Delta of a bar

    Hi Support,

    I request you to add a feature,where in, buyvolume of a bar can be accessed like buyvolume[0],buyvolume[1],buyvolume[2],..etc

    and sellvolume of a bar can be accessed like sellvolume[0],sellvolume[1],sellvolume[2],..etc

    and delta ( (buyvolume - sellvolume) of a particular bar) of a bar can be accessed like,..delta[0],delta[1],delta[2]

    Thanks
    Commodity_trader

    #2
    Thanks for your suggestion. We do have plans for NT7 to introduce historical bid/ask data which likely can be manipulated to get what you need.
    RayNinjaTrader Customer Service

    Comment


      #3
      Thanks Ray.

      In NT 6.5 version is there any simple way to get delta of a bar by coding it? I saw a few threads on this,but they weren't calculating delta of a bar accurately. Below is the code, I came up with after looking/modifying at a few threads trying to achieve similar thing. I modified it slightly to get delta directly,but still appears there are missing things or the "OnMarketData" is not working properly.


      protected override void OnMarketData(MarketDataEventArgs e)
      {
      if (e.MarketDataType != MarketDataType.Last || e.MarketData.Ask == null || e.MarketData.Bid == null)
      return;

      if (e.MarketDataType == MarketDataType.Ask)
      delta += e.Volume;
      else if (e.MarketDataType == MarketDataType.Bid)
      delta -= e.Volume;
      }


      Do you see any obvious thing missing here?

      Thanks
      Commodity_trader

      Comment


        #4
        Are you looking for a running total of +- last traded volume relative to bid/ask price? If yes, what you are doing is for sure not going to accomplish that. What you are doing is add/subtracting current ask/bid size.

        If you want to do what I think you want to do -

        - Create bid/ask price variables outside of OnMarketData()
        - Monitor OnMarketData() to update these variables
        - Monitor OnMarketData() for the last price event and compare this price to the variables to determine whether to add/subtract from delta
        RayNinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by Geovanny Suaza, 02-11-2026, 06:32 PM
        0 responses
        580 views
        0 likes
        Last Post Geovanny Suaza  
        Started by Geovanny Suaza, 02-11-2026, 05:51 PM
        0 responses
        335 views
        1 like
        Last Post Geovanny Suaza  
        Started by Mindset, 02-09-2026, 11:44 AM
        0 responses
        102 views
        0 likes
        Last Post Mindset
        by Mindset
         
        Started by Geovanny Suaza, 02-02-2026, 12:30 PM
        0 responses
        554 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