Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

When is a bar "Historical"?

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

    When is a bar "Historical"?

    I have a strategy that has the following line at the top of the subroutine that submits an order:

    if (Historical) return;

    So, if you are refreshing the chart or it's processing back-data, it should not continue in the subroutine and not submit any orders, right?

    However, I have a customer that when they put this strategy on a chart, or press F5 to refresh the chart, it DOES submit orders for all of the historical bars on the chart! How can these bars bypass the above code? When is a bar considered "historical" -- because in this one customer's case, NONE of the bars on the chart seem to be Historical bars!

    Thanks!
    Bryan

    #2
    I'm not certain, but I think there was a post recently about something related to this, as this sounds familiar.






    Originally posted by cassb View Post
    I have a strategy that has the following line at the top of the subroutine that submits an order:

    if (Historical) return;

    So, if you are refreshing the chart or it's processing back-data, it should not continue in the subroutine and not submit any orders, right?

    However, I have a customer that when they put this strategy on a chart, or press F5 to refresh the chart, it DOES submit orders for all of the historical bars on the chart! How can these bars bypass the above code? When is a bar considered "historical" -- because in this one customer's case, NONE of the bars on the chart seem to be Historical bars!

    Thanks!
    Bryan

    Comment


      #3
      Originally posted by cassb View Post
      I have a strategy that has the following line at the top of the subroutine that submits an order:

      if (Historical) return;

      So, if you are refreshing the chart or it's processing back-data, it should not continue in the subroutine and not submit any orders, right?

      However, I have a customer that when they put this strategy on a chart, or press F5 to refresh the chart, it DOES submit orders for all of the historical bars on the chart! How can these bars bypass the above code? When is a bar considered "historical" -- because in this one customer's case, NONE of the bars on the chart seem to be Historical bars!

      Thanks!
      Bryan
      Are you using unmanaged orders?

      Comment


        #4
        No, this strategy uses ATMs to manage the orders once they are placed.

        But this customer does use IB as their broker... hmm... could that have something to do with it?

        Sync Account position is False.
        Wait Until Flat Before Executing Live is True.

        Comment


          #5
          Hi Bryan, is this a single or multiseries script you're using here?

          Generally when using the historical property in a strategy that is running with "Wait until flat before executing live", it will return "true" until the strategy reaches a flat state and switches to live executions.

          Comment


            #6
            Originally posted by NinjaTrader_Bertrand View Post
            Hi Bryan, is this a single or multiseries script you're using here?

            Generally when using the historical property in a strategy that is running with "Wait until flat before executing live", it will return "true" until the strategy reaches a flat state and switches to live executions.
            This is a single series script. My customer sent a trace and log file into the support email last night to Matthew. Can you please take a look at that and help us figure this out? This is crazy, and something I have not come across before.

            Thanks!
            Bryan

            Comment


              #7
              Sure Bryan, I'll check into this ticket as well and get back to you.

              Comment


                #8
                Bryan, could you please PM me the name of your customer and potentially the ticket # he got assigned by our system as well?

                Thanks,

                Comment


                  #9
                  Brian, was able to locate the commnication - didn't spot anything unusual in the the files though, is the script run on CalculateOnBarClose = false? WaitUntilFlat would allow the orders to be sent since the ATM Strategies would not backtest, therefore no historical position to be going first flat from. It looks like an order is generated on the same moment / tick as the strategy sees real-time data to me. Have you tried returning earlier out of the OnBarUpdate() so signals are also not calculated historically, but start the process when this is only run live?

                  Comment

                  Latest Posts

                  Collapse

                  Topics Statistics Last Post
                  Started by Geovanny Suaza, 02-11-2026, 06:32 PM
                  0 responses
                  656 views
                  0 likes
                  Last Post Geovanny Suaza  
                  Started by Geovanny Suaza, 02-11-2026, 05:51 PM
                  0 responses
                  371 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
                  579 views
                  1 like
                  Last Post RFrosty
                  by RFrosty
                   
                  Working...
                  X