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

Getting Market Depth volume into strategy.

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

    #16
    Hello,

    I'm not sure how much tweaking you've done to the original version in this thread, but I was able to make a few changes to resolve both of these issues.

    The first thing that I noticed is that VolAskTot and VolBidTot begin at 0. So, the first time you try to divide the two, you are dividing 0 by 0. To fix this, I just added the condition "if(VolAskTot > 0 && VolBidTot > 0)" to make sure the division is never done when either value is 0.

    Also, I noticed that the condition "if (e.Operation == Operation.Update)" was just floating out there all by itself. It didn't have either brackets or a single statement. The way it was coded, it looks like it would only govern the very next "if" statement, which I don't think was intended. I added brackets under this condition to encapsulate all of the e.Position checks, and all seems to be working now.

    I've attached an updated version of the script to this post, with Prints showing the VolAsk0, VolBid2, etc. values and other important values throughout.

    Please let me know if I can assist further.
    Attached Files
    Dave I.NinjaTrader Product Management

    Comment


      #17
      Dave,

      This code is not working in ninjatrader 8 beta 8.0.0.5

      What do I need to change to make it work correctly?
      Attached Files

      Comment


        #18
        Hello Lisa1980,

        Thank you for your patience.

        Your code was built for NinjaTrader 7. I made changes so that it will compile in NinjaTrader 8, but you will need to test it to verify it is working as expected.
        Attached Files

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by jxs_xrj, 01-12-2020, 09:49 AM
        6 responses
        3,290 views
        1 like
        Last Post jgualdronc  
        Started by Touch-Ups, Today, 10:36 AM
        0 responses
        7 views
        0 likes
        Last Post Touch-Ups  
        Started by geddyisodin, 04-25-2024, 05:20 AM
        8 responses
        61 views
        0 likes
        Last Post NinjaTrader_Gaby  
        Started by Option Whisperer, Today, 09:55 AM
        0 responses
        8 views
        0 likes
        Last Post Option Whisperer  
        Started by halgo_boulder, 04-20-2024, 08:44 AM
        2 responses
        24 views
        0 likes
        Last Post halgo_boulder  
        Working...
        X