Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Incorrect Bid and Ask

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

    Incorrect Bid and Ask

    I have IQFeed as my data provider and am developing a Bid Ask Spread indicator. The bid ask spread is always erroneously reported as a value between 0.1 and 0.3 cents. Here is the code that I use

    Code:
    if(State == State.Historical && 0 < CurrentBar){
    //Print("State Historical");
    //run historical logic here
    bid = Bars.GetBid(CurrentBar);
    ask = Bars.GetAsk(CurrentBar);
    spread = (ask-bid);
    
    //Print(bid.ToString() + ": " + ask.ToString() + ": " + (ask-bid).ToString());
    
    }else{
    //Run Real Time code.
    // Spread[0] = (GetCurrentAsk() - GetCurrentBid());
    bid = GetCurrentBid();
    ask = GetCurrentAsk();
    spread = (ask-bid);
    }
    Please let me know if I am missing something obvious. When I export the series in text files as Bid, Ask, and Last, that data seems correct.

    Thanks

    #2
    Hello Sanjay Mishra,

    Thanks for your post.

    Bars.GetBid/GetAsk is only relevant on single tick data series to fetch bid/ask prices from bid/ask stamped ticks. (Best Bid/Ask price at the time the Last tick was seen.)

    GetCurrentAsk()/GetCurrentBid() will fetch the most recent bid/ask price seen with real-time data straight from the Level 1 data feed.

    The historical bid/ask series add all bid/ask prices, but it is not as up to date as GetCurrentAsk()/GetCurrentBid().

    See the help guide pages below for more information.
    Bars.GetBid: https://ninjatrader.com/support/help...nt8/getbid.htm
    Bars.GetAsk: https://ninjatrader.com/support/help...nt8/getask.htm
    GetCurrentAsk(): https://ninjatrader.com/support/help...currentask.htm
    GetCurrentBid(): https://ninjatrader.com/support/help...currentbid.htm

    Let us know if we may assist further.
    <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


      #3
      Thanks Brandon!

      Changing the chart to 1 tick chart fixed the issue.

      Muchas Gracias

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by Geovanny Suaza, 02-11-2026, 06:32 PM
      0 responses
      617 views
      0 likes
      Last Post Geovanny Suaza  
      Started by Geovanny Suaza, 02-11-2026, 05:51 PM
      0 responses
      358 views
      1 like
      Last Post Geovanny Suaza  
      Started by Mindset, 02-09-2026, 11:44 AM
      0 responses
      105 views
      0 likes
      Last Post Mindset
      by Mindset
       
      Started by Geovanny Suaza, 02-02-2026, 12:30 PM
      0 responses
      561 views
      1 like
      Last Post Geovanny Suaza  
      Started by RFrosty, 01-28-2026, 06:49 PM
      0 responses
      566 views
      1 like
      Last Post RFrosty
      by RFrosty
       
      Working...
      X