Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

OnEachTick and OnBarClose

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

    OnEachTick and OnBarClose

    I have a function in my strategy that depends on OnBarClose calculation to draw an object but I have other functions inside OnBarUpdate() that need OnEachTick calculation. Is this possible?

    #2
    Hello TraderMatt83,

    Thank you for your post.

    Yes, this is possible. You would need to set the strategy to calculate On Each Tick, and then within your logic for anything that requires updates On Bar Close, you can add a check to see if IsFirstTickOfBar is true. This is because a bar's close is determined by the first tick of a new bar forming. Here is the help guide page about IsFirstTickOfBar:


    Additionally, we have a reference sample that demonstrates how to separate logic to calculate either on each tick or on bar close:


    Please let us know if we may be of further assistance.

    Comment


      #3
      This will definitely work. Thank you!

      Comment


        #4
        Emily,

        I finally got this to work except not sure how to fix my issue where my trade is no longer taking the trade if the previous closing bar is above a range. This function below determines whether to go long if the previous candle close is above the range high but it appears to be taking the trade below the range high. And I know the range high is correct because I have it painted. Yet the entry always happens if the current candle hits the range high. Thoughts?

        private bool entryLongCheck()
        {
        return Close[1] > rangeHigh && Close[2] <= rangeHigh && High[0] > High[1] && CurrentBar - lastTradeBarLong > 2 && Close[0] > rangeLow;
        }​

        Comment


          #5
          Emily,

          I finally got this to work except not sure how to fix my issue where my trade is no longer taking the trade if the previous closing bar is above a range. This function below determines whether to go long if the previous candle close is above the range high but it appears to be taking the trade below the range high. And I know the range high is correct because I have it painted. Yet the entry always happens if the current candle hits the range high. Thoughts?

          private bool entryLongCheck()
          {
          return Close[1] > rangeHigh && Close[2] <= rangeHigh && High[0] > High[1] && CurrentBar - lastTradeBarLong > 2 && Close[0] > rangeLow;
          }​

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by Geovanny Suaza, 02-11-2026, 06:32 PM
          0 responses
          596 views
          0 likes
          Last Post Geovanny Suaza  
          Started by Geovanny Suaza, 02-11-2026, 05:51 PM
          0 responses
          343 views
          1 like
          Last Post Geovanny Suaza  
          Started by Mindset, 02-09-2026, 11:44 AM
          0 responses
          103 views
          0 likes
          Last Post Mindset
          by Mindset
           
          Started by Geovanny Suaza, 02-02-2026, 12:30 PM
          0 responses
          556 views
          1 like
          Last Post Geovanny Suaza  
          Started by RFrosty, 01-28-2026, 06:49 PM
          0 responses
          554 views
          1 like
          Last Post RFrosty
          by RFrosty
           
          Working...
          X