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 cmoran13, Yesterday, 01:02 PM
              0 responses
              29 views
              0 likes
              Last Post cmoran13  
              Started by PaulMohn, 04-10-2026, 11:11 AM
              0 responses
              21 views
              0 likes
              Last Post PaulMohn  
              Started by CarlTrading, 03-31-2026, 09:41 PM
              1 response
              160 views
              1 like
              Last Post NinjaTrader_ChelseaB  
              Started by CarlTrading, 04-01-2026, 02:41 AM
              0 responses
              95 views
              1 like
              Last Post CarlTrading  
              Started by CaptainJack, 03-31-2026, 11:44 PM
              0 responses
              148 views
              2 likes
              Last Post CaptainJack  
              Working...
              X