Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

SampleIntrabarBacktest - Premataure Exit at close of the day the trade was entered

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

    SampleIntrabarBacktest - Premataure Exit at close of the day the trade was entered

    Hello:
    I am using the above Sample Education Resource within my strategy, which adds a 1 minute secondary bar series to fill orders. The strategy enters the trade correctly, but exits the trade at the end of the day without hitting either the stop loss or profit target. I did replace my strategy code with an EMA crossover to see if my code was causing this problem, but I got the same result. Can you give me some hint on what direction to take to handle this problem? Thanks.

    #2
    Hello,

    You can change that in tools>options>Strategies>NinjaScript and uncheck the check box at the bottom.
    DenNinjaTrader Customer Service

    Comment


      #3
      SampleIntrabarBacktest - Premature trade exit at end of day

      Hello:

      Under "Order Handling", I unchecked the "cancel strategy orders on strategy termination" box and each existing order still exits on the close of the day the trade was entered.

      The "Stop and target submission" is currently set to "Per entry execution". Should it be set to "By strategy position"? Just grasping at straws. Thanks.

      Comment


        #4
        Hello Tonyh,

        You can set "Exit on Close" to false whenever you apply the strategy.
        You can also declare this in code:

        ExitOnClose = false;

        Ryan M.NinjaTrader Customer Service

        Comment


          #5
          SampleIntrabarBacktest - ExitOnClose = false;

          Hello Ryan:

          This also doesn't work. If no other suggestions are available, I guess I will create a new strategy with my trading code and gradually add the SampleIntrabarBacktest code to see where the problem is. As I like the idea of trading on the 1 minute bar data. Thanks.

          Comment


            #6
            SampleIntrabarBacktest - ExitOnClose = false; - Does it work in Strategy Analyzer?

            Hello Ryan:

            I kept the above code, added your change and added a small trading algorithm, and it works on a chart. However, when running the code on "Strategy Analyzer" it still exits at the close of each day. Is this code able to work in Strategy Analyzer? Thanks.

            Comment


              #7
              You can set this setting in the strategy analyzer. Select False on this setting when backtesting.
              Attached Files
              Last edited by NinjaTrader_RyanM1; 03-15-2010, 11:38 AM. Reason: replies crossed
              Ryan M.NinjaTrader Customer Service

              Comment


                #8
                SampleIntrabarTest - ExitOnClose = false; - Strategy Analyzer

                Thanks Ryan:

                It works perfectly. I assumed that the ExitOnClose would be set to false with the code. I now fully know what "assume" means.

                Comment

                Latest Posts

                Collapse

                Topics Statistics Last Post
                Started by Geovanny Suaza, 02-11-2026, 06:32 PM
                0 responses
                558 views
                0 likes
                Last Post Geovanny Suaza  
                Started by Geovanny Suaza, 02-11-2026, 05:51 PM
                0 responses
                324 views
                1 like
                Last Post Geovanny Suaza  
                Started by Mindset, 02-09-2026, 11:44 AM
                0 responses
                101 views
                0 likes
                Last Post Mindset
                by Mindset
                 
                Started by Geovanny Suaza, 02-02-2026, 12:30 PM
                0 responses
                545 views
                1 like
                Last Post Geovanny Suaza  
                Started by RFrosty, 01-28-2026, 06:49 PM
                0 responses
                547 views
                1 like
                Last Post RFrosty
                by RFrosty
                 
                Working...
                X