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

BackTest Error with Take Profit/Stop

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

    BackTest Error with Take Profit/Stop

    I am backtesting a rather simple short only strategy. The backtest produces a 100% loss rate and when I investigated on the chart tab in the strategy analyzed I noticed that all my trades would close via the Profit target, albeit 1 tick above my entry. I can see just looking at the chart that these trades should be winners and am unsure as to why this error is occurring. Here is what my "Stops and Targets" page looks like in the strategy builder and here is an example on the chart of what I am talking about.
    Attached Files

    #2
    Hello toeby89,

    How do you know the trades would be winners?

    Have you opened the Strategy Performance window and viewed the Trades display?


    Please provide a screenshot of this.

    Is this real-time or historical data on the chart?
    Chelsea B.NinjaTrader Customer Service

    Comment


      #3
      Hi Chelsea. Thank you for your reply.

      I am using Historical data.

      I know these trades are winners based on the parameters of my SL and TP. When I open the Trades tab (and I have experimented with different SL settings and TP settings), every single trade is closed at either a 1 tick loss or at breakeven and always via "Profit Target". You will also see each trade is exited immediately. I will attach an image. All things considered, if each trade was getting stopped out for a loss, wouldn't the trade be exited via the stop loss and not the take profit?
      Attached Files

      Comment


        #4
        Hello toeby89,

        These appear to be historical overfills.

        Try setting the Order Fill Resolution to High.

        Does the provide more expected outcome?

        It appears you are using an out-of-date release.

        Currently NinjaTrader has released 8.1.2.1.

        Updates to NinjaTrader will contain the latest security updates and bug fixes, as well as occasional new features and instruments.

        To update NinjaTrader
        • Shutdown all programs including NinjaTrader *important
        • Download NinjaTrader from the link below
          Click here to download NinjaTrader
        • Double click the downloaded file to execute it
        • Follow the on screen instructions
        • Restart NinjaTrader
        You can read about changes to this release in the release notes linked below.
        https://ninjatrader.com/support/help...ease_notes.htm
        Chelsea B.NinjaTrader Customer Service

        Comment


          #5
          Thanks again Chelsea.

          Order handling is already set to "High, Tick, 1, Not Enabled, 0"

          I have updated my Ninjatrader to the latest release and the issue remains.

          Comment


            #6
            Hello toeby89,

            May I test the strategy on my end?

            To export a NinjaTrader 8 NinjaScript so this can be shared and imported by the recipient do the following:
            1. Click Tools -> Export -> NinjaScript Add-on...
            2. Click the 'add' link -> check the box(es) for the script(s) and reference(s) you want to include
            3. Click the 'Export' button
            4. Enter a unique name for the file in the value for 'File name:'
            5. Choose a save location -> click Save
            6. Click OK to clear the export location message
            By default your exported file will be in the following location:
            • (My) Documents/NinjaTrader 8/bin/Custom/ExportNinjaScript/<export_file_name.zip>
            Below is a link to the help guide on Exporting NinjaScripts.
            http://ninjatrader.com/support/helpG...nt8/export.htm

            Once exported, please attach the file as an attachment to your reply.​
            Chelsea B.NinjaTrader Customer Service

            Comment


              #7
              Hello Chelsea,

              As much as I would like to upload my script for you to test, I do not think that will be possible as I am using a 3rd party add-on to determine some of the values for my conditions. I assume these are not the problem, as I use them in other strategies without issue. I would also prefer not to upload my strategy publicly.

              Thank you once again for your time and help with this mater.

              Comment


                #8
                Hello toeby89,

                I made a test script and I am not able to reproduce.
                StopTargetPnlTest_NT8.zip

                Does this test script reproduce on your end?

                May I confirm you are seeing version 8.1.2.1 in the Help -> About window?
                Chelsea B.NinjaTrader Customer Service

                Comment


                  #9
                  Version is 8.1.2.1 64-bit.

                  I ran the strategy you attached and it works as expected. I will scrap the strategy I am working on and start again from scratch.

                  Thanks again for all your help!

                  Comment

                  Latest Posts

                  Collapse

                  Topics Statistics Last Post
                  Started by Vietanhnguyen2hotmailcom, Yesterday, 10:29 AM
                  4 responses
                  23 views
                  0 likes
                  Last Post Vietanhnguyen2hotmailcom  
                  Started by PhillT, 04-19-2024, 02:16 PM
                  4 responses
                  35 views
                  0 likes
                  Last Post PhillT
                  by PhillT
                   
                  Started by ageeholdings, 05-01-2024, 05:22 AM
                  5 responses
                  37 views
                  0 likes
                  Last Post ageeholdings  
                  Started by reynoldsn, Today, 02:34 PM
                  0 responses
                  13 views
                  0 likes
                  Last Post reynoldsn  
                  Started by nightstalker, Today, 02:05 PM
                  0 responses
                  21 views
                  0 likes
                  Last Post nightstalker  
                  Working...
                  X