Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

CrossAbove vs manual cross

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

    CrossAbove vs manual cross

    Hello,

    These two statements return different number of entries (totally different), why these two are not equivalent?

    Statement 1 is just the CrossAbove function.
    Statement 2 says if:
    close one period ago is under the SMA one period ago
    AND
    current close is greater than current sma



    Statement 1:
    CrossAbove(Closes[2][0],SMA(BarsArray[2],15),1)


    Statement 2:
    Closes[2][1] < SMA(BarsArray[2],15)[1] &&
    Closes[2][0] > SMA(BarsArray[2],15)[0]


    Thanks,

    #2
    Hello Morafra,

    Thank you for your post.

    This is because CrossAbove() condition checks for being less than or equal to the previous value rather than just less than

    This would be the test against the CrossAbove in the same manner as Statement 2:
    if(Closes[2][1] <= SMA(BarsArray[2], 15)[1]
    && Closes[2][0] > SMA(BarsArray[2], 15)[0])

    Let me know if I can be of further assistance.
    Cal H.NinjaTrader Customer Service

    Comment


      #3
      The CrossAbove returns about 3,300 trades whereas the updated Statement 2 returns about 30,000 trades.

      You can try this on your end with any strategy.

      Are there any other restrictions built in the CrossAbove function other than the actual crossover?

      Thanks,

      Comment


        #4
        Morfra,

        You are testing two different things here in that they are not the same test. CrossAbove() condition checking in side the method looks at Less than or Equal to the previous value.

        Your's is only checking when its Less than the previous.

        I would not expect to get similar results.

        What restrictions are you referring to?
        Cal H.NinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by Geovanny Suaza, 02-11-2026, 06:32 PM
        0 responses
        559 views
        0 likes
        Last Post Geovanny Suaza  
        Started by Geovanny Suaza, 02-11-2026, 05:51 PM
        0 responses
        324 views
        1 like
        Last Post Geovanny Suaza  
        Started by Mindset, 02-09-2026, 11:44 AM
        0 responses
        101 views
        0 likes
        Last Post Mindset
        by Mindset
         
        Started by Geovanny Suaza, 02-02-2026, 12:30 PM
        0 responses
        546 views
        1 like
        Last Post Geovanny Suaza  
        Started by RFrosty, 01-28-2026, 06:49 PM
        0 responses
        547 views
        1 like
        Last Post RFrosty
        by RFrosty
         
        Working...
        X