Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

BarsAgo

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

    BarsAgo

    I have searched and read on trying to make the code below only enter long if CCI(7) is at or above 100 for 3 or more bars before CCI(28) is at or above 100, but was unsuccesful at finding a solution that or a solution that made sense. It is vital that it does not just go above, but it must stay above. I looked into MRO, but don't even know if I was going in the right direction. Help is very much appreciated.


    Code:
    if(ADX(8)[0] > 25
                && Rising(ADX(8)) == true
                && CCI(28)[0] >= 100
                && CCI(7)[0] >= 100)
            {
                EnterLong(DefaultQuantity,"");
            }

    #2
    Originally posted by Hammerhorn View Post
    I have searched and read on trying to make the code below only enter long if CCI(7) is at or above 100 for 3 or more bars before CCI(28) is at or above 100, but was unsuccesful at finding a solution that or a solution that made sense. It is vital that it does not just go above, but it must stay above. I looked into MRO, but don't even know if I was going in the right direction. Help is very much appreciated.


    Code:
    if(CurrentBar < 4)
       return;
    if(ADX(8)[0] > 25
                && Rising(ADX(8))
                && CCI(7)[0] >= 100
                && CCI(7)[1] >= 100            
                && CCI(7)[2] >= 100           
                && CCI(28)[0] >= 100
     
                &&  // to avoid pyramiding
                (ADX(8)[1] < ADX(8)[2]
                || CCI(7)[3] < 100           
                || CCI(28)[1] < 100)))
            {
                EnterLong(DefaultQuantity,"");
            }

    Changed the code above.

    Comment


      #3
      Perfect, I was really trying to make it difficult, thank you very much.

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by charlesugo_1, 05-26-2026, 05:03 PM
      0 responses
      60 views
      0 likes
      Last Post charlesugo_1  
      Started by DannyP96, 05-18-2026, 02:38 PM
      1 response
      147 views
      0 likes
      Last Post NinjaTrader_ChelseaB  
      Started by CarlTrading, 05-11-2026, 05:56 AM
      0 responses
      161 views
      0 likes
      Last Post CarlTrading  
      Started by CarlTrading, 05-10-2026, 08:12 PM
      0 responses
      97 views
      0 likes
      Last Post CarlTrading  
      Started by Hwop38, 05-04-2026, 07:02 PM
      0 responses
      284 views
      0 likes
      Last Post Hwop38
      by Hwop38
       
      Working...
      X