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 CarlTrading, 03-31-2026, 09:41 PM
      1 response
      155 views
      1 like
      Last Post NinjaTrader_ChelseaB  
      Started by CarlTrading, 04-01-2026, 02:41 AM
      0 responses
      90 views
      1 like
      Last Post CarlTrading  
      Started by CaptainJack, 03-31-2026, 11:44 PM
      0 responses
      137 views
      2 likes
      Last Post CaptainJack  
      Started by CarlTrading, 03-30-2026, 11:51 AM
      0 responses
      130 views
      1 like
      Last Post CarlTrading  
      Started by CarlTrading, 03-30-2026, 11:48 AM
      0 responses
      107 views
      0 likes
      Last Post CarlTrading  
      Working...
      X