Announcement

Collapse

Looking for a User App or Add-On built by the NinjaTrader community?

Visit NinjaTrader EcoSystem and our free User App Share!

Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less

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
    Chris L.NinjaTrader Customer Service

    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");
        }

        Chris L.NinjaTrader Customer Service

        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 judysamnt7, 03-13-2023, 09:11 AM
          4 responses
          53 views
          0 likes
          Last Post DynamicTest  
          Started by ScottWalsh, Today, 06:52 PM
          4 responses
          33 views
          0 likes
          Last Post ScottWalsh  
          Started by olisav57, Today, 07:39 PM
          0 responses
          5 views
          0 likes
          Last Post olisav57  
          Started by trilliantrader, Today, 03:01 PM
          2 responses
          19 views
          0 likes
          Last Post helpwanted  
          Started by cre8able, Today, 07:24 PM
          0 responses
          6 views
          0 likes
          Last Post cre8able  
          Working...
          X