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