• If this is your first visit, you will have to register before you can post. To view messages, please scroll below and select the forum that you would like to visits. Questions? Be sure to check out the Forum FAQ.

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 (MyCondition)
                 MyMethod();
        }
        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 heurvsgs, Today, 02:27 AM
          0 responses
          1 view
          0 likes
          Last Post heurvsgs  
          Started by Ntrifix, Today, 02:26 AM
          0 responses
          1 view
          0 likes
          Last Post Ntrifix
          by Ntrifix
           
          Started by aviat72, Today, 12:41 AM
          1 response
          8 views
          0 likes
          Last Post NinjaTrader_ChrisSch  
          Started by _Zero_, 01-06-2020, 01:16 PM
          2 responses
          75 views
          2 likes
          Last Post CiprianV  
          Started by RuthB, 05-29-2020, 09:41 PM
          3 responses
          32 views
          0 likes
          Last Post aviat72
          by aviat72
           
          Working...
          X