Announcement

Collapse

Looking for a User App or Add-On built by the NinjaTrader community?

Visit NinjaTrader EcoSystem and our free User App Share!

Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less

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 geddyisodin, Yesterday, 05:20 AM
    7 responses
    45 views
    0 likes
    Last Post NinjaTrader_Gaby  
    Started by gbourque, Today, 06:39 AM
    2 responses
    5 views
    0 likes
    Last Post gbourque  
    Started by cre8able, Yesterday, 07:24 PM
    1 response
    13 views
    0 likes
    Last Post NinjaTrader_ChelseaB  
    Started by cocoescala, 10-12-2018, 11:02 PM
    6 responses
    939 views
    0 likes
    Last Post Jquiroz1975  
    Started by cmtjoancolmenero, Yesterday, 03:58 PM
    1 response
    19 views
    0 likes
    Last Post NinjaTrader_Gaby  
    Working...
    X