Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

simple strategy to enter at CCI cross +45/-45

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

    simple strategy to enter at CCI cross +45/-45

    This is to make a simple strategy to enter Long when CCI cross a certain value like +45 or vice versa for -45. I believe this code will enter Long when CCI crosses zero? sorry guys I am brand new to coding, so need some help.
    Any help is appreciated

    protected override void OnBarUpdate()
    {
    // Condition set 1
    if (CrossAbove(Close, CCI(14), 1))
    {
    EnterLong(DefaultQuantity, "");
    }

    // Condition set 2
    if (CrossBelow(Close, CCI(14), 1))
    {
    EnterShort(DefaultQuantity, "");
    }
    }

    #2
    Hello,

    You would need to make this change:

    protected override void OnBarUpdate()
    {
    // Condition set 1
    if (CrossAbove(45, CCI(14), 1))
    {
    EnterLong(DefaultQuantity, "");
    }

    // Condition set 2
    if (CrossBelow(-45, CCI(14), 1))
    {
    EnterShort(DefaultQuantity, "");
    }
    }
    BrettNinjaTrader Product Management

    Comment


      #3
      thks Brett. but when i run strategy wizard, don't I need to choose Price close in left side when i choose CCI in right side?

      Comment


        #4
        Hello,

        This is correct. This is camparing the current price will cross above or below the current CCI value. Which is not what you want.

        You need to use Misc -> Numberic Value
        BrettNinjaTrader Product Management

        Comment


          #5
          Thks Brett

          Comment


            #6
            Brett - sorry, am not clear. which side should I choose
            Misc -> Numberic Value
            choose CCI in both sides, then give Misc -> Numberic Value in right side of CCI value?

            Comment


              #7
              Hello,

              Use CCI only on the one side and then the numeric value on ther other side.

              Let me know if I can be of further assistance.
              BrettNinjaTrader Product Management

              Comment

              Latest Posts

              Collapse

              Topics Statistics Last Post
              Started by Geovanny Suaza, 02-11-2026, 06:32 PM
              0 responses
              672 views
              0 likes
              Last Post Geovanny Suaza  
              Started by Geovanny Suaza, 02-11-2026, 05:51 PM
              0 responses
              379 views
              1 like
              Last Post Geovanny Suaza  
              Started by Mindset, 02-09-2026, 11:44 AM
              0 responses
              111 views
              0 likes
              Last Post Mindset
              by Mindset
               
              Started by Geovanny Suaza, 02-02-2026, 12:30 PM
              0 responses
              575 views
              1 like
              Last Post Geovanny Suaza  
              Started by RFrosty, 01-28-2026, 06:49 PM
              0 responses
              582 views
              1 like
              Last Post RFrosty
              by RFrosty
               
              Working...
              X