Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Simulated Trail Stop

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

    Simulated Trail Stop

    Hello Support,

    I am testing NT Trail Stop with Simulated set to true, and found I am not getting the Trail Stop OnOrderUpdate, I see NT printing "Amended trail stop order . . . ".
    The only time OnOrderUpdate is called is when trail stop is hit.

    How do I keep track of trail stop movement in this case ?

    Thanks.

    Regards,

    EdwardK.

    #2
    Edward, the Set() methods naturally would not expose their IOrder objects, however with the techniques shown in the reference sample below you could capture their tokens as well and track them -

    Comment


      #3
      Hello Bertrand,

      I already uses OnOrderUpdate, and accessing the order variable as the trail stop is updated. Everything is fine when Simulated == false. But when I set Simulated == true in the SetTrailStop, I am not getting the OnOrderUpdate for that trail stop. The OnOrderUpdate is then called only when the Trail Stop is hit. Are you with me?

      Thanks.

      Regards.
      EdwardK.

      Comment


        #4
        Edward, thanks for clarifying, I missed that...I believe this is expected when simulated is 'true' as the stop is indeed only triggered and send as market order once hit, as it would rest locally on your PC in this case.

        Comment


          #5
          Hello Bertrand,

          I had expected NT implement an order state Simulated and keep it in the PC but still adhere to all IOrder mechanism, including OnOrderUpdate.

          So my big question is how can I know the trail stops as it is moved.
          I saw the DOM has the update, when the simulated stops moved. So there is a way to know.

          Thanks.

          Regards.

          EdwardK

          Comment


            #6
            Edward, via NinjaScript this unfortunately not supported as the orderstate is then just 'Initialized'.

            Comment


              #7
              Hello Bertrand,

              Well, I am disappointed.

              Why can't there be order state Simulated? Creating a state and defining its transition would be a uniform way to solve the problem rather than having a special case. This would be the state where order are kept on the PC, pending triggers. Target can then also be kept on the PC, similarly simply.

              How about in NT7?

              Thanks.

              Regards.
              EdwardK.
              Edward

              Comment


                #8
                Edward,

                There is no change of behavior in NT7. Thank you for the suggestion. To know where the trailing stop is you would likely want to just program your own tracker variable that uses the same logic as a trailing stop to follow where the price would theoretically be at.
                Josh P.NinjaTrader Customer Service

                Comment


                  #9
                  Hello Josh,

                  Thanks for the response.
                  Can you let me know trailing stop logic on NT?
                  As I understand it, it is updated Tick by Tick.

                  Thanks.

                  Regards,
                  EdwardK

                  Comment


                    #10
                    Correct Edward, they are updated on tick by tick basis - http://www.ninjatrader-support.com/H...TrailStop.html

                    Comment


                      #11
                      Hello Josh,

                      In trying to track simulated trail stop, I found the following:

                      1. First regarding simulated trail stop. When order is triggered, it is submitted and filled. Unfortunately when I check the order.FromEntrySignal, it is blank. This is a different behaviour than non-simulated trail stop. How am I going to pair Entry with the Exit in this case ? This would just cause more complications to my code.

                      2. The Trail Stop position on the DOM does not really update on Tick By Tick basis. The print confirms that too. They are updated when a bar is closed. This is different from what the help guide says. Not really a problem to me. But below is a problem.

                      3. I would expect it is a fixed distance trail that is updated following a new bar close in the direction of the position. But I spotted a case today where the bar closes approaching the stop (definitely not making new high), and yet the stop moves up 2 ticks. What is the exact trail stop algorithm?

                      Thanks.

                      Regards,
                      EdwardK.

                      Comment


                        #12
                        1. You will have to run your own variables to keep track of it.

                        2. The price the order is modified to is based off a tick by tick basis.

                        3. Every single tick up in price raises the stop up 1 tick. Nothing fancy is being used here.
                        Josh P.NinjaTrader Customer Service

                        Comment


                          #13
                          Hello Josh,

                          Just to say that I manage to track the Simulated Stop and pair perfectly to Entry signals. The trick is by using OCO tokens, it has same OCO tokens as the Target order, and Target has order.FromEntrySignal defined.

                          The appearance as if the NT Trail Stops approach the price move, it is because that although bar closes high, the low is lower than previous bar. Thus the price goes up, the stops goes down.

                          The Trail Stop changes is only reflected to SuperDOM at the close of bar.

                          Cheers.

                          Thanks.

                          Regards.
                          EdwardK.

                          Comment


                            #14
                            FromEntrySignal

                            Why does Ninja NOT set the FromEntrySignal when simulated is set to true....this makes no sense to me. If it is on the local PC, then we should be able to find in the Orders collection even though it has not been submitted to the order server.

                            At least this behavior should be documented. Took me a while to figure out that there was no FromEntrySignal on an "Initialized" order. Because of this, you can not move stops on a strategy opening multiple positions....it requires that you issue the SetStopLoss with simulated set to false.....

                            Leroy

                            Comment


                              #15
                              Hello,

                              I will make sure this feedback is reflected to development. Wish you a great weekend!

                              -Brett
                              BrettNinjaTrader Product Management

                              Comment

                              Latest Posts

                              Collapse

                              Topics Statistics Last Post
                              Started by Geovanny Suaza, 02-11-2026, 06:32 PM
                              0 responses
                              646 views
                              0 likes
                              Last Post Geovanny Suaza  
                              Started by Geovanny Suaza, 02-11-2026, 05:51 PM
                              0 responses
                              367 views
                              1 like
                              Last Post Geovanny Suaza  
                              Started by Mindset, 02-09-2026, 11:44 AM
                              0 responses
                              108 views
                              0 likes
                              Last Post Mindset
                              by Mindset
                               
                              Started by Geovanny Suaza, 02-02-2026, 12:30 PM
                              0 responses
                              569 views
                              1 like
                              Last Post Geovanny Suaza  
                              Started by RFrosty, 01-28-2026, 06:49 PM
                              0 responses
                              573 views
                              1 like
                              Last Post RFrosty
                              by RFrosty
                               
                              Working...
                              X