Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Problem with backtests

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

    Problem with backtests

    Hello :-)
    I have a problem with Backtesting. For example, if I want to start a position at the end of trading day 18:50 CDT and hold it to the next day, the backtest fails. I have tried to test from 2012-2014 and it shows me only 46 trades (from 550)! There aren't any parameters, only opening time and profit target. So it must open every day at the same time. If I choose 19:10 CDT or higher, it works well and 550 Trades are done. The option "Exit on close" is false.

    Thank you for helping me and greetings from Poland :-)

    #2
    Hello Uwe1981,

    Welcome to the NinjaTrader Support Forums!

    Could you clarify what time frame you are using to backtest your strategy and how you are entering your orders in your backtest?
    JCNinjaTrader Customer Service

    Comment


      #3
      I'm not sure about your timezone because I'm from Poland. In my case and timezone (GMT +1:00) any overnight position doesn't work in backtest, only intraday from 00:10 to 23:10. If I try from 23:10 to 0:10 for example it doesn't work. Please take a look to the picture, at all the time frame is missing on chart. The two backtest results are made from 0:10 intraday (works well) and from 23:40 overnight (fails) without any additional conditions. Look at the difference of done trades, only 46 trades are executed, where program has instructions to open the position every day at the same time with a market order.
      Attached Files
      Last edited by Uwe1981; 04-02-2014, 11:15 AM.

      Comment


        #4
        Hello Uwe1981,

        What are your conditions before you are entering a trade?

        For example:

        if (ToTime(Time[0]) >= 93000 && ToTime(Time[0]) < 120000)
        {

        // Do something like enter long
        }
        JCNinjaTrader Customer Service

        Comment


          #5
          protected override void OnBarUpdate()
          {
          // Condition set 1
          if (ToTime(Time[0]) == ToTime(23, 40, 0))
          {
          EnterLong(ContractVolume, "");
          }


          }

          Comment


            #6
            Hello Uwe1981,

            Thanks for the snippet.

            Given your Time Zone (NinjaTrader's Charts and Script calculations are going to be based off of your Local PC Clock) I would not expect any trades to occur using that condition since trading would be closed at that time if I am correct.

            If I am doing my Time Zone conversions correct trading should be halted in Poland for the ES from 23:15 to 00:00. So trying to enter a trade when the time is equal to 23:40 would never occur.

            You may want to try to change your condition to something like:

            if (ToTime(Time[0]) == ToTime(23, 00, 0))
            {
            EnterLong(ContractVolume, "");
            }

            Let me know if that works better for you.
            JCNinjaTrader Customer Service

            Comment


              #7
              Ok, it works, thank you for support :-) I didn't know that there is a break at night. I thought that the ES is available from sunday to friday without breaks.
              Now I have kicked the wizzard and written an own code. And here's the next problem: I can't backtest it. If I open the backtest window it's white and without any options. What could it be?

              Comment


                #8
                Hello Uwe1981,

                Could you attach a screenshot of what you are seeing in your Strategy Analyzer?
                JCNinjaTrader Customer Service

                Comment


                  #9
                  You won't see anything. It goes like this: I'm clicking in the left menu "ES 06-14 --> Backtest". The option window on the right side is coming out with his default settings "SampleATMStrategy". If I change it to my strategy the window doesn't change the setting options. On every other strategy done with the wizzard it works well. I can send you the file if you want.
                  Last edited by Uwe1981; 04-03-2014, 11:36 PM.

                  Comment


                    #10
                    Here is the screenshot and another with the next problem. Today in the morning I've tried to make another strategy with the wizzard. As you kann see, the strategy is missing in the backtest menu. I have deleted and written down once again with the same results. Now even the wizzard doesn't work
                    Attached Files
                    Last edited by Uwe1981; 04-03-2014, 11:36 PM.

                    Comment


                      #11
                      Ok, I have helped myself :-) There was a problem with the initialization. Now it works.

                      Comment

                      Latest Posts

                      Collapse

                      Topics Statistics Last Post
                      Started by Christopher_R, Today, 12:29 AM
                      0 responses
                      7 views
                      0 likes
                      Last Post Christopher_R  
                      Started by sidlercom80, 10-28-2023, 08:49 AM
                      166 responses
                      2,235 views
                      0 likes
                      Last Post sidlercom80  
                      Started by thread, Yesterday, 11:58 PM
                      0 responses
                      3 views
                      0 likes
                      Last Post thread
                      by thread
                       
                      Started by jclose, Yesterday, 09:37 PM
                      0 responses
                      7 views
                      0 likes
                      Last Post jclose
                      by jclose
                       
                      Started by WeyldFalcon, 08-07-2020, 06:13 AM
                      10 responses
                      1,415 views
                      0 likes
                      Last Post Traderontheroad  
                      Working...
                      X