Announcement

Collapse

Looking for a User App or Add-On built by the NinjaTrader community?

Visit NinjaTrader EcoSystem and our free User App Share!

Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less

Partner 728x90

Collapse

Backtesting Strategy and Optimization

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

    #16
    Q1. I will follow you suggestion and get back to you.

    Q2. Could you please provide an example of how to check if the current bar is the last historical bar.

    Thanks,





    Comment


      #17
      Hello bjunaid,

      Thank you for your reply.

      I provided the example in my previous post:

      if (State == State.Historical && CurrentBar == Count — 2)
      {
      // exit any orders here
      }

      Please let us know if we may be of further assistance to you.
      Kate W.NinjaTrader Customer Service

      Comment


        #18
        Thanks, What is Count — 2? is it(Count - 2)?

        Comment


          #19
          Hello bjunaid,

          Thank you for your reply.

          Yes, looks like something autocorrected it to a dash rather than a minus sign.

          Please let us know if we may be of further assistance to you.
          Kate W.NinjaTrader Customer Service

          Comment


            #20
            If you look at the excel file I attached, I don't think that it was the last bar. Entry was made on 8/14/2020 not on 8/31/2020. My strategy ran from 7/1/2020 to 8/31/2020. Would you know why the strategy never traded after 8/14/2020?
            Last edited by bjunaid; 01-07-2021, 02:28 PM.

            Comment


              #21
              Hi Kate,

              Thanks for answering the questions, I really appreciate your response.

              1. If you look at the excel file I attached, I don't think that it was the last bar. Entry was made on 8/14/2020 not on 8/31/2020. My strategy ran from 7/1/2020 to 8/31/2020. Would you know why the strategy never traded after 8/14/2020? Could this be because of missing data? How can I find out why this would happen?

              Comment


                #22
                Hello bjunaid,

                Thank you for your reply.

                None of your posts in this thread appear to have an attached Excel file. Could you please try posting this again?

                Thanks in advance; I look forward to assisting you further.
                Kate W.NinjaTrader Customer Service

                Comment


                  #23
                  Please see attached.
                  Attached Files

                  Comment


                    #24
                    Hello bjunaid,

                    Thank you for your reply.

                    I don't see that the code you've added is performing the exit on the last historical bar. Could you provide a code sample of your OnBarUpdate method?

                    Thanks in advance; I look forward to assisting you further.
                    Kate W.NinjaTrader Customer Service

                    Comment


                      #25
                      Hi Kate

                      I am asking is that how can the last historical bar be on 8/14/2020 when my strategy parameter is frome 7/1 - 8/31. Shouldn't last historical bar be on 8/31. My last entry was on 8/14.

                      Comment


                        #26
                        Hello bjunaid,

                        Thank you for your reply.

                        What I'm saying is that in those excel files we still see that last position entered on the 14th exited on the 30th by the Exit at End of Session, not by an exit on the last external bar - you can see this in the Orders list. This indicates that the exit logic you're using to exit on the last external bar is not functioning and I would need to see what you've done for that and where it is within OnBarUpdate to assess why this isn't occurring if these excel files are from after you've added that logic. A reduced version that redacts your actual entry conditions would be fine, but we'd need to see an example of the code.

                        Thanks in advance; I look forward to assisting you further.
                        Kate W.NinjaTrader Customer Service

                        Comment


                          #27
                          Hi Kate,

                          I was able to figure out what the error was finally. I was taking the trade at the time my session ended at 3:59pm pm.

                          I have attached my final results and summary page.

                          Thanks for your help.

                          I wan to get a better understanding of the summary page in the strategy analyzer and what numbers are considered acceptable. For example, how do you calculate the Sharp Ratio, what is Risk Free rate used to calculate the Sharpe Ratio, and what is acceptable ratio.
                          Would you be able to provide this info for the following:
                          1. Max Drawdown
                          2. Sharpe Ratio
                          3. Ulcer Index R Squared
                          4. Probability

                          Comment


                            #28
                            Hello bjunaid,

                            Thank you for your reply.

                            You can find information about all of these items on our help guide page below.



                            Please let us know if we may be of further assistance to you.
                            Kate W.NinjaTrader Customer Service

                            Comment

                            Latest Posts

                            Collapse

                            Topics Statistics Last Post
                            Started by alifarahani, Today, 09:40 AM
                            6 responses
                            31 views
                            0 likes
                            Last Post alifarahani  
                            Started by Waxavi, Today, 02:10 AM
                            1 response
                            17 views
                            0 likes
                            Last Post NinjaTrader_LuisH  
                            Started by Kaledus, Today, 01:29 PM
                            5 responses
                            14 views
                            0 likes
                            Last Post NinjaTrader_Jesse  
                            Started by Waxavi, Today, 02:00 AM
                            1 response
                            12 views
                            0 likes
                            Last Post NinjaTrader_LuisH  
                            Started by gentlebenthebear, Today, 01:30 AM
                            3 responses
                            17 views
                            0 likes
                            Last Post NinjaTrader_Jesse  
                            Working...
                            X