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

OnMarketData problem

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

    OnMarketData problem

    Hello,
    I try to get similar info as you can get from footprints. Realtime data indicator is enough for me now. I use OnMarketData event, where I process incoming data this way:

    if (e.MarketDataType == MarketDataType.Ask)
    {
    askPrice = e.Price;
    return;
    }
    else if (e.MarketDataType == MarketDataType.Bid)
    {
    bidPrice = e.Price;
    return;
    }
    else if (e.MarketDataType != MarketDataType.Last || askPrice == 0 || bidPrice == 0)
    return;

    if (e.Price >= askPrice)
    askVolume += e.Volume;
    else if (e.Price <= bidPrice)
    bidVolume += e.Volume; }


    It's from another thread of this forum - you confirmed it like correct solution. But I get different information compare to commercial footprints (like FinAlg Market Balance). They have differnet ask/bid volume - sometimes inverse (not exact values, but I have bigger ask and they have bigger bid volume !! ) My question is, where is the problem ??
    I have ZenFire like data provider. See attached pic.Last visible bar has different bid ask volumes on price levels !

    Thank you for your help.
    Alex

    (www.jazzibaba.cz/A/DataProblem.jpg)

    #2
    Hi Alex,

    Thank you for your note.

    There is no way for us to know how the other commercial footprint is calculating this information as it is a protected assembly.
    You would need to contact the developer and see if they would be willing to share that kind of information.

    Per the code, it looks fine and it seems to be pulling the bid and ask as expected from the market data.

    Let me know if I can be of further assistance.
    Cal H.NinjaTrader Customer Service

    Comment


      #3
      Hello Cal, thank you for your quick answer. I understand there is no way to see their calculation algorithm. But I would like to know if code mentioned above is certainly correct and precise. When I recieve different result compare to commercial product (I suppose commercial software should calculate precisely), It means they either use different method for processing onmarketdata event (but why if your approach is correct), or there is another way how to get that data (except onmarketdata). When I sum bid and ask contracts it doesnt match to VOL indicator ! In most cases there is a difference of 1 contract, but sometimes (on fast and long bars) the difference is 20 or more !! I dont understand how it can appear there. Or is it necessary to use some next filtering ??

      And next strange think is that there are some rows in data feed coming into OnMarketData I cant recognize. See part of data list:
      ASK Last;15330;18.10.2013 15:20:08;1

      ASK Last;15330;18.10.2013 15:20:08;1

      ASK Last;15330;18.10.2013 15:20:08;1
      - Ask;15330;18.10.2013 15:20:08;3;7
      - Ask;15330;18.10.2013 15:20:08;1;7
      - Bid;15329;18.10.2013 15:20:08;5;10
      - Bid;15329;18.10.2013 15:20:08;7;10
      - Bid;15329;18.10.2013 15:20:08;9;10
      - Ask;15330;18.10.2013 15:20:08;2;7
      - Bid;15329;18.10.2013 15:20:08;7;10
      - Bid;15329;18.10.2013 15:20:08;5;10

      ASK Last;15330;18.10.2013 15:20:08;1

      ASK Last;15330;18.10.2013 15:20:08;1

      ???? Last;15333;18.10.2013 15:20:08;1

      What price 15331 is in this context ?? There are no other rows with this price,so I dont know if it is bid or ask (probably ask of course). I can see it quite often in data. (The list above is just Print command in every branch of my code above).
      Thank you very much for your help.
      Alex
      Last edited by Alexik34; 10-21-2013, 01:16 PM.

      Comment


        #4
        Alex,

        The code you have written looks good.

        What volumes differences are you seeing? Are you using the VOL indicator and checking the count from your indicator?

        If you allow Last price to come into the volume count does the volume adjust accordingly?
        Cal H.NinjaTrader Customer Service

        Comment


          #5
          Hello,
          will you be so kind and could you help me with other problem ?
          I would like to do my indicator in dll not providing .cs file in indicator folder. I know it is possible, but I dont know how to do that. I tried to search any info with uncle Google's help but with no big success.
          I guess there is not difficult way to compile it into Ninja.Custom.dll, but I would like to build my own dll. Do you have some link where I could find more info about it ??
          Thank you very much.
          Regards,
          Alex

          Comment


            #6
            Hi Alex,

            Thank you for your post.

            You can export your indicator as an assembly using the steps outlined from the link below -
            http://www.ninjatrader.com/support/h...tml?export.htm

            Be sure to read the section labeled 'Exporting NinjaScript Indicators or Strategies as Assembly'

            Let me know if I can be of further assistance.
            Cal H.NinjaTrader Customer Service

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by jeronymite, 04-12-2024, 04:26 PM
            3 responses
            40 views
            0 likes
            Last Post jeronymite  
            Started by bill2023, Today, 08:51 AM
            2 responses
            15 views
            0 likes
            Last Post bill2023  
            Started by sidlercom80, 10-28-2023, 08:49 AM
            167 responses
            2,260 views
            0 likes
            Last Post jeronymite  
            Started by warreng86, 11-10-2020, 02:04 PM
            7 responses
            1,362 views
            0 likes
            Last Post NinjaTrader_Manfred  
            Started by Perr0Grande, Today, 08:16 PM
            0 responses
            5 views
            0 likes
            Last Post Perr0Grande  
            Working...
            X