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

Tick by Tick Data

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

    Tick by Tick Data

    Hi,

    I'm developing an indicator that analyze tick by tick data,CalculateOnBarClose=false;

    My question is how I get to the last tick data that called OnBarUpdate():
    1. The tick price.
    2. The tick volume.

    This is different from using bars and accessing the bar data such as Close[0];

    Thanks in advance!

    #2
    freewind, Close[0] will actually give you the last tick price, but to get the last tick volume you'll either have to keep track of the difference between each Volume[0] to get the most recent volume change, or you can use OnMarketData() to get the most recent tick volume.

    Code:
    OnMarketData(MarketDataEventArgs e)
    {
       // if nt7
       long currentVolume = e.Volume;
       
       // if nt6.5
       int currentVolume = e.Volume;
    }
    AustinNinjaTrader Customer Service

    Comment


      #3
      Thank Austin.
      So if I understand correctly I can set CalculateOnBarClose=true. and separate the logic for tick analysis to OnMarketData() and bar logic to OnBerUpadate().
      The OnMarketData() is called on each tick because the voume is changing even if the price didn't change, correct?
      BTW can I use the last tick volume as Volume[0]-Volume[1]?

      Comment


        #4
        freewind, yes, this is correct. There is a reference sample that demonstrates how to separate the tick-by-tick logic from the bar-by-bar logic.

        OnMarketData() is called on every bid, ask, or trade update.

        You cannot use the last tick volume as Volume[1]-Volume[0] because volume[1] contains the entire volume of the last bar while volume[0] is updated continuously as the bar progresses.
        AustinNinjaTrader Customer Service

        Comment


          #5
          Thank again Austin.
          Is there a way to backtest my strategy on tick data? I don't need Bid Ask just the data that is in the tick DB.

          Comment


            #6
            freewind, here is the reference sample that demonstrates how to backtest with an intrabar granularity.
            AustinNinjaTrader Customer Service

            Comment


              #7
              Austin,
              If I have a strategy that CalculateOnBarClose set to false, and I have tick data and I run the strategy on a 150 tick bar chart does OnBarUpdate() is called on each tick on my historical data?

              Comment

              Latest Posts

              Collapse

              Topics Statistics Last Post
              Started by jxs_xrj, 01-12-2020, 09:49 AM
              6 responses
              3,290 views
              1 like
              Last Post jgualdronc  
              Started by Touch-Ups, Today, 10:36 AM
              0 responses
              9 views
              0 likes
              Last Post Touch-Ups  
              Started by geddyisodin, 04-25-2024, 05:20 AM
              11 responses
              62 views
              0 likes
              Last Post halgo_boulder  
              Started by Option Whisperer, Today, 09:55 AM
              0 responses
              8 views
              0 likes
              Last Post Option Whisperer  
              Started by halgo_boulder, 04-20-2024, 08:44 AM
              2 responses
              25 views
              0 likes
              Last Post halgo_boulder  
              Working...
              X