Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Minute vs Tick

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

    Minute vs Tick

    Hi

    I'm working on a 'crossover' strategy and want to test how it behaves when the signals are generated based on:

    1. minute data ( that is when the crossover occurs based on realtime/tick data, the strategy waits until the close of the minute bar and enters on the open of the next bar)

    2. tick data ( that is when the crossover occurs based on realtime/tick data, the strategy immediately enters long or short.

    I believe in order for me to test this, I will have to play around with ''CalculateOnBarClose." My understanding of this variable is that when it is set to false, the strategy uses tick data. When it is set to true, it waits for the close of the bar.

    When this variable is set to true, how do I select which closing bar to use? For example: if it is true, how do I tell it to use the close of ''X'' minute bar.

    Another thing that is confusing to me is that, after I have set the CalculateOnBarClose to true/false, and now I am about to do backtesting, there is a option for me to edit "data series" and select if I want to use minute, tick or hour. How is that going to affect my CalculateOnBarClose variable? ie if I have the CalculateOnBarClose variable set to false, but my data series in my backtesting is based on minute data, will CalculateOnBarClose variable override the backtesting data series and use tick data instead? Same thing for when testing the strategy in simulation mode. It gives the same option to select which data series to use. This is causing me a confusion as well.

    I would appreciate it if you can give me the variables that I need to set for the above two scenarios mentioned in your reply and an explanation.

    Thank you very much.

    #2
    Thanks for the post calhawk01 - CalculateOnBarClose would be an option only relevant for live simulation / trading or Market Replay though, as here the intrabar tick formation is known. In backtesting you would only be able to use it set to 'true' and have access to the OHLVC info of the underlying series.

    Per default it would use the series you've selected on your chart, so there would be no need to select a specific one to use - if you wanted to change that, just change the chart and the strategy will follow using that very series.

    Same would apply to backtesting - you can specify which chart series to use to drive your logic and decisions, however CalculateOnBarClose would be defaulted to 'true' here.

    Comment


      #3
      Originally posted by NinjaTrader_Bertrand View Post
      Thanks for the post calhawk01 - CalculateOnBarClose would be an option only relevant for live simulation / trading or Market Replay though, as here the intrabar tick formation is known. In backtesting you would only be able to use it set to 'true' and have access to the OHLVC info of the underlying series.

      Per default it would use the series you've selected on your chart, so there would be no need to select a specific one to use - if you wanted to change that, just change the chart and the strategy will follow using that very series.

      Same would apply to backtesting - you can specify which chart series to use to drive your logic and decisions, however CalculateOnBarClose would be defaulted to 'true' here.
      please verify/correct my thinking:
      realtime simulation scenarios:

      1.
      CalculateOnBarClose=True
      Strategy data series= 1 min
      RESULT= the strategy will wait for the close of the 1 min bar to implement the trading logic

      2.
      CalculateOnBarClose=False
      Strategy data series= 1 min
      RESULT= the strategy will not wait for the close of the 1 min bar to implement the trading logic

      3.
      CalculateOnBarClose=True
      Strategy data series= Tick
      RESULT= the strategy will wait for the close of the "tick" bar to implement the trading logic

      also if i start my strategy at 8AM (for NYSE trading stocks that trade 9:30-4PM) and one of my variable is "opening price." Is it going to use the opening price from 1 day ago? I'm saying this because I started my simulation at 8AM today and I started getting trades premarket. Even though my logic could not had been true because it uses the "opening price" of TODAY.

      Comment


        #4
        Hello,
        Originally posted by calhawk01 View Post
        please verify/correct my thinking:
        realtime simulation scenarios:

        1.
        CalculateOnBarClose=True
        Strategy data series= 1 min
        RESULT= the strategy will wait for the close of the 1 min bar to implement the trading logic
        Correct
        2.
        CalculateOnBarClose=False
        Strategy data series= 1 min
        RESULT= the strategy will not wait for the close of the 1 min bar to implement the trading logic
        Correct, each incoming tick would call OnBarUpdate()
        3.
        CalculateOnBarClose=True
        Strategy data series= Tick
        RESULT= the strategy will wait for the close of the "tick" bar to implement the trading logic
        You got it

        also if i start my strategy at 8AM (for NYSE trading stocks that trade 9:30-4PM) and one of my variable is "opening price." Is it going to use the opening price from 1 day ago? I'm saying this because I started my simulation at 8AM today and I started getting trades premarket. Even though my logic could not had been true because it uses the "opening price" of TODAY.
        This will depend on how you've coded your "opening price"
        What values are you storing in this variable?
        The opening price would not yet be known at this point so it's likely that your value is from the previous bar.
        Other things to consider, what COBC setting are you using and what period type are you running for your chart? Do you have any time filters built into your code to restrict trading?
        LanceNinjaTrader Customer Service

        Comment


          #5
          Originally posted by NinjaTrader_Lance View Post
          Hello,

          Correct

          Correct, each incoming tick would call OnBarUpdate()

          You got it


          This will depend on how you've coded your "opening price"
          What values are you storing in this variable?
          The opening price would not yet be known at this point so it's likely that your value is from the previous bar.
          Other things to consider, what COBC setting are you using and what period type are you running for your chart? Do you have any time filters built into your code to restrict trading?
          http://www.ninjatrader.com/support/h...tml?totime.htm
          The only time filter I have in my logic is ending all positions at 3:55PM.

          Opening price I am using is the Opening price at 9:30. I created this using the strategy wizard:

          Left column= open then the right column= indicator-> OHLC, changed the default setting to "open"

          I guess I could add time > 9:30AM logic in my trading to restrict the trading at 9:30. Or will this cause it to go live at 9:30AM instead? Any ideas how I can start at 9:30?

          Comment


            #6
            Setting your start time to 9:30am will depend on your chart settings.

            What session template are you using?
            What instrument are you trading?
            What is COBC set to?
            What chart interval are you using?
            LanceNinjaTrader Customer Service

            Comment


              #7
              What session template are you using? must be default b/c I have no idea what that is lol
              What instrument are you trading? stocks and etfs
              What is COBC set to? what is this?
              What chart interval are you using? 1 min and tick. i'm not using the chart but rather using the strategy tab on the main dashboard to test real time

              Comment


                #8
                Originally posted by calhawk01 View Post
                s
                What is COBC set to? what is this?
                Your calculate on bar close setting
                What chart interval are you using? 1 min and tick. i'm not using the chart but rather using the strategy tab on the main dashboard to test real time
                You script will have to be created differently depending on the chart settings.

                For example if you have COBC set to true you will not have a close at each time. Your time filter will need to ensure that you have a bar that closes within the bounds of this time filter.
                LanceNinjaTrader Customer Service

                Comment


                  #9
                  Originally posted by NinjaTrader_Lance View Post
                  Your calculate on bar close setting

                  You script will have to be created differently depending on the chart settings.

                  For example if you have COBC set to true you will not have a close at each time. Your time filter will need to ensure that you have a bar that closes within the bounds of this time filter.
                  Exactly

                  thx for your help, for now

                  Comment


                    #10
                    another question

                    if COBC in my strategy code is ''true'' but if select ''false'' when selecting a strategy to test on realtime data via the strategy tab on the dash board, will it then use tick data (override my strategy's code)?

                    ex: strategy tab -> new strategy -> under ''general'' setting, change COBC setting to ''false'' for a strategy where the COBC is ''true'' within the strategy's code

                    thx

                    Comment


                      #11
                      Originally posted by calhawk01 View Post
                      another question

                      if COBC in my strategy code is ''true'' but if select ''false'' when selecting a strategy to test on realtime data via the strategy tab on the dash board, will it then use tick data (override my strategy's code)?

                      ex: strategy tab -> new strategy -> under ''general'' setting, change COBC setting to ''false'' for a strategy where the COBC is ''true'' within the strategy's code

                      thx
                      It would all probably depend on how you override COBC....

                      This can be easily tested on your end in Market Replay. You'll know within 5 minutes...
                      (assuming you are <5 minute bars)... instead of waiting for a response here.

                      Rather than me setup something like this, please test and respond with your findings...

                      Comment


                        #12
                        Originally posted by sledge View Post
                        It would all probably depend on how you override COBC....

                        This can be easily tested on your end in Market Replay. You'll know within 5 minutes...
                        (assuming you are <5 minute bars)... instead of waiting for a response here.

                        Rather than me setup something like this, please test and respond with your findings...
                        i couldnt test it on the instruments i know (etfs) b/c i was not able to DL spy's market replay data but i did test it on ES. i believe it does override the formula, mods can you confirm that/

                        Comment

                        Latest Posts

                        Collapse

                        Topics Statistics Last Post
                        Started by Geovanny Suaza, 02-11-2026, 06:32 PM
                        0 responses
                        637 views
                        0 likes
                        Last Post Geovanny Suaza  
                        Started by Geovanny Suaza, 02-11-2026, 05:51 PM
                        0 responses
                        366 views
                        1 like
                        Last Post Geovanny Suaza  
                        Started by Mindset, 02-09-2026, 11:44 AM
                        0 responses
                        107 views
                        0 likes
                        Last Post Mindset
                        by Mindset
                         
                        Started by Geovanny Suaza, 02-02-2026, 12:30 PM
                        0 responses
                        569 views
                        1 like
                        Last Post Geovanny Suaza  
                        Started by RFrosty, 01-28-2026, 06:49 PM
                        0 responses
                        571 views
                        1 like
                        Last Post RFrosty
                        by RFrosty
                         
                        Working...
                        X