Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Target order 2 problem

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

    Target order 2 problem

    Hi, I have a problem with my strategy when running a backtest. The problem is sometimes the second entry does not take profit at all and and a can not make complete backtest. Attached is my strategy that I'm backtesting E-mini.
    Any assistance would be appreciated.
    Thanks in advance
    Attached Files

    #2
    Dragan,

    Thank you for your post.

    Is the second target getting placed?

    What do you mean by not always taking profit? Can you show an example of this?
    Cal H.NinjaTrader Customer Service

    Comment


      #3
      Yes, the second target is getting placed but it doesn't take profit. You can see on the picture that before it had taken profit. But the next entry 2 has not taken profit.
      Attached Files

      Comment


        #4
        Dragan,

        I would advise on running TraceOrders = true in the Initialize() method.

        This will print out the orders and what is happening to them in the Output Window, Tools -> Output Window

        Cal H.NinjaTrader Customer Service

        Comment


          #5
          I have received a message that the position for the profit target and stop loss are closed:

          5/15/2013 10:45:00 AM Cancelled pending exit order, since associated position is closed: Order='NT-00032/Backtest' Name='MyTarget2' State=Working Instrument='ES 09-14' Action=Sell Limit price=1659.5 Stop price=0 Quantity=1 Strategy='SampleOnOrderUpdate' Type=Limit Tif=Gtc Oco='' Filled=0 Fill price=0 Token='cbdc0aafb7324fc791e94683c86f21fc' Gtd='12/1/2099 12:00:00 AM'

          5/15/2013 10:45:00 AM Cancelled pending exit order, since associated position is closed: Order='NT-00031/Backtest' Name='MyStop2' State=Working Instrument='ES 09-14' Action=Sell Limit price=0 Stop price=1617.5 Quantity=1 Strategy='SampleOnOrderUpdate' Type=Stop Tif=Gtc Oco='' Filled=0 Fill price=0 Token='10e327b617234a3c9f8f643bcb8c41c9' Gtd='12/1/2099 12:00:00 AM'

          Any suggestions?

          Comment


            #6
            Dragan,

            I wanna try testing this on my end. Can you send a screenshot of the settings you are using for the strategy wizard so I can sync this on my end?
            Cal H.NinjaTrader Customer Service

            Comment


              #7
              Here are the setting that I'm using. The time is shown on the attached picture (RTH, Central time).
              Attached Files

              Comment


                #8
                Hi Dragan,

                Thanks for the screenshot.

                On line 110 you have:
                if (stopOrder2 != null && stopOrder.StopPrice < entryOrder2.AvgFillPrice)

                Should this be:
                if (stopOrder2 != null && stopOrder2.StopPrice < entryOrder2.AvgFillPrice)

                ?
                Chelsea B.NinjaTrader Customer Service

                Comment


                  #9
                  Thanks, it worked

                  Comment

                  Latest Posts

                  Collapse

                  Topics Statistics Last Post
                  Started by Geovanny Suaza, 02-11-2026, 06:32 PM
                  0 responses
                  650 views
                  0 likes
                  Last Post Geovanny Suaza  
                  Started by Geovanny Suaza, 02-11-2026, 05:51 PM
                  0 responses
                  370 views
                  1 like
                  Last Post Geovanny Suaza  
                  Started by Mindset, 02-09-2026, 11:44 AM
                  0 responses
                  109 views
                  0 likes
                  Last Post Mindset
                  by Mindset
                   
                  Started by Geovanny Suaza, 02-02-2026, 12:30 PM
                  0 responses
                  574 views
                  1 like
                  Last Post Geovanny Suaza  
                  Started by RFrosty, 01-28-2026, 06:49 PM
                  0 responses
                  577 views
                  1 like
                  Last Post RFrosty
                  by RFrosty
                   
                  Working...
                  X