Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Better for indicators used in strategy to be calc onbarclose

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

    Better for indicators used in strategy to be calc onbarclose

    Hi,

    I have an indicator that paints setups and targets. I coded this with calc on each tick, however all my calculations occur onfirsttickofbar.

    I wonder if I should recode my indicator for onbarclose.. doing this would take some time because I have a lot of code that I figure would need to have differences for barsback to be one less.. so close[2] > close[3] would then be close[1] > close[2].

    Is there a benefit for me to do this? or is there no difference in me using an each tick indicator in my strategy versus an onbarclose .. performance wise or otherwise?

    Thanks in advance.

    #2
    Hello KhaosTrader, and thank you for your question.

    As far as performance, provided you had no logic that executed outside of the first tick of the bar, your approach and operating on bar close will be roughly equivalent.

    From a programming perspective, some developers may find it easier to add a tick series whenever they need to optionally operate on tick data, so that operating once a bar is a default behavior and not one that need be specified by checking to see if it is the first tick of the bar. Should you decide to take this approach, this page of the help guide will have more information.



    Please let us know if there are any other ways we can help.
    Jessica P.NinjaTrader Customer Service

    Comment


      #3
      The page you referenced is about threading.. I am asking about using an calc.oneachtick versus calc.onbarclose.

      i use tick chart, but I am saying or rather asking what are the pros and cons of me making my indicator a calc.onbarclose which will be used in my strategy

      Comment


        #4
        This was a mistake on my part, I right-clicked the incorrect link when copying. This is the link which will explain the alternate approach available to you.



        The two approaches - Calculate.OnEachTick, or adding a Tick series - are completely equivalent with the exception of coding style preference. You will need to review the link I posted here to decide which style suits you better as a programmer.
        Jessica P.NinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by NullPointStrategies, 03-13-2026, 05:17 AM
        0 responses
        89 views
        0 likes
        Last Post NullPointStrategies  
        Started by argusthome, 03-08-2026, 10:06 AM
        0 responses
        151 views
        0 likes
        Last Post argusthome  
        Started by NabilKhattabi, 03-06-2026, 11:18 AM
        0 responses
        80 views
        0 likes
        Last Post NabilKhattabi  
        Started by Deep42, 03-06-2026, 12:28 AM
        0 responses
        53 views
        0 likes
        Last Post Deep42
        by Deep42
         
        Started by TheRealMorford, 03-05-2026, 06:15 PM
        0 responses
        62 views
        0 likes
        Last Post TheRealMorford  
        Working...
        X