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

Using Historical Bid/Ask Series without Tick Replay

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

    Using Historical Bid/Ask Series without Tick Replay

    Hi,

    I've been able to access historical bid/ask data by using OnMarketData and TickReplay, however the help guide (https://ninjatrader.com/support/help..._ask_serie.htm) indicates that it should be possible to access via OnBarUpdate() without TickReplay? Please could you let me know if any of the sample strategies are already leveraging historical bid/ask data in this way?

    For additional context:
    To start from, I'm trying to print the Bid & Ask to Output when I load an instrument onto a chart with the strategy enabled. The helpguide shows...

    Code:
    AddDataSeries("AAPL", BarsPeriodType.Minute, 30, MarketDataType.Ask);
    ... however I don't want to hardcode an instrument like "AAPL" and omitting or using 'this" is causing errors (I recognize this is probably a basic thing sorry, but I've been struggling on this for a while now).

    Many thanks

    ChainsawDR

    #2
    Hi ChainsawDR, thanks for posting.

    You can add a 1 tick series and determine a bid or ask update. I attached an example that demonstrates how to do it vs the default "BuySellVolume" which uses OnMarketData/Tick Replay

    Kind regards,
    -ChrisL
    Attached Files
    Chris L.NinjaTrader Customer Service

    Comment


      #3
      Wow, thank you very much for putting this together Chris! There's quite a bit for me to pick over here (I've been working on strategies with historical data only so this is the first time seeing how to put together an indicator that works for both). Will loop back if any questions. Thanks again!

      Comment


        #4
        I need to get average bidAsk spread of last 5min for a strategy that's running on TickReplay. (average of 4 ohlc values of last 5min).
        Doc says I cannot get that from series of MarketDataType.Ask​/Bid, from AddDataSeries?

        How can that be done? Can you share a quick snippet? Does one have to manually collects and calculate that from a custom series using OnMarketData?

        What would happen if one tries to access Ask series during tick replay OnBarUpdate?

        Doc:
        https://ninjatrader.com/support/help...ick_replay.htm
        Warning: A Tick Replay indicator or strategy CANNOT use a MarketDataType.Ask or MarketDataType.Bid series.
        Tick Replay was only ONLY designed to work with MarketDataType.Last. A TickReplay indicator or strategy should NOT be mixed with a MarketDataType.Ask or MarketDataType.Bid series




        Last edited by yubo27; 11-12-2022, 08:08 AM.

        Comment


          #5
          Hello yubo27,

          Thanks for your note.

          I see that you created a forum thread asking this same question. Please see the reply to that forum thread linked below.

          I need to get average spread (bid/ask) of last 5min for a strategy that's running on TickReplay. How can that be done? Could share an example snippet? Your doc says following would give past bidAsk, but cannot be used for TickReplay type. What would happen if one tries to access Ask series during tick replay? eg.


          Let me know if I may assist further.
          Brandon H.NinjaTrader Customer Service

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by jxs_xrj, 01-12-2020, 09:49 AM
          4 responses
          3,282 views
          1 like
          Last Post jgualdronc  
          Started by Option Whisperer, Today, 09:55 AM
          0 responses
          5 views
          0 likes
          Last Post Option Whisperer  
          Started by geddyisodin, 04-25-2024, 05:20 AM
          8 responses
          58 views
          0 likes
          Last Post NinjaTrader_Gaby  
          Started by halgo_boulder, 04-20-2024, 08:44 AM
          2 responses
          22 views
          0 likes
          Last Post halgo_boulder  
          Started by mishhh, 05-25-2010, 08:54 AM
          19 responses
          6,189 views
          0 likes
          Last Post rene69851  
          Working...
          X