Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Top 3 Level 2 depths indicator

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

    Top 3 Level 2 depths indicator

    I am trying to script an indicator that would draw a dot for each of the top 3 bid depths and top 3 ask depths. I can't figure out how to get that data and sort it. I am assuming that I will need to drop all 10 depths of each side in to an array and sort them that way. First - how do I populate an array with that information assuming the arrays are:
    BIDDEPTH = new int[10]
    ASKDEPTH = new int[10]

    does that look right?

    Then - do I just use a massive IF THEN statement to sort them or can I use the:
    SORT(BIDDEPTH)
    command?

    Thank you so much in advance!

    #2
    Hello,
    Thank you for the question.

    For market depth there is a really good example we have posted on the forum that shows the process to get the depth, you would still need to get the results you are looking for but this will give you a framework to start with.



    There is also this example related to getting the level 2 data, this is a more advanced example that shows using custom timer events as well.


    For what you are trying to do the examples above use a List with a custom class defined as its object.
    I would recommend taking a look at some examples for basic List usage in C# to fully understand what is happening if you have not used a List before.

    With the List class you can get a count, reverse the list or get a value from a specified index.

    If you were only trying to get 3 results from the top of the list you could do something like the following:

    Code:
    for(int i - 0; i < 3; i++)
    	Print(askRows[i].Price);
    If you wanted it from the bottom you can use the Count or askRows.Count to get the amount of items in the list to loop through or do other logic.

    Please let me know if I may be of additional assistance .

    Comment


      #3
      How would I get the top 3, as in the highest value, rows? Not just rows 0 -2. But if out of all 10 rows, rows 5, 7 and 8 were of the highest value. I want the array to contain those - or at least have the array sorted from highest value to lowest.

      Comment


        #4
        Hello bchirhart,

        Thank you for your response.

        So are you looking for the lines at the largest values of depth? Or the highest position reached on the ladder (max row)? And is this just on the current data or over a period?

        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
        548 views
        1 like
        Last Post RFrosty
        by RFrosty
         
        Working...
        X