Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Any ideas why this is not working correctly please

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

    Any ideas why this is not working correctly please

    I am wondering why thisis not always working. Especially Set 3 and 4.
    Any help would be appreciated.
    Regards

    protected override void OnBarUpdate()
    {
    // Condition set 1
    if (CrossBelow(xxx(4, 8, 40).Signal, xxx(4, 8, 40).Main, 1)
    && Rising(yyy(6, 10, 0)) == true
    && yyy(6, 10, 0)[0] <= 50
    && Rising(Stoch(3, 14, 3).K) == true)
    {
    EnterLong(DefaultQuantity, "Long");
    }

    // Condition set 2
    if (CrossAbove(xxx(4, 8, 40).Signal, xxx(4, 8, 40).Main, 1)
    && Falling(yyy(8, 14, 0)) == true
    && yyy(8, 14, 0)[0] >= 50
    && Falling(Stoch(3, 14, 3).K) == true)
    {
    EnterShort(DefaultQuantity, "Short");
    }
    // Condition set 3
    if (CrossBelow(Exxx(4, 8, 40).Signal, xxx(4, 8, 40).Main, 1)
    && yyy(8, 14, 0)[0] == 100)

    {
    EnterLong(DefaultQuantity, "Long T2");
    }
    // Condition set 4
    if (CrossAbove(xxx(4, 8, 40).Signal, xxx(4, 8, 40).Main, 1)
    && yyy(8, 14, 0)[0] == 0)
    {
    EnterShort(DefaultQuantity, "Short T2");
    }
    }

    #2
    Hi there, what do you mean by "this is not always working"? Are there any specific errors you're getting?
    AustinNinjaTrader Customer Service

    Comment


      #3
      Not so much errors, but not taking entries when I think the criteria are met.

      Comment


        #4
        You can add Print() statements to each condition set to verify if the condition set executes. Maybe something like:
        Code:
        if (CrossAbove(xxx(4, 8, 40).Signal, xxx(4, 8, 40).Main, 1) && yyy(8, 14, 0)[0] == 0)
             {
                 Print("condition set 4 being executed...");
                 EnterShort(DefaultQuantity, "Short T2");
             }
        Now, I'm not sure what your yyy indicator is, but it could be rare that the value returned is exactly 100 or exactly 0, which is how the condition set is setup.
        AustinNinjaTrader Customer Service

        Comment


          #5
          OK.
          I tried >=90 instead of ==100, and <=10 instead of ==0 initially. But this did not work. So I tried the other way. When looking at the value in the Data box it says that it is 100 or 0 when I wanted to use that minimum value. So I thought that this was why it was not working

          Comment


            #6
            Ok, so using == 100 and == 0 would be correct then. Just like I said, I wasn't sure.

            Back to the question: are the print statements being printed?
            AustinNinjaTrader Customer Service

            Comment


              #7
              Yes, no time code though. But I never get a Set 4 trade though.
              With the conditions that I wrote, Is there a time/bar frame that the criteria must be met? Sounds a silly question. But am new at this.
              Maybe this is why it is not triggering

              condition set 3 being executed...
              condition set 2 being executed...
              condition set 1 being executed...
              condition set 2 being executed...
              condition set 2 being executed...
              condition set 2 being executed...
              condition set 3 being executed...
              condition set 2 being executed...
              condition set 2 being executed...

              Comment


                #8
                Originally posted by vast524 View Post
                Yes, no time code though. But I never get a Set 4 trade though.
                With the conditions that I wrote, Is there a time/bar frame that the criteria must be met? Sounds a silly question. But am new at this.
                Maybe this is why it is not triggering
                No, no specific time/bar criteria other than for a CrossAbove() happening within one bar ago, which is typical for a cross over.

                If "condition set 4 being executed" is never printed, that means the conditions are too strict, so the order will never be triggered.
                AustinNinjaTrader Customer Service

                Comment


                  #9
                  So on the whole conditions look ok?
                  In theory all should be met before making a trade?
                  Thanks

                  Comment


                    #10
                    No, you only need the relevant condition to be true to send an order. Set 1's condition needs to be true to submit set 1's order. Set 2's condition needs to be true to submit set 2's order. Set 2's order does not care whether or not set 1's condition is true or not.
                    Josh P.NinjaTrader Customer Service

                    Comment

                    Latest Posts

                    Collapse

                    Topics Statistics Last Post
                    Started by Geovanny Suaza, 02-11-2026, 06:32 PM
                    0 responses
                    650 views
                    0 likes
                    Last Post Geovanny Suaza  
                    Started by Geovanny Suaza, 02-11-2026, 05:51 PM
                    0 responses
                    370 views
                    1 like
                    Last Post Geovanny Suaza  
                    Started by Mindset, 02-09-2026, 11:44 AM
                    0 responses
                    109 views
                    0 likes
                    Last Post Mindset
                    by Mindset
                     
                    Started by Geovanny Suaza, 02-02-2026, 12:30 PM
                    0 responses
                    574 views
                    1 like
                    Last Post Geovanny Suaza  
                    Started by RFrosty, 01-28-2026, 06:49 PM
                    0 responses
                    577 views
                    1 like
                    Last Post RFrosty
                    by RFrosty
                     
                    Working...
                    X