Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Trailing stops in back-tester with ExitLongStop SignalName

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

    Trailing stops in back-tester with ExitLongStop SignalName

    If I have a Strategy that places an initial stop order using ExitLongStop with a SignalName specified:

    stopOrder = ExitLongStop(0, true, 1, stopPrice, "Stop", "MyEntry");

    and then later moves or trails the stop price with a different SignalName:

    stopOrder = ExitLongStop(0, true, 1, stopTrailPrice, "TrailStop", "MyEntry");

    Does the back-tester know to cancel the first open stop order (SignalName="Stop") when the new stop order (SignalName="TrailStop") is accepted or does the back-tester keep two stop orders open? In other words, do I need code in OnOrderUpdate to cancel the first stop order when the changed stop order with a different SignalName is accepted?

    Thanks,

    David
    dbw451

    #2
    You need to cancel the first. I would not recommend this procedure though. Please just modify the original order and stay with the same signal name for the same position.
    Josh P.NinjaTrader Customer Service

    Comment


      #3
      Thanks Josh. My only purpose for the stop SignalName is so that I can statistically analyze the output of the back-tester (both in the trade list and on the chart). I've got over a dozen exit/trade management strategies. I mix and match them, using 2,3, 4 or more at the same time. I need to know which exit strategy created a trade exit so that I can statistically evaluate the effectiveness of each individual exit strategy when using multiple exit strategies at the same time. The exit labeling has been very valuable in my analysis work, so valuable that I don't want to give it up.

      Is there some other way that I can put a label into the back-tester output so that I can capture how a trade exited? I guess I could use DrawText for labeling the chart with exit labels, but I also need the information in back-tester and optimizer trade lists.


      Thanks,

      David
      dbw451

      Comment


        #4
        David,

        Unfortunately I have concerns with cancelling a stop and trying to resubmit it. This is why I cannot recommend this procedure. You could give it a shot and see if you can modify the signal name in the original manner you proposed, but I believe it would not work. I believe it will just create a second order instead of modifying the original.
        Josh P.NinjaTrader Customer Service

        Comment


          #5
          Changing the signalName in a new stop order with the same FromEntrySignal does cause problems. The original stop order does still exist and is not canceled. Also, the original order is no longer tracked by my code because the IOrder stopOrder variable is reassigned to the new stop order. Trace shows multiple stop orders canceled with my multiple exit signalNames when a position is closed. Also, the back-tester will exit at (seemingly) random phantom stops. The Trace shows that the stop I think is active as "cancelled pending exit order, since associated position is closed" while one of the stops I thought was replaced earlier is the exit.

          I don't like canceling the stop orders either, but if it's a way to 'trick' the back-tester into allowing me to use multiple signalNames, it might be worth a shot. Since I know that the back-tester will create multiple open stop orders for the same FromEntrySignal and different signalNames, I'm thinking the approach would be to submit the second stop order and then cancel the first stop order once the second is accepted. This would NOT be the way to handle things in live automated trading, but maybe it will work with the back-tester. I would switch to a single exit signalName once my exit analysis is complete and before I would test live trading.

          Regards,

          David

          Comment


            #6
            David,

            You can give it a shot, but again, I cannot recommend this approach at this point in time. The only approach I can suggest is modifying the original order and maintaining the same entry signal name.
            Josh P.NinjaTrader Customer Service

            Comment


              #7
              Ok, Thanks Josh; I understand.

              Regards,

              David
              dbw451

              Comment


                #8
                As a follow-up, canceling the first stop order after the changed stop order is accepted works most of the time, but not all of the time. The changed stop order is sometimes ignored by the back-tester. If I use the same signalName for every stop order change, then all the stop orders appear to work properly.

                Regards,

                David
                dbw451

                Comment


                  #9
                  Thanks for the follow up David.
                  Josh P.NinjaTrader Customer Service

                  Comment

                  Latest Posts

                  Collapse

                  Topics Statistics Last Post
                  Started by GLFX005, Today, 03:23 AM
                  0 responses
                  1 view
                  0 likes
                  Last Post GLFX005
                  by GLFX005
                   
                  Started by XXtrader, Yesterday, 11:30 PM
                  2 responses
                  11 views
                  0 likes
                  Last Post XXtrader  
                  Started by Waxavi, Today, 02:10 AM
                  0 responses
                  6 views
                  0 likes
                  Last Post Waxavi
                  by Waxavi
                   
                  Started by TradeForge, Today, 02:09 AM
                  0 responses
                  13 views
                  0 likes
                  Last Post TradeForge  
                  Started by Waxavi, Today, 02:00 AM
                  0 responses
                  3 views
                  0 likes
                  Last Post Waxavi
                  by Waxavi
                   
                  Working...
                  X