Announcement

Collapse

Looking for a User App or Add-On built by the NinjaTrader community?

Visit NinjaTrader EcoSystem and our free User App Share!

Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less

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.
      BertrandNinjaTrader Customer Service

      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 arvidvanstaey, Today, 02:19 PM
          4 responses
          11 views
          0 likes
          Last Post arvidvanstaey  
          Started by samish18, 04-17-2024, 08:57 AM
          16 responses
          61 views
          0 likes
          Last Post samish18  
          Started by jordanq2, Today, 03:10 PM
          2 responses
          9 views
          0 likes
          Last Post jordanq2  
          Started by traderqz, Today, 12:06 AM
          10 responses
          18 views
          0 likes
          Last Post traderqz  
          Started by algospoke, 04-17-2024, 06:40 PM
          5 responses
          48 views
          0 likes
          Last Post NinjaTrader_Jesse  
          Working...
          X