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 CaptainJack, 05-29-2026, 05:09 AM
      0 responses
      263 views
      0 likes
      Last Post CaptainJack  
      Started by CaptainJack, 05-29-2026, 12:02 AM
      0 responses
      168 views
      0 likes
      Last Post CaptainJack  
      Started by charlesugo_1, 05-26-2026, 05:03 PM
      0 responses
      170 views
      1 like
      Last Post charlesugo_1  
      Started by DannyP96, 05-18-2026, 02:38 PM
      1 response
      257 views
      0 likes
      Last Post NinjaTrader_ChelseaB  
      Started by CarlTrading, 05-11-2026, 05:56 AM
      0 responses
      209 views
      0 likes
      Last Post CarlTrading  
      Working...
      X