Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Time Discrepancy Strategy Analyzer Execution

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

    #16
    Originally posted by sburtt View Post
    I am using windows 7 ultimate. I am based in london (GMT+0), my PC time zone is set to (UTC) Dublin, Edinburgh, Lisbon, London, whilst internet time is set to time.nist.gov

    Basically what I see is that back testing results in Strategy Analyzer are correct in execution time (GMT), whilst real time trading is reporting executions of trades 1 hour in advanced, as if the internal clock is set to (GMT -1). Basically if I enter a trade at 1pm, the execution tab is reporting 12am.

    Very weird.
    Sounds like a Daylight Savings Time issue. Get the most current updates that M$ has made to DST definitions.

    Comment


      #17
      Originally posted by koganam View Post
      Sounds like a Daylight Savings Time issue. Get the most current updates that M$ has made to DST definitions.
      sound the more reasonable answer, I've installed all updates, lets see if it persists. Thanks for you help

      Comment


        #18
        this time issue is getting even worst.. i run strategies that enter/exit every 1h, and now system is trading at quarter past.. I was just wondering why should internet time be set to time.nist.gov, I am not based in US, shouldn't this be best set to time.windows.com?

        Comment


          #19
          I just notced that I can untick the box next to Syncronize with an Internet time server,would this solve my issue? I am currently set on Sync mode

          Comment


            #20
            Hello,

            When you use minute chart is it also off by an hour?

            Please provide me with an image of your chart showing both 1 minute and 60 minute bars along with the most current time stamp. Also include your PC clock time at the time of these pictures
            To send a screenshot press Alt + PRINT SCREEN to take a screen shot of the selected window. Then go to Start--> Accessories--> Paint, and press CTRL + V to paste the image. Lastly, save as a jpeg file and send the file as an attachment.
            For detailed instructions please visit the following link

            * http://take-a-screenshot.org/
            LanceNinjaTrader Customer Service

            Comment


              #21
              Originally posted by NinjaTrader_Lance View Post
              Hello,

              When you use minute chart is it also off by an hour?

              Please provide me with an image of your chart showing both 1 minute and 60 minute bars along with the most current time stamp. Also include your PC clock time at the time of these pictures
              To send a screenshot press Alt + PRINT SCREEN to take a screen shot of the selected window. Then go to Start--> Accessories--> Paint, and press CTRL + V to paste the image. Lastly, save as a jpeg file and send the file as an attachment.
              For detailed instructions please visit the following link

              * http://take-a-screenshot.org/
              Lance, the charts are not an issue, they look fine (see attached), execution is the issue, I am using the same model i've been using for the past month, but today it enter trades at 22:15:01, this should of been 22:00 or close to this, as the model is trading on 60min candles, how could this be possible with CalculateOnBarClose = true;?

              Only thing I can think is that some kind of internal Pc/NT clock is not set correctly in my win7, see attached also my clock settings. Please advise.
              Attached Files

              Comment


                #22
                What does the NinjaTrader Execution tab time show? This image is for IB.

                Also what type of order is being placed?

                What session template is being used?

                For the time server you'll want to use time.nist.gov instead of the windows server.
                LanceNinjaTrader Customer Service

                Comment


                  #23
                  Lance,

                  to answer to your questions:

                  What does the NinjaTrader Execution tab time show? Not possible as I've rebooted;

                  Also what type of order is being placed? Order Type: Market

                  What session template is being used? see attached


                  However, please notice that after changing the settings to the ones reported in my prev post it seems working properly. Please correct me if wrong, but I think there will always be 1h lag between real time execution and back-testing execution, this is given by the fact that in back-testing the system will only enter a trade at the end of a set-up period, basically at the open of the next candle, please see chart attached to understand what I mean. If this is true, is there any way to code the strategy in order to have exactly the same entry both in real time and in back testing? Let me know if this query is clear

                  Moreover, is there any reason for using time.nist.gov instead of the windows server?
                  Attached Files

                  Comment


                    #24
                    Hello sburtt,

                    You may use intrabar granularity to help with Historical Fills to be more like real-time fills. Here is a link to a reference sample that you may view.
                    You can submit orders to different Bars objects. This allows you the flexibility of submitting orders to different timeframes. Like in live trading, taking entry conditions from a 5min chart means executing your order as soon as possible instead of waiting until the next 5min bar starts building. You can achieve this by


                    As for the time server, typically more servers use the "time.nist.gov" to synchronize their server clocks so that they will match more precisely.
                    JCNinjaTrader Customer Service

                    Comment


                      #25
                      HI JC

                      first of all let me thank you, now I see only 1 min difference between back-testing (Strategy Analyzer) and real time execution. However, I have a few questions:

                      1. I noticed that despite the difference in time execution, the price execution is exactly the same as before (see attached). Is this due to the fact that the strategy executes trades on the primary bar series (in my case 60min) rather than the secondary bar series (1 minute)? If the answer is yes, what exactly is the sense of this? Please enlighten me if I am missing something/doing something wrong, I've attached the strategy I am using so that you know what I am doing, I've hidden the exact indicator (but basically It's not different from a moving average crossover);

                      2. Using intrabar granularity in real time trading. Wouldn't this give exactly the same/very similar result as setting CalculateOnBarClose = false (rather than CalculateOnBarClose = true)?

                      Thanks,
                      Attached Files

                      Comment


                        #26
                        Hello sburtt,

                        Thank you for your response.

                        Your calculations are still being done on the 60 minute bar (BarsInProgress == 0). You can use the same idea behind submitting your orders to a smaller time frame to have your logic calculated on the smaller time frame as well.

                        Please let me know if you have any questions.

                        Comment


                          #27
                          Originally posted by NinjaTrader_JC View Post
                          Hello sburtt,

                          You may use intrabar granularity to help with Historical Fills to be more like real-time fills. Here is a link to a reference sample that you may view.
                          You can submit orders to different Bars objects. This allows you the flexibility of submitting orders to different timeframes. Like in live trading, taking entry conditions from a 5min chart means executing your order as soon as possible instead of waiting until the next 5min bar starts building. You can achieve this by


                          As for the time server, typically more servers use the "time.nist.gov" to synchronize their server clocks so that they will match more precisely.
                          Hi JC, pls could you have a look at my last post and reply to both points when you have the chance. Thanks appreciate

                          Comment


                            #28
                            Hello sburtt,

                            1. Well the order is submitted in the Primary Data Series, yes, since this it is being submitted the Price is going to be the same. The reasoning behind this is so that you can have an order filled within a Primary (60min) bar. Since it is historical data that you are running it against it will only have the OHLC data so the order will get placed on the next bar. The Intrabar method will help you get the order filled in a smaller time frame more closely to it would in real-time environment.

                            2. Not they way it is setup inside the example and your code. The Strategy is only be calculated when BarsInProgress (BIP) is equal to 0 or your 60min time frame so it still would be the same as COBC = true. Your order however are being submitted to the 1 min time frame so that can be filled within 60 min depending on the price movement just like it would in a real-time environment since order updates and executions would come from a broker server and not be a specific timed event.

                            Note if you add "TraceOrders = true;" inside of the Initialize() method this may become more clear in the Output Window (Tools->Output Window).


                            Let me know if you have any additional questions or if I can clarify anything more for you.
                            JCNinjaTrader Customer Service

                            Comment


                              #29
                              Originally posted by NinjaTrader_JC View Post
                              Hello sburtt,

                              1. Well the order is submitted in the Primary Data Series, yes, since this it is being submitted the Price is going to be the same. The reasoning behind this is so that you can have an order filled within a Primary (60min) bar. Since it is historical data that you are running it against it will only have the OHLC data so the order will get placed on the next bar. The Intrabar method will help you get the order filled in a smaller time frame more closely to it would in real-time environment.

                              2. Not they way it is setup inside the example and your code. The Strategy is only be calculated when BarsInProgress (BIP) is equal to 0 or your 60min time frame so it still would be the same as COBC = true. Your order however are being submitted to the 1 min time frame so that can be filled within 60 min depending on the price movement just like it would in a real-time environment since order updates and executions would come from a broker server and not be a specific timed event.

                              Note if you add "TraceOrders = true;" inside of the Initialize() method this may become more clear in the Output Window (Tools->Output Window).


                              Let me know if you have any additional questions or if I can clarify anything more for you.

                              JC thanks for coming back on this post.

                              Regarding point 1: do you think it would be possible to program the strategy in order to use the open of the primary data series (60min in this case) as price fill on the market order ( rather than using the close as it is currently doing)? This would be very close to what the strategy does in real time, as in real time it would enter on the open price and not 1 hour delayed as the backtesting suggests; this would really help improve backtesting;

                              Regarding point 2. I was actually refering to the original code i posted at the beginning of this thread;

                              Thanks again, John

                              Comment


                                #30
                                Hello John,

                                The calculation are done at the close of every bar which is the same tick as the open of the next bar so it will be entered at the close of the bar that it is called which is the open of the next bar. This should be similar to running the Strategy with COBC = true in real-time data.

                                If you would like to defining a price like that you may have to use a limit order for this.


                                As for the second part thanks for clarifying, it should not effect a real-time strategy for the same reason that it will only process in BIP = 0.
                                JCNinjaTrader Customer Service

                                Comment

                                Latest Posts

                                Collapse

                                Topics Statistics Last Post
                                Started by mattbsea, Today, 05:44 PM
                                0 responses
                                4 views
                                0 likes
                                Last Post mattbsea  
                                Started by RideMe, 04-07-2024, 04:54 PM
                                6 responses
                                31 views
                                0 likes
                                Last Post RideMe
                                by RideMe
                                 
                                Started by tkaboris, Today, 05:13 PM
                                0 responses
                                2 views
                                0 likes
                                Last Post tkaboris  
                                Started by GussJ, 03-04-2020, 03:11 PM
                                16 responses
                                3,282 views
                                0 likes
                                Last Post Leafcutter  
                                Started by WHICKED, Today, 12:45 PM
                                2 responses
                                20 views
                                0 likes
                                Last Post WHICKED
                                by WHICKED
                                 
                                Working...
                                X