Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Ask + Bid values on each price levels

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

    Ask + Bid values on each price levels

    Hi,

    i am learning to code, i can work with OnMarketData outputs regarding ask and bid values, but right now i am only able to o it for a given bar.
    I would like to learn how to work with each price level inside of the bar, is there any way it can be done ?
    Or can someone point me to a reference of how i would be able to do this ? ( want to learn )

    Thank you

    #2
    Hello gyilaoliver,

    You can see the following example which works with level2 data, that will let you get the various levels. Resetting per bar would be based on your logic so after collecting data in the bar when a new bar happens from OnBarUpdate you could clear the collection or use a series to store data per bar.

    Join the official NinjaScript Developer Community for comprehensive resources, documentation, and community support. Build custom indicators and automated strategies for the NinjaTrader platforms with our extensive guides and APIs.

    Comment


      #3
      Hi Jesse, thanks for the reply.
      Actually i don’t need level 2 data ( as I don’t have ), maybe i didn’t express myself well when asking the question.

      what i want to do is to check imbalances, for example, as the candle is building. What i thought i could do, but don’t know if it would work, is something like :

      Sells[0][pricelevel] = sells (from OnMarketData)
      where [0] would refer to the current bar index, then i would compare Buys[0][pricelevel] to Sells[0][pricelevel]

      Comment


        #4
        Hello gyilaoliver,

        It would be similar concept if you wanted to do that with just level 1 data, you would need to use a dictionary like the sample I linked so you can have a collection where a key is used to see values. Level 1 data is just a tick so there are no levels, that would be completely up to your own logic to store values so you can refer to them later.

        Comment

        Latest Posts

        Collapse

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