Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Order Flow Methods?

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

    Order Flow Methods?

    Hello!

    I'm searching around for a complete list of methods to access Order Flow.

    I see some things here and there but I'm not seeing any methods to access imbalance. Specifically, I'd like to count the number of imbalances per bar as a condition. See attachment.

    Can you point me to the docs?

    Thanks!

    P.S. Also, the docs are in frames so I can't figure out how you guys send links. Whenever I try and drop a link here it's just a general holding page, not the detail page I'm referencing. How do you send those direct links to pages?
    Attached Files

    #2
    Hello coopgrafik,

    Thanks for your post.

    Here are links to the available Ninjascript Methods and properties:





    To determine the imbalances you would need to iterate through each price level and pull the volume data. There is no direct method for this.

    in the help guide, on a sub-page, look to the bottom right of the sub-page for "permalink" what will provide the link to that sub-page.

    Comment


      #3
      Thanks for the reply. I ran the trace in the example code for the volumetric bars and got this:

      ================================================== =====================
      Bar: 6587
      Trades: 112
      Total Volume: 249
      Total Buying Volume: 78
      Total Selling Volume: 171
      Delta for bar: -93
      Delta for bar (%): -37.3493975903614
      Delta for Close: 9
      Ask for Close: 9
      Bid for Close: 0
      Volume for Close: 9
      Maximum Ask: 69 at price: 3915.75
      Maximum Bid: 166 at price: 3915.75
      Maximum Combined: 235 at price: 3915.75
      Maximum Positive Delta: 9
      Maximum Negative Delta: -97
      Max seen delta (bar): 1
      Min seen delta (bar): -96
      Cumulative delta (bar): 2063

      What I feel like I'm looking for is a method that would return an array of values that would correspond with each tick level on the current bar after it closes. Once I had that, I'd be able to loop through those values and pick out the info I'm looking for and make the comparisons.

      When you say, "To determine the imbalances you would need to iterate through each price level and pull the volume data." which specific method are you referring to collect that data? Again, everything I see that is available is a single value. To determine an imbalance I would need bid and ask values for each tick of a bar. Hope that makes sense.

      Thanks!
      Last edited by coopgrafik; 02-12-2021, 12:03 PM.

      Comment


        #4
        Hello coopgrafik,

        Thanks for your reply.

        Correct, you will need to cycle through each price level in the bar and use GetAskVolumeForPrice(), GetBidVolumeForPrice()

        Here is an example:

        for (int i = 0; i <= ((High[0] - Low[0]) / TickSize); i++) // cycle through each tick level
        {
        long a = barsType1.Volumes[CurrentBar].GetAskVolumeForPrice(High[0] -(i*TickSize)); // start at the top and work down
        long b = barsType1.Volumes[CurrentBar].GetBidVolumeForPrice(High[0] -(i*TickSize));
        long c = barsType1.Volumes[CurrentBar].GetDeltaForPrice(High[0] -(i*TickSize));
        Print ("CB: "+CurrentBar+" Price: "+(High[0] - (i*TickSize))+" BidV: "+b+" AskV: "+a+" delta? "+c);
        }

        Comment


          #5
          Ok, that was a HUGE leg up. I'm more of a javascript guy so I have C# to deal with and I'm not totally familiar with all the available methods yet so this got me pointed in the right direction.

          Thank you so much!

          Comment


            #6
            Originally posted by NinjaTrader_PaulH View Post
            Hello coopgrafik,

            Thanks for your reply.

            Correct, you will need to cycle through each price level in the bar and use GetAskVolumeForPrice(), GetBidVolumeForPrice()

            Here is an example:

            for (int i = 0; i <= ((High[0] - Low[0]) / TickSize); i++) // cycle through each tick level
            {
            long a = barsType1.Volumes[CurrentBar].GetAskVolumeForPrice(High[0] -(i*TickSize)); // start at the top and work down
            long b = barsType1.Volumes[CurrentBar].GetBidVolumeForPrice(High[0] -(i*TickSize));
            long c = barsType1.Volumes[CurrentBar].GetDeltaForPrice(High[0] -(i*TickSize));
            Print ("CB: "+CurrentBar+" Price: "+(High[0] - (i*TickSize))+" BidV: "+b+" AskV: "+a+" delta? "+c);
            }
            Thank you! After a bit of search that was exactly what I was looking for. Since Volumetric bars can be calculated with OnBarClose instead of OnEachTick, strategy backtesting and optimization just got a gazillion times faster than using any of the available 3rd party indicators - even if I have to write some internal calculations myself.

            Now if only volumetric bars where able to handle custom bar types... but that's for another topic

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by Josephina55, 06-14-2025, 06:30 PM
            0 responses
            16 views
            0 likes
            Last Post Josephina55  
            Started by mathfrick2023, 05-08-2025, 12:51 PM
            8 responses
            77 views
            0 likes
            Last Post Yogaman
            by Yogaman
             
            Started by several, 04-22-2025, 05:21 AM
            2 responses
            249 views
            0 likes
            Last Post Lukasxgtx  
            Started by cherkoul, 06-12-2025, 11:21 PM
            0 responses
            18 views
            0 likes
            Last Post cherkoul  
            Started by NTEducationTeam, 06-12-2025, 02:30 PM
            0 responses
            30 views
            0 likes
            Last Post NTEducationTeam  
            Working...
            X