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 JonesJoker, 04-22-2024, 12:23 PM
          8 responses
          41 views
          0 likes
          Last Post JonesJoker  
          Started by timko, Today, 06:45 AM
          0 responses
          3 views
          0 likes
          Last Post timko
          by timko
           
          Started by Waxavi, 04-19-2024, 02:10 AM
          2 responses
          39 views
          0 likes
          Last Post poeds
          by poeds
           
          Started by chbruno, Yesterday, 04:10 PM
          1 response
          44 views
          0 likes
          Last Post NinjaTrader_Gaby  
          Started by Max238, Today, 01:28 AM
          1 response
          25 views
          0 likes
          Last Post CactusMan  
          Working...
          X