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 charlesugo_1, 05-26-2026, 05:03 PM
      0 responses
      65 views
      0 likes
      Last Post charlesugo_1  
      Started by DannyP96, 05-18-2026, 02:38 PM
      1 response
      149 views
      0 likes
      Last Post NinjaTrader_ChelseaB  
      Started by CarlTrading, 05-11-2026, 05:56 AM
      0 responses
      162 views
      0 likes
      Last Post CarlTrading  
      Started by CarlTrading, 05-10-2026, 08:12 PM
      0 responses
      99 views
      0 likes
      Last Post CarlTrading  
      Started by Hwop38, 05-04-2026, 07:02 PM
      0 responses
      286 views
      0 likes
      Last Post Hwop38
      by Hwop38
       
      Working...
      X