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 NullPointStrategies, Today, 05:17 AM
      0 responses
      24 views
      0 likes
      Last Post NullPointStrategies  
      Started by argusthome, 03-08-2026, 10:06 AM
      0 responses
      120 views
      0 likes
      Last Post argusthome  
      Started by NabilKhattabi, 03-06-2026, 11:18 AM
      0 responses
      63 views
      0 likes
      Last Post NabilKhattabi  
      Started by Deep42, 03-06-2026, 12:28 AM
      0 responses
      41 views
      0 likes
      Last Post Deep42
      by Deep42
       
      Started by TheRealMorford, 03-05-2026, 06:15 PM
      0 responses
      45 views
      0 likes
      Last Post TheRealMorford  
      Working...
      X