Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Ask and Bid in historical bars

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

    Ask and Bid in historical bars

    Hello,
    I developed an indicator that uses the GetCurrentAsk and GetCurrentBid functions. The indicator works fine but, it calculates the right values only for the new bars (not for the historical ones).
    I know these functions return the close value instead of the bid or ask for historical bars.
    The problem is I have to wait for some new bars in order my indicator could give some values, and each time I change some parameter in my graph the indicator is reseted and I have to wait again to see some relevant values.
    But, how can I solve this limitation?
    Thank you for your help and support.

    #2
    Hello,
    Thank you for your post.

    You could add the Bid and Ask dataseries to the script to access the historical Bid and Ask.


    Add the data series in Intiizalize. Add(string instrumentName, PeriodType periodType, int period, MarketDataType marketDataType)

    This when then add as a bar series to the array and could call it by indicating the added array.
    For example:
    Code:
    protected override void Initialize()
    {
         Add("ES", PeriodType.Minute, 1, MarketDataType.Bid); //Adds a bid 1 minute bar sereis for the es
    }
    protected override void OnBarUpdate()
    {
        Closes[1][0];//This grabs the Close of the Bid series from the array and the current bar of the series. 
    }
    This would resolve this in NinjaTrader 7.
    For more information on using multiple bar types please see the following link, http://ninjatrader.com/support/helpG...nstruments.htm

    In NinjaTrader 8 you could use TickReplay to resolve this.

    If we can be of any other assistance please let us know.
    Cody B.NinjaTrader Customer Service

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by Geovanny Suaza, 02-11-2026, 06:32 PM
    0 responses
    559 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
    546 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