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 Haiasi, 04-25-2024, 06:53 PM
          2 responses
          16 views
          0 likes
          Last Post Massinisa  
          Started by Creamers, Today, 05:32 AM
          0 responses
          5 views
          0 likes
          Last Post Creamers  
          Started by Segwin, 05-07-2018, 02:15 PM
          12 responses
          1,786 views
          0 likes
          Last Post Leafcutter  
          Started by poplagelu, Today, 05:00 AM
          0 responses
          3 views
          0 likes
          Last Post poplagelu  
          Started by fx.practic, 10-15-2013, 12:53 AM
          5 responses
          5,407 views
          0 likes
          Last Post Bidder
          by Bidder
           
          Working...
          X