Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Live execution horribly different from Backtesting

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

    Live execution horribly different from Backtesting

    Hi,
    I have a strategy that executes perfectly in backtesting. It enters correctly with the correct # of contracts that were calcuated. It sets the target and stop correctly and exits correctly.
    I started trading (sim) live and the strategy enters at the correct time/price but with 1 contract and not the # calculated in the strategy. Then it sets the stop and target and exits 3 seconds after the entry fo no reason at all.
    Why is the live trading not following the strategy like the backtesting does????
    I am testing on the same contracts.

    #2
    mlbalch, which contacts and timeframes are you testing this on?

    Are there any errors in the log tab when this unexpected behavior occurs?

    Are you working already with TraceOrders to debug the realtime order behavior you see?

    BertrandNinjaTrader Customer Service

    Comment


      #3
      Bertrand,

      It is the ES12-09 contract and I am installing trace orders and I started the recorder so I can watch monday. The log looks ok except that the exit order is not supposed to happen.

      Comment


        #4
        Ok, sounds good the trace orders would help you decipher where the exit order came from - I believe we've been throught this via mails, but you're sure strategy vs account positions are in sync as you start it up for live trading, correct?

        BertrandNinjaTrader Customer Service

        Comment


          #5
          Yes on both.

          Comment


            #6
            Ok, then please report back your findings and post the trace orders output so we can take a look. Thanks
            BertrandNinjaTrader Customer Service

            Comment


              #7
              I was just studying the log and I have some questions about it. After the entry,I see the stop and target orders to enter submitted, accepted, and the Target working. On each of the lines it shows Action=Sell Limit price=1057.25 Stop price=0........Then the Stop line has 0 on the Limit and 1047.25 on the stop. I think this is all normal from the looks of it.
              Then the very next lines start Pending Submit....Action=Sell Limit price=0 Stop price=0. Then Accepted, working, and filled.
              This has got to be the problem. Where is the order Limit and Stop =0 coming from?
              That is what is causing the incorrect exit.

              Comment


                #8
                You would need to print out all stop prices and stop modifications you do from the strategy and compare, are Set() or Exit() methods used?

                BertrandNinjaTrader Customer Service

                Comment


                  #9
                  After the entry, there is 1 hard stop and 1 hard target set. the method is ExitLongLimit() and ExitLongStop() or Short depending on the position.

                  Comment


                    #10
                    Suggest you follow Bertrand's suggestion of printing the actual stop/target price modifications so you can see what the order is doing along the way.
                    Josh P.NinjaTrader Customer Service

                    Comment


                      #11
                      I am going to try the printing of the stops etc....
                      However, I still have a question that has not been answered. Please....How can the strategy work perfectly in backtesting on the same day with the same data, but did not work at all like it should in realtime that day??

                      Comment


                        #12
                        Please read this article: http://www.ninjatrader-support.com/H...TimeVsBacktest
                        Josh P.NinjaTrader Customer Service

                        Comment


                          #13
                          I have actually read that article before, but I do not think it applies. I am not saying that the backtesting produced positive results and the realtime produced bad or different results. There is an order being submitted and executed 3 seconds after entry to exit the postion that is not in the strategy or backtesting at all. I am asking why the backtest on the same day (today) and data "executes" properly (forget whether it is postive or negative) and the realtime does not execute the strategy correctly.

                          Comment


                            #14
                            mlbalch, if you post the code we can take a quick look and see if anything looks out of place. Other than that, this is up to you to debug and figure out what is going wrong here.
                            AustinNinjaTrader Customer Service

                            Comment


                              #15
                              Thanks Bertrand, josh, and Kyle.
                              I can't post the code, however I think my developer found the issue and I will share it here in case anyone else has a similar situation.
                              We originally had the code move the stop up after the close of the entry bar 0. The stop was calculated normally with avg -/+ stop points, but he put in an extra stop (mrkt) on bar 0 in case the mrkt turned quickly and went fast. In a few instances (just happened to be the 1st 2 days of my realtime test) the mrkt stop is executed. He found this b/c Monday and today the strategy worked properly. So we removed the extra stop and it should be ok from now on.
                              I hope this helps.

                              Comment

                              Latest Posts

                              Collapse

                              Topics Statistics Last Post
                              Started by llanqui, Yesterday, 03:51 PM
                              6 responses
                              26 views
                              0 likes
                              Last Post NinjaTrader_Gaby  
                              Started by tradingnasdaqprueba, Today, 03:42 AM
                              8 responses
                              32 views
                              0 likes
                              Last Post tradingnasdaqprueba  
                              Started by manueldecastro, Today, 01:16 PM
                              0 responses
                              1 view
                              0 likes
                              Last Post manueldecastro  
                              Started by AlgoDreamer, Today, 12:39 PM
                              2 responses
                              8 views
                              0 likes
                              Last Post AlgoDreamer  
                              Started by ninza33, Today, 12:31 PM
                              1 response
                              4 views
                              0 likes
                              Last Post NinjaTrader_LuisH  
                              Working...
                              X