Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Counting elapsed bars

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

    Counting elapsed bars

    Is there a simple way to count bars forward after a given event or condition? Something similar to BarsSinceEntry() would do, but not specific for an entry event. For example, it should be able to be used in the following scenario: "If condition X is true, perform action Y while elapsed bars since condition became true is less than Z."

    #2
    Originally posted by fizikz View Post
    Is there a simple way to count bars forward after a given event or condition? Something similar to BarsSinceEntry() would do, but not specific for an entry event. For example, it should be able to be used in the following scenario: "If condition X is true, perform action Y while elapsed bars since condition became true is less than Z."
    Yeah, this sounds very easy.

    Do you need help coding it or something?

    Comment


      #3
      I expect it should be easy, but I'm asking here since I'm still getting familiarized with the built-in NinjaScript functions. Is there some bar counting function I overlooked, or do I need to code this myself? Which function(s) would be useful here?

      Comment


        #4
        fizikz, you can take a look at the MRO / LRO methods for this type of task -

        Comment


          #5
          Thanks, that's perfect.

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by SalmaTrader, 07-07-2026, 10:26 PM
          0 responses
          47 views
          0 likes
          Last Post SalmaTrader  
          Started by CarlTrading, 07-05-2026, 01:16 PM
          0 responses
          22 views
          0 likes
          Last Post CarlTrading  
          Started by CaptainJack, 06-17-2026, 10:32 AM
          0 responses
          15 views
          0 likes
          Last Post CaptainJack  
          Started by kinfxhk, 06-17-2026, 04:15 AM
          0 responses
          21 views
          0 likes
          Last Post kinfxhk
          by kinfxhk
           
          Started by kinfxhk, 06-17-2026, 04:06 AM
          0 responses
          23 views
          0 likes
          Last Post kinfxhk
          by kinfxhk
           
          Working...
          X