Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

How CrossAbove() is calculated?

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

    How CrossAbove() is calculated?

    Hello,

    I have following settings:

    Primary bars are 1-minute bars. There are supplementary 3-minute bars - BarsArray[2].

    I want to know is there a cross above of two DataSeries based on supplementary bars within last 30 minutes.

    So the syntax is like this:

    CrossAbove(LinReg(Closes[2],10),LinReg(Closes[2],30),barsLookBack);

    What should I place for barsLookBack, so that period is 30 minutes?
    • If CrossAbove is synchronized with primary 1-minute bars, it should be barsLookBack = 30.
    • If CrossAbove is synchronized with supplementary 3-minute bars, it should be barsLookBack = 10.


    Thanks,

    Valentin

    #2
    Hello Valyo,

    You can have a check in the beginning of OnBarUpdate() for this.

    if(BarsInProgress == 0)
    barsLookBack = 30
    if(BarsInProgress == 1)
    barsLookBack = 10;
    Cal H.NinjaTrader Customer Service

    Comment


      #3
      Thank you, Cal. So, it depends on how OnBarUpdate() runs.

      In this strategy OnBarUpdate() runs only with primary bars, so I should use barsLookBack = 30.

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by Geovanny Suaza, 02-11-2026, 06:32 PM
      0 responses
      646 views
      0 likes
      Last Post Geovanny Suaza  
      Started by Geovanny Suaza, 02-11-2026, 05:51 PM
      0 responses
      367 views
      1 like
      Last Post Geovanny Suaza  
      Started by Mindset, 02-09-2026, 11:44 AM
      0 responses
      107 views
      0 likes
      Last Post Mindset
      by Mindset
       
      Started by Geovanny Suaza, 02-02-2026, 12:30 PM
      0 responses
      569 views
      1 like
      Last Post Geovanny Suaza  
      Started by RFrosty, 01-28-2026, 06:49 PM
      0 responses
      573 views
      1 like
      Last Post RFrosty
      by RFrosty
       
      Working...
      X