Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Calulating indicator value when CalculateOnBarClose = false

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

    Calulating indicator value when CalculateOnBarClose = false

    Hello,

    I would like to know how to retrieve the value of an indicator at the close of the previous bar when CalculateOnBarClose is set to false. When it is set to false and I want to get the previous value I am getting the value of the previous tick.

    Thanks

    #2
    Hello guillembm,
    Thanks for your post.

    You could use the IsFirstTickOfBar property to seperate your logic like this. Please see the reference sample in our help guide here: https://ninjatrader.com/support/help...either_cal.htm

    Let me know if you have any questions or if this will not work for you.
    Josh G.NinjaTrader Customer Service

    Comment


      #3
      Another question about this issue.

      Can FirstTickOfBar be used in a nested conditional in a secondary condition like:

      if (MyCondition)
      {
      if (FirstTickOfBar)
      MyMethod();
      }

      or it can only be used in the main conditional like

      if (FirstTickOfBar)
      {
      if (MyCondition)
      MyMethod();
      }

      Should it work in both ways?

      Comment


        #4
        guillembm,

        You can use FirstTickOfBar wherever you like in your logic, but I suspect you are going to want to use your second snippet so that nothing prevents that condition from being checked.
        Code:
        if (FirstTickOfBar)
        {
             if ([I]MyCondition[/I])
        [I]         MyMethod[/I]();
        }
        If you went with your first snippet, and MyCondition was false, then FirstTickOfBar would not get evaluated on that pass.
        Josh G.NinjaTrader Customer Service

        Comment


          #5
          Thanks,

          The 1st one is the one I want to use.

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by wzgy0920, 04-20-2024, 06:09 PM
          2 responses
          26 views
          0 likes
          Last Post wzgy0920  
          Started by wzgy0920, 02-22-2024, 01:11 AM
          5 responses
          32 views
          0 likes
          Last Post wzgy0920  
          Started by wzgy0920, Yesterday, 09:53 PM
          2 responses
          49 views
          0 likes
          Last Post wzgy0920  
          Started by Kensonprib, 04-28-2021, 10:11 AM
          5 responses
          191 views
          0 likes
          Last Post Hasadafa  
          Started by GussJ, 03-04-2020, 03:11 PM
          11 responses
          3,230 views
          0 likes
          Last Post xiinteractive  
          Working...
          X