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 AaronKoRn, Today, 09:49 PM
              0 responses
              10 views
              0 likes
              Last Post AaronKoRn  
              Started by carnitron, Today, 08:42 PM
              0 responses
              9 views
              0 likes
              Last Post carnitron  
              Started by strategist007, Today, 07:51 PM
              0 responses
              10 views
              0 likes
              Last Post strategist007  
              Started by StockTrader88, 03-06-2021, 08:58 AM
              44 responses
              3,980 views
              3 likes
              Last Post jhudas88  
              Started by rbeckmann05, Today, 06:48 PM
              0 responses
              9 views
              0 likes
              Last Post rbeckmann05  
              Working...
              X