Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Bid & Ask volume logic

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

    Bid & Ask volume logic

    I am trying to code a simple script in strategy builder where when for example: Bid > Ask volume, then enter short.
    Questions: 1) do I need level 2 data to code and use this strategy?, 2) I want to add a threshold for it, need to unlock code, correct?

    With what or where do I need to be careful on the code writing to get a better code?

    #2
    Also, how can I add a “depth” parameter? I.e.: to add the bid and ask volumes for say 5 price levels (5 being the depth)

    Comment


      #3
      Hello carlosgutierrez,

      Thanks for your notes.

      Bid volume and Ask volume could be found in the Price folder in the Strategy Builder Conditions Builder window. The Strategy Builder does not have a Bid/Ask volume depth parameter available to access.

      You could create a condition that checks if the Bid volume Price folder > Bid volume) is Greater than the Ask volume (Price folder > Ask volume) and call your EnterShort() method within that condition.

      You would need to unlock your code from the Strategy Builder and come up with your own custom logic to save the last 5 Bid/Ask volumes to variables or to a list if you want to access those values in a script.

      See the help guide documentation below for more information.

      Strategy Builder Conditions: https://ninjatrader.com/support/help...on_builder.htm
      Strategy Builder Actions: https://ninjatrader.com/support/help...t8/actions.htm
      GetCurrentBidVolume(): https://ninjatrader.com/support/help...tbidvolume.htm
      GetCurrentAskVolume(): https://ninjatrader.com/support/helpGuides/nt8/getcurrentaskvolume.htm​

      To get bid/ask volume you could use level 1 market data.

      OnMarketData(): https://ninjatrader.com/support/help...marketdata.htm

      To get market depth data, you would need level 2 market data.

      OnMarketDepth: https://ninjatrader.com/support/help...=OnMarketDepth
      <span class="name">Brandon H.</span><span class="title">NinjaTrader Customer Service</span><iframe name="sig" id="sigFrame" src="/support/forum/core/clientscript/Signature/signature.php" frameborder="0" border="0" cellspacing="0" style="border-style: none;width: 100%; height: 120px;"></iframe>

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by CarlTrading, 03-31-2026, 09:41 PM
      1 response
      46 views
      0 likes
      Last Post NinjaTrader_ChelseaB  
      Started by CarlTrading, 04-01-2026, 02:41 AM
      0 responses
      22 views
      0 likes
      Last Post CarlTrading  
      Started by CaptainJack, 03-31-2026, 11:44 PM
      0 responses
      31 views
      1 like
      Last Post CaptainJack  
      Started by CarlTrading, 03-30-2026, 11:51 AM
      0 responses
      50 views
      0 likes
      Last Post CarlTrading  
      Started by CarlTrading, 03-30-2026, 11:48 AM
      0 responses
      42 views
      0 likes
      Last Post CarlTrading  
      Working...
      X