Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

OnMarketDepth – max level size?

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

    #16
    Ok, the print output is showing the correct information most of the time, what I would like to do is not include the inside ask so only positions 1 through to 4 if you could help me out with the syntax that would be great.

    maxValue=0;
    maxAskSizeLevel=0;
    for(int i=0; i<5; i++)
    {
    if (e.MarketDepth.Ask[i].Volume > maxValue)
    {
    maxValue = e.MarketDepth.Ask[i].Volume;
    maxAskSizeLevel = i;

    Comment


      #17
      ...then you would need to do your loop from 1 to <5, so starting at the first level instead of level 0.

      Comment


        #18
        I would be grateful if I could get some assistance as to why the Print() function for the code below is sending out "extra" prints 1 correct at the time and 2 not correct. Here I will give example. The code is in addition to the market depth sample.

        Code:
                    maxValue=0;
                    maxAskSizeLevel=-1;
                    for(int i=1; i<5; i++)
                    {
                    if (e.MarketDepth.Ask[i].Volume > maxValue)
                    {    
                    maxValue = e.MarketDepth.Ask[i].Volume;
                    maxAskSizeLevel = i;
                    Print("MAX Ask |" + maxValue + " | " + maxAskSizeLevel);
                    }
                    }
        MAX Ask |89 | 3 Time 10:42:44 - Correct Output
        MAX Ask |41 | 1 Time 10:42:44 - ?
        MAX Ask |50 | 2 Time 10:42:44 - ?
        MAX Ask |89 | 3 Time 10:42:44 - Correct Output
        MAX Ask |41 | 1 Time 10:42:44 - ?
        MAX Ask |50 | 2 Time 10:42:44 - ?
        MAX Ask |89 | 3 Time 10:42:44 - Correct Output
        MAX Ask |41 | 1 Time 10:42:44 - ?
        MAX Ask |50 | 2 Time 10:42:44 - ?
        MAX Ask |89 | 3 Time 10:42:44 - Correct Output
        MAX Ask |41 | 1 Time 10:42:44 - ?
        MAX Ask |50 | 2 Time 10:42:44 - ?
        MAX Ask |89 | 3 Time 10:42:44 - Correct Output

        Regards,
        suprsnipes

        Comment


          #19
          It is coded exactly as you have put.

          Each one is increasing

          Try moving your print OUTSIDE of the IF statement

          Originally posted by suprsnipes View Post
          I would be grateful if I could get some assistance as to why the Print() function for the code below is sending out "extra" prints 1 correct at the time and 2 not correct. Here I will give example. The code is in addition to the market depth sample.

          Code:
                      maxValue=0;
                      maxAskSizeLevel=-1;
                      for(int i=1; i<5; i++)
                      {
                      if (e.MarketDepth.Ask[i].Volume > maxValue)
                      {    
                      maxValue = e.MarketDepth.Ask[i].Volume;
                      maxAskSizeLevel = i;
                      Print("MAX Ask |" + maxValue + " | " + maxAskSizeLevel);
                      }
                      }
          MAX Ask |89 | 3 Time 10:42:44 - Correct Output
          MAX Ask |41 | 1 Time 10:42:44 - ?
          MAX Ask |50 | 2 Time 10:42:44 - ?
          MAX Ask |89 | 3 Time 10:42:44 - Correct Output
          MAX Ask |41 | 1 Time 10:42:44 - ?
          MAX Ask |50 | 2 Time 10:42:44 - ?
          MAX Ask |89 | 3 Time 10:42:44 - Correct Output
          MAX Ask |41 | 1 Time 10:42:44 - ?
          MAX Ask |50 | 2 Time 10:42:44 - ?
          MAX Ask |89 | 3 Time 10:42:44 - Correct Output
          MAX Ask |41 | 1 Time 10:42:44 - ?
          MAX Ask |50 | 2 Time 10:42:44 - ?
          MAX Ask |89 | 3 Time 10:42:44 - Correct Output

          Regards,
          suprsnipes

          Comment

          Latest Posts

          Collapse

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