• If this is your first visit, you will have to register before you can post. To view messages, please scroll below and select the forum that you would like to visits. Questions? Be sure to check out the Forum FAQ.

Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Strategy stop loss bug in playback

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

    Strategy stop loss bug in playback

    Somebody from NT support is helping with this, but I wanted to see if the community could help me out a little faster.

    I'm seeing strange behavior with my stops when I run strategies in playback. Please see the attached chart screencap for the contract and data series - you'll also see the playback period I used.

    The strategy (attached) I ran was a simple test strategy sent to me by NT support. It simply continuously enters a single long position with a SL and PT of 10. I'm running NT version 8.0.12, and this happened on 8.0.11 as well.

    Notice on the right side of the chart there are multiple orders stacked up on one bar. The range of that bar is 2 ticks and the strategy SL is 10 ticks, so the stop should not trigger multiple times in this bar. The best way to find one of these scenarios is to run the playback over a few days, export the "trades" display of the performance summary, and search the profit column in excel for any losses that are 1 or 2 ticks.

    At first it seemed like NT was treating my one-lot exit as several separate fills, all added up equaling the appropriate gross gain/loss. For instance, many of these multiple order scenarios happen 10 at a time, showing 1 tick P/L each on the performance summary. That might end up with a correct gross P/L, but it causes a big discrepancy when you calculate commissions or number of trades.

    But looking further, I found that it doesn't always add up to the correct number of "fills" to equal one contract. The chart screen cap shows five stop orders that correspond to the highlighted rows on the attached spreadsheet (this is based on the millisecond value of the exit time - which you can't see due to excel formatting).

    To add further confusion, you can see the trade shown on the chart is entered at 6260.50 (above the high of the current bar), and exited at 6259.50, which is only 8 ticks. This cannot be slippage according to the chart because the bar never went lower than the exit.

    Can somebody please help?
    Attached Files

    #2
    Hello pen15,

    Thank you for your note.

    Perhaps this sample was produced to demonstrate a certain behavior but its not how you should submit a PT and SL.

    <REMOVED, INCORRECT>

    Since you are not dynamically changing your stop, you should submit your stop and profit calls in State.Configure. Please see the following section of our Helpguide,

    https://ninjatrader.com/support/help...ofittarget.htm

    Please let us know if you need further assistance.
    Last edited by NinjaTrader_AlanP; 02-07-2018, 11:26 AM.
    Alan P.NinjaTrader Customer Service

    Comment


      #3
      Thanks. This strategy was given to me by NT support to test this very thing - stop losses that didn't make sense. I'm still getting strange stops running a strategy I just created in the wizard and didn't alter. Do you have a strategy I can test?

      Originally posted by NinjaTrader_AlanP View Post
      Hello pen15,

      Thank you for your note.

      Perhaps this sample was produced to demonstrate a certain behavior but its not how you should submit a PT and SL.

      The issue is that the stop and profit target are being based off a previous entry, not the current entry. For example calling setstoploss/pt before the entry, is going to be ignored as no position exists, and likely is being called on the next bar even before NT has time to register that the current position is filled.

      Since you are not dynamically changing your stop, you should submit your stop and profit calls in State.Configure. Please see the following section of our Helpguide,

      https://ninjatrader.com/support/help...ofittarget.htm

      Please let us know if you need further assistance.

      Comment


        #4
        Hello pen15,

        Below are links to three examples correctly submitting stop loss orders.

        https://ninjatrader.com/support/foru...ead.php?t=3222
        https://ninjatrader.com/support/foru...ead.php?t=3751
        https://ninjatrader.com/support/foru...ead.php?t=5790

        Strategies built in the builder using SetStopLoss/PT should have their calls in State.Configure and thus should not exhibit unexpected behavior. If you'd like to upload a copy of the script with details of what you are seeing vs what you are expected we can take a look.

        Please let us know if you need further assistance.
        Alan P.NinjaTrader Customer Service

        Comment


          #5
          Thanks, Alan. The attached .cs was made with the builder and I altered the entry condition to enter if flat. Should this be giving the results you see in the attached screenshots? The multiple orders you see on the single bar on the chart correspond to the orange rows in the spreadsheet (all in the same millisecond). The range of that particular bar is 3 ticks so it shouldn't be entering and stopping out on the same bar.
          Thanks,
          Matt

          [EDIT] The attached cs is set to calculate on each tick, but the screenshots were from running it with calculate on bar close. I get the same issues either way though.

          Originally posted by NinjaTrader_AlanP View Post
          Hello pen15,

          Below are links to three examples correctly submitting stop loss orders.

          https://ninjatrader.com/support/foru...ead.php?t=3222
          https://ninjatrader.com/support/foru...ead.php?t=3751
          https://ninjatrader.com/support/foru...ead.php?t=5790

          Strategies built in the builder using SetStopLoss/PT should have their calls in State.Configure and thus should not exhibit unexpected behavior. If you'd like to upload a copy of the script with details of what you are seeing vs what you are expected we can take a look.

          Please let us know if you need further assistance.
          Attached Files
          Last edited by pen15; 02-07-2018, 11:25 AM.

          Comment


            #6
            Hello pen15,

            I was incorrect with what I mentioned in my 1st post about SetProfitTarget/SetStopLoss being ignored, my understanding of how set works was false and was cleared up by Chelsea, who you are working with in another ticket already.

            I am unable to replicate and as you are already working with Chelsea on this issue I will close this thread.

            Please let us know if you need further assistance.
            Alan P.NinjaTrader Customer Service

            Comment


              #7
              Thanks Alan, but I opened this thread (with the permission of Chelsea) so that I could hopefully get a response from the community as well. It's a slow process going back and forth with email alone.
              Thanks,
              Matt
              Originally posted by NinjaTrader_AlanP View Post
              Hello pen15,

              I was incorrect with what I mentioned in my 1st post about SetProfitTarget/SetStopLoss being ignored, my understanding of how set works was false and was cleared up by Chelsea, who you are working with in another ticket already.

              I am unable to replicate and as you are already working with Chelsea on this issue I will close this thread.

              Please let us know if you need further assistance.

              Comment

              Latest Posts

              Collapse

              Topics Statistics Last Post
              Started by chartish, Today, 04:43 PM
              0 responses
              7 views
              0 likes
              Last Post chartish  
              Started by Trader17, Today, 04:07 PM
              0 responses
              4 views
              0 likes
              Last Post Trader17  
              Started by GussJ, Today, 01:30 PM
              2 responses
              18 views
              0 likes
              Last Post GussJ
              by GussJ
               
              Started by GARZONJ, Today, 12:25 PM
              3 responses
              17 views
              0 likes
              Last Post NinjaTrader_PaulH  
              Started by RandanAL, Today, 11:53 AM
              1 response
              13 views
              0 likes
              Last Post NinjaTrader_ChelseaB  
              Working...
              X