Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

StopLoss bug

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

    StopLoss bug

    Hi everyone,

    I consistently have this problem on 90% of my backtests in the Strategy analyzer.

    Instead of obeying the rules of the strategy and exiting at the stop-loss or the profit target it holds onto the trade until the end of the back test no matter what. I've been searching to find no answers. This doesn't happen when I do a market replay or when I run them live but I use the backtester a lot to confirm things and my data is always skewed.

    Discover the magic of the internet at Imgur, a community powered entertainment destination. Lift your spirits with funny jokes, trending memes, entertaining gifs, inspiring stories, viral videos, and so much more from users.


    Any help on fixing this problem would be greatly appreciated!

    #2
    Hi magnatauren,

    Do you experience this with any of the sample strategies supplied with NinjaTrader?

    May I test your script on my end?

    To export your script do the following:
    1. Click File -> Utilities -> Export NinjaScript
    2. Enter a unique name for the file in the value for 'File name:'
    3. Select the strategy from the objects list on the left -> click the right facing arrow ">" to add the strategy to the export
    4. Click the 'Export' button -> click 'yes' to add any referenced indicators to the export -> click OK to clear the export location message


    By default your exported file will be in the following location:
    • (My) Documents/NinjaTrader 7/bin/Custom/ExportNinjaScript/<export_file_name.zip>


    Below is a link to the help guide on Exporting NinjaScripts.
    http://www.ninjatrader.com/support/h...nt7/export.htm
    Chelsea B.NinjaTrader Customer Service

    Comment


      #3
      Hello Chelsea,

      No I don't experience this with the provided strategies.
      I've attached two of the strategies I've been working on but have stopped since this problem has been occurring. The TrendPullback always has the problem along with any strategy I make similar to it.

      If you could help me find this problem that would be amazing thank you!
      Attached Files
      Last edited by magnatauren; 08-24-2014, 08:21 PM.

      Comment


        #4
        Hello,

        Thank you for posting the strategy.

        I am seeing that the strategy by default sets the profit target at 60 ticks and the stop loss at 40 ticks.

        The entry was at 92.89.

        So the profit target would be placed at 93.49.

        The stop loss is placed at 92.49.

        I am seeing that the price drops lower than this in the screenshot.

        However, from my testing, I am finding that the stop loss is closing orders when the price drops 40 ticks. This screenshot is taken with Exit on close set to True.

        I have modified your script so that you get output in the Output window, so that we can see where the stop and target are being placed once the entry order is in.

        Please run this modified script and post the output.
        Attached Files
        Chelsea B.NinjaTrader Customer Service

        Comment


          #5
          Thanks for your help, I found that the bug was the fact that the orders were not individually named. I just added a +current bar to name the buy and sell orders and it fixed the problem.

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by Tim-c, Today, 03:54 AM
          0 responses
          3 views
          0 likes
          Last Post Tim-c
          by Tim-c
           
          Started by FrancisMorro, Today, 03:24 AM
          0 responses
          2 views
          0 likes
          Last Post FrancisMorro  
          Started by Segwin, 05-07-2018, 02:15 PM
          10 responses
          1,772 views
          0 likes
          Last Post Leafcutter  
          Started by Rapine Heihei, 04-23-2024, 07:51 PM
          2 responses
          31 views
          0 likes
          Last Post Max238
          by Max238
           
          Started by Shansen, 08-30-2019, 10:18 PM
          24 responses
          945 views
          0 likes
          Last Post spwizard  
          Working...
          X