Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

CrossAbove Close & Close[0] different results

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

    CrossAbove Close & Close[0] different results

    Anyone know why these expressions would evaluate differently?

    CrossAbove(Close[0], EMA(m_FastPeriod), 1): False
    CrossAbove(Close, EMA(m_FastPeriod), 1): True
    6/4/2009 6:39:01 PM
    Last edited by un$ane; 06-04-2009, 08:47 PM.

    #2
    Welcome to our forums, please check this link and try reversing the order when you compare a double and a dataseries in the CrossAbove / CrossBelow - http://www.ninjatrader-support.com/H...rossAbove.html

    Comment


      #3
      Does that mean this method is invalid?

      public bool CrossAbove(double value, IDataSeries series2, int lookBackPeriod);

      I can't seem to get either one of these to evaluate to True:
      CrossAbove(EMA(m_FastPeriod), Close[0], 1);
      CrossAbove(Close[0], EMA(m_FastPeriod), 1);

      In my strategy I'm using:
      CalculateOnBarClose = true;
      if (BarsInProgress == 0 && FirstTickOfBar)

      Thanks for the reply.
      Last edited by un$ane; 06-05-2009, 09:22 AM.

      Comment


        #4
        Please try using then and see if this evaluates to 'true' -

        Code:
        CrossAbove(Close, EMA(m_FastPeriod), 1);

        Comment


          #5
          It does...But I'm curious why the others don't. I'm now questioning my understanding of the concept and/or whether there's a bug.

          Comment


            #6
            If you submit a double, it has no history of values to compare so it would never cross.

            Comment


              #7
              oh...That makes sense!

              Kinda weird why those methods exist, but at least I can sleep better tonight

              Thxs Bertrand.

              Comment

              Latest Posts

              Collapse

              Topics Statistics Last Post
              Started by Geovanny Suaza, 02-11-2026, 06:32 PM
              0 responses
              633 views
              0 likes
              Last Post Geovanny Suaza  
              Started by Geovanny Suaza, 02-11-2026, 05:51 PM
              0 responses
              364 views
              1 like
              Last Post Geovanny Suaza  
              Started by Mindset, 02-09-2026, 11:44 AM
              0 responses
              105 views
              0 likes
              Last Post Mindset
              by Mindset
               
              Started by Geovanny Suaza, 02-02-2026, 12:30 PM
              0 responses
              567 views
              1 like
              Last Post Geovanny Suaza  
              Started by RFrosty, 01-28-2026, 06:49 PM
              0 responses
              568 views
              1 like
              Last Post RFrosty
              by RFrosty
               
              Working...
              X