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 DanielSanMartin, Yesterday, 02:37 PM
          2 responses
          13 views
          0 likes
          Last Post DanielSanMartin  
          Started by DJ888, 04-16-2024, 06:09 PM
          4 responses
          12 views
          0 likes
          Last Post DJ888
          by DJ888
           
          Started by terofs, Today, 04:18 PM
          0 responses
          11 views
          0 likes
          Last Post terofs
          by terofs
           
          Started by nandhumca, Today, 03:41 PM
          0 responses
          8 views
          0 likes
          Last Post nandhumca  
          Started by The_Sec, Today, 03:37 PM
          0 responses
          7 views
          0 likes
          Last Post The_Sec
          by The_Sec
           
          Working...
          X