Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Access to multiple bars under certain conditions

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

    #16
    Hello Tradeer,

    Looks good. Next, set TraceOrders = true; in OnStateChange() when State is State.Configure and re-run.

    What date and time are you expecting an entry order and the order is not submitted?

    The first time I am seeing this condition as true is 23.12.2021 05:35.
    23.12.2021 05:35:00 | spanLong: 3 >= 2 && High[0]: 35658 >= highSeries[1]: 35657
    Chelsea B.NinjaTrader Customer Service

    Comment


      #17
      Originally posted by NinjaTrader_ChelseaB View Post
      Hello Tradeer,

      Looks good. Next, set TraceOrders = true; in OnStateChange() when State is State.Configure and re-run.

      What date and time are you expecting an entry order and the order is not submitted?

      The first time I am seeing this condition as true is 23.12.2021 05:35.
      23.12.2021 05:35:00 | spanLong: 3 >= 2 && High[0]: 35658 >= highSeries[1]: 35657
      Yes, that is correct.
      The first trade is executed correctly, after that they are executed incorrectly.
      I have set TraceOrders to true but it has not changed anything.
      Hmm, strange. It must have something to do with how the orders are executed or the condition after the 1 trade is no longer executed for some reason.
      I am trying to find the error.
      Do you have a solution maybe?
      Thanks

      Kind regards
      Tradeer

      Comment


        #18
        Hello Tradeer,

        Was TraceOrders set to true in State.Configure as directed (or did you put this in State.SetDefaults?)
        Have you re-run the script?

        I was not able to confirm, what date and time are you expecting an entry order and the order is not submitted?
        Chelsea B.NinjaTrader Customer Service

        Comment


          #19
          Originally posted by NinjaTrader_ChelseaB View Post
          Hello Tradeer,

          Was TraceOrders set to true in State.Configure as directed (or did you put this in State.SetDefaults?)
          Have you re-run the script?

          I was not able to confirm, what date and time are you expecting an entry order and the order is not submitted?
          Hey Chelsea,

          it is set in Sate.Configure the TracOrders.

          Code:
           else if (State == State.Configure)
          {
          SetProfitTarget("", CalculationMode.Ticks, 20);
          SetStopLoss("", CalculationMode.Ticks, 20, false);
          TraceOrders = true;
          
          }
          I have to look at it again it bit confusing the trace orders.
          At 7:10 an order is received that actually does not belong there.
          I have attached the text file

          Click image for larger version

Name:	StateConfigure.JPG
Views:	81
Size:	106.2 KB
ID:	1183243





          Click image for larger version

Name:	Entry at 0535 LONG.JPG
Views:	83
Size:	36.3 KB
ID:	1183240Click image for larger version

Name:	710 715 Entry LONG wrong.JPG
Views:	80
Size:	236.5 KB
ID:	1183241

          Comment


            #20
            Hello Tradeer,

            What is the output showing at 7:00?

            Can you provide the output text file?
            Chelsea B.NinjaTrader Customer Service

            Comment


              #21
              Originally posted by NinjaTrader_ChelseaB View Post
              Hello Tradeer,

              What is the output showing at 7:00?

              Can you provide the output text file?
              Hey Chelsea,

              the text file was already pinned.

              Click image for larger version  Name:	Output Screenshot.JPG Views:	0 Size:	292.3 KB ID:	1183265
              Last edited by Tradeer; 12-27-2021, 12:57 PM.

              Comment


                #22
                Hello Tradeer,

                Thank you for the output.

                The output shows:
                "23.12.2021 07:00:00 | spanLong: 1 >= 2 && High[0]: 35664 >= highSeries[1]: 35665"

                I would not expect this condition to evaluate as true as 1 is not greater than or equal to 2.

                Are you certain the order method is being called from the action block of this condition?

                Do you have multiple order methods in the code that are not in this condition?
                Chelsea B.NinjaTrader Customer Service

                Comment


                  #23
                  Originally posted by NinjaTrader_ChelseaB View Post
                  Hello Tradeer,

                  Thank you for the output.

                  The output shows:
                  "23.12.2021 07:00:00 | spanLong: 1 >= 2 && High[0]: 35664 >= highSeries[1]: 35665"

                  I would not expect this condition to evaluate as true as 1 is not greater than or equal to 2.

                  Are you certain the order method is being called from the action block of this condition?

                  Do you have multiple order methods in the code that are not in this condition?
                  Hey Chelsea,

                  thanks for your reply. I have found the error. If I do not save the condition as a separate boolean it works only with the first trade for whatever reason.
                  If I make the entry directly after the condition it works.


                  "Are you certain the order method is being called from the action block of this condition?" I'm not sure

                  But it works now thank you for your companionship.

                  With kind regards
                  Tradeer

                  Code:
                  if (spanLong >= 2 && High[0] >= highSeries[1])
                  {
                  EnterLong(1, "-------LONG-------");
                  }
                  Last edited by Tradeer; 12-27-2021, 01:30 PM.

                  Comment

                  Latest Posts

                  Collapse

                  Topics Statistics Last Post
                  Started by NullPointStrategies, Yesterday, 05:17 AM
                  0 responses
                  66 views
                  0 likes
                  Last Post NullPointStrategies  
                  Started by argusthome, 03-08-2026, 10:06 AM
                  0 responses
                  141 views
                  0 likes
                  Last Post argusthome  
                  Started by NabilKhattabi, 03-06-2026, 11:18 AM
                  0 responses
                  76 views
                  0 likes
                  Last Post NabilKhattabi  
                  Started by Deep42, 03-06-2026, 12:28 AM
                  0 responses
                  47 views
                  0 likes
                  Last Post Deep42
                  by Deep42
                   
                  Started by TheRealMorford, 03-05-2026, 06:15 PM
                  0 responses
                  51 views
                  0 likes
                  Last Post TheRealMorford  
                  Working...
                  X