Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

CrossAbove(CCI(14), 250, 1)

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

    CrossAbove(CCI(14), 250, 1)

    Hello!

    I want CCI to cross above/below my signal bar. From what I have found in the Ninjatrader guide, the function:
    HTML Code:
    CrossAbove(CCI(14), 250, 1)
    means that the CCI crosses the value 250 within the last bar.
    Now I want my CCI to cross above/below the signal bar, which in my case would be Bar[0], and at the close of this bar. So I have written:
    HTML Code:
    CrossBelow(CCI(CCIPeriod), Close[0], 0)
    but I have no trigger.
    What could be wrong here?

    I would apprecaite any help.

    Thanks in advance!

    #2
    Hi Stan, thanks for posting. The CrossBelow method needs at least 1 bar to look back on, so you should change the lookback period to 1.

    Kind regards,
    -ChrisL

    Comment


      #3
      Many thanks ChrisL for your reply!
      After changing the lookback period to 1 I did not have different result from what I had previously. I have changed Close[0] to Close[1] and 0 as previous bar to 1. That means
      HTML Code:
      CrossBelow(CCI(CCIPeriod), Close[1], 1)
      Kein regards

      Comment


        #4
        Hi Stan, thanks for the follow up.

        Pass in the Close array instead of a single value of Close[x] e.g.

        CrossBelow(CCI(CCIPeriod), Close, 1)

        Now, the CCI values usually oscillate between -200 and 200, a lot of instruments will fall around these values. Make sure the instrument you are working with is numerically similar, not just visually similar on the chart. Another way to debug and test is to use Print. This will let you print out data from the script as it is running. e.g.

        if(CrossBelow(CCI(CCIPeriod), Close, 1))
        {
        Print("CCI Signal");
        }

        Comment


          #5
          Many thanks Chris for your reply. This the solution to the problem.

          Many many thanks again.

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by Geovanny Suaza, 02-11-2026, 06:32 PM
          0 responses
          606 views
          0 likes
          Last Post Geovanny Suaza  
          Started by Geovanny Suaza, 02-11-2026, 05:51 PM
          0 responses
          353 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
          560 views
          1 like
          Last Post Geovanny Suaza  
          Started by RFrosty, 01-28-2026, 06:49 PM
          0 responses
          561 views
          1 like
          Last Post RFrosty
          by RFrosty
           
          Working...
          X