Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

CrossAbove() giving different results

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

    CrossAbove() giving different results

    Hi again guys. I'm getting some weird behavior using two different parametrizations of CrossAbove() and I just want to make sure I'm not missing anything.

    From the docs:
    CrossAbove(IDataSeries series1, double value, int lookBackPeriod)
    CrossAbove(IDataSeries series1, IDataSeries series2, int lookBackPeriod)

    I've been using
    CrossAbove(Close, bollinger.Upper,1) and everything has been alright.

    However, I want to have a variable modify the bollinger.Upper series value, so I tried switching from the IDataSeries object to a double by using

    CrossAbove(Close, bollinger.Upper[0], 1) , with the intention of then modifying bollinger.Upper[0] with some other doubles.

    But when I ran two separate backtests on the same data series (verified) on multiple different sets, I get different trade results... huh? Not drastically different mind you, something like 1426 trades vs 1405 trades, but I'm just surprised there is ANY difference.

    Either it's a quirk in the CrossAbove function how it handles the two different data types, or I checked versus two different data sets (verified I didn't do this), or it's a cosmic mystery. Anyone seen something like this before?

    #2
    Hello Locke,

    Thank you for your post.

    The difference here is that you would be comparing a Static value (double) to a Dynamic value (IDataSeries)

    With the Static value you are comparing against the same value in both the current bar and previous bar (Previous bar is used to check for the cross portion)

    With the Dynamic you are comparing the current bar of each series to the previous bar for each series

    Static -
    Code:
    if(DataSeries[0] > Value && DataSeries[1] <= Value)
    Dynamic -
    Code:
    if(DataSeries[0] > DataSeries2[0] && DataSeries[1] <= DataSeries[1])
    Let me know if I can be of further assistance.
    Cal H.NinjaTrader Customer Service

    Comment


      #3
      Argh, that's right it's based off the previous bar. I'm a dope. Thanks for the clarification Cal.

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by Geovanny Suaza, 02-11-2026, 06:32 PM
      0 responses
      666 views
      0 likes
      Last Post Geovanny Suaza  
      Started by Geovanny Suaza, 02-11-2026, 05:51 PM
      0 responses
      377 views
      1 like
      Last Post Geovanny Suaza  
      Started by Mindset, 02-09-2026, 11:44 AM
      0 responses
      110 views
      0 likes
      Last Post Mindset
      by Mindset
       
      Started by Geovanny Suaza, 02-02-2026, 12:30 PM
      0 responses
      575 views
      1 like
      Last Post Geovanny Suaza  
      Started by RFrosty, 01-28-2026, 06:49 PM
      0 responses
      580 views
      1 like
      Last Post RFrosty
      by RFrosty
       
      Working...
      X