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

TrailStop is automatically canceled

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

    TrailStop is automatically canceled

    When the order is filled, the TrailStop is canceled automatically, when it has a few ticks in its favor and the Trailstop disappears. I made the strategy in Strategy Builder and in the Stops and Targets part I configured only a SetTrailStop.

    Is there a way to fix the issue of the Trailstop canceling itself automatically?

    Thank you.

    #2
    Hello daying35,

    When you say that the order is filled, what order are you referring to? The targets in the stops and targets page rely on the entries position to remain working, if you have another stop or target that filled it will cancel the other working targets for that position.
    JesseNinjaTrader Customer Service

    Comment


      #3
      Hello NinjaTrader_Jesse

      My entry order is an EnterLongStopMarket and my exit is a SetTrailStop. When the EnterLongStopMarket is filled the SetTrailStop is activated but immediately cancelled. In the stops and targets page I only have SetTrailStop, no profit target, no stop loss.

      Comment


        #4
        Hello daying35,

        Do you have a small sample of the code that you can provide?

        Could you otherwise check trace orders to see if something is happening surrounding the order handling rules?



        That will put order information in the output window by turning on trace orders.

        JesseNinjaTrader Customer Service

        Comment


          #5
          Hello NinjaTrader_Jesse

          I added TraceOrders ( TraceOrders = true; ) to my strategy code using NinjaScript Editor, to generate the output in NinjaScript Output. Today I used the strategy again and just like yesterday, the strategy set the trailstop but it was immediately cancelled. I was looking in the NinjaScript Output window for the last line of text that contains information about the canceled trailstop and it is the following (only I edited my account name to keep it private):

          Amended trail stop order orderId='1529606707' account='MYACCOUNT' name='Trail stop' orderState=CancelPending instrument='MNQ 03-23' orderAction=Sell orderType='Stop Market' limitPrice=0 stopPrice=10903.75 quantity=1 tif=Gtc oco='' filled=0 averageFillPrice=0 onBehalfOf='' id=1295 time='2023-01-05 10:08:27' gtd='2099-12-01' statementDate='2023-01-05' stopPriceChanged=10904.75

          I have saved the .txt file of the information contained in the NinjaScript Output window, if necessary, I will send you the .txt file please tell me.

          Thank you.

          Comment


            #6
            Hello daying35,

            Can you see in the information if the order was trying to be changed before it was canceled? Was it submitted and then also changed and cancelled or was it submitted and then just cancelled?

            Are you also using a profit target along with this trailing stop?
            JesseNinjaTrader Customer Service

            Comment


              #7
              Hello NinjaTrader_Jesse

              I solved the error. Thank you very much for your help, it was very useful!​

              Comment

              Latest Posts

              Collapse

              Topics Statistics Last Post
              Started by rt61968, 02-17-2018, 05:24 PM
              3 responses
              2,733 views
              0 likes
              Last Post MasterEtrad3  
              Started by nuobo, Today, 07:43 PM
              0 responses
              1 view
              0 likes
              Last Post nuobo
              by nuobo
               
              Started by ETFVoyageur, Today, 02:04 PM
              3 responses
              21 views
              0 likes
              Last Post ETFVoyageur  
              Started by cre8able, Today, 06:18 PM
              0 responses
              6 views
              0 likes
              Last Post cre8able  
              Started by ETFVoyageur, Today, 06:05 PM
              0 responses
              7 views
              0 likes
              Last Post ETFVoyageur  
              Working...
              X