Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Tick Strategy, calculate on bar close indicators

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

    Tick Strategy, calculate on bar close indicators

    On a tick chart, one can choose calculate, On Bar Close for indicators. One can also use the wizard to create a tick based strategy but choose on bar close indicators.

    Inside a tick strategy, indicators added to the chart appear to be using calculate on each tick which I guess makes sense.. Is there a way to change them to use on bar close?

    Or does one just have always work with the previous bar, to accomplish this, ex:

    Code:
    if (IsFirstTickOfBar)
    {
      // Perform operations on the now previous bar [1]
      if (ema(12)[1] > sma(50)[1])
          // Do stuff
    }
    thanks

    #2
    Hello trader24211341,

    Thank you for your post.

    Unfortunately no, the strategy's calculate setting will dictate the hosted indicators calculate setting as well. So if your strategy is running OnEachTick, all hosted indicators will also run OnEachTick.

    From the Help Guide:

    "Embedded scripts within a calling parent script should not use a different Calculate property since it is already utilizing the Calculate property of the parent script (i.e. the strategy your indicator is called from)."

    "Since the parent NinjaScript therefore governs this setting, it should be set to the highest needed setting satisfying all its childs."

    Calculate - https://ninjatrader.com/support/help.../calculate.htm

    You can separate certain logic to only happen once per bar by using IsFirstTickOfBar. Please see the sample script linked below:

    https://forum.ninjatrader.com/forum/...tick#post19874

    Please let me know if you have any other questions.​

    Comment


      #3
      thanks, I understand.

      But I am curious on a chart, how is it able to use two different settings. On a tick chart where an indicator is set to calculate on bar close, under the hood is it basically doing as you suggest above?

      i.e. Waiting for IsFirstTickOfBar and using the [1] previous bar at that point?

      One reason I ask is because I'm trying to duplicate in my strategy, what's happening on a tick chart when I use on bar close calculations.

      cheers.

      Comment


        #4
        Hello trader24211341,

        The chart doesn't have a calculate setting. If you are using a tick chart, and your indicator is using OnBarClose, then it is simply only calculating when the 1-tick bar closes.

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by NullPointStrategies, Yesterday, 05:17 AM
        0 responses
        55 views
        0 likes
        Last Post NullPointStrategies  
        Started by argusthome, 03-08-2026, 10:06 AM
        0 responses
        132 views
        0 likes
        Last Post argusthome  
        Started by NabilKhattabi, 03-06-2026, 11:18 AM
        0 responses
        73 views
        0 likes
        Last Post NabilKhattabi  
        Started by Deep42, 03-06-2026, 12:28 AM
        0 responses
        45 views
        0 likes
        Last Post Deep42
        by Deep42
         
        Started by TheRealMorford, 03-05-2026, 06:15 PM
        0 responses
        49 views
        0 likes
        Last Post TheRealMorford  
        Working...
        X