Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Trailing Stop does not work?

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

    Trailing Stop does not work?


    I am trying to configure a trailing stop from Strategy Builder.

    I would like the trailing stop to work like it does from the ATM as shown in this video.



    I would really like to get it working as shown in the video

    Thanks.














    #2
    Hello ntcat,

    Thanks for your post.

    An important point to note is that you cannot use both a fixed stop (StopLoss) and a Trailing stop on the same order and if they are applied to the same order, the trailing stop will not function.

    The trailing stop provided in the strategy builder is a simple trailing stop. You specify the starting distance which would be your initial stop and as the trade goes into profit, for every tick of profit the stop will move that many ticks towards the current price. The stop does not move backwards. Please note that to use the trailing stop, you would need to run the strategy with Calculate.OnpriceChange or Calculate.OnEachTick. If you use calculate.OnBarClose, the stop is not moved until the close of the bar and may move the stop into a price level that would reject the order. From the help guide: " Trail stop orders are modified based on the strategies 'Calculate' settings. In the case of 'Calculate' on bar close, when the bar closes the trail stop order modification will occur using the closing price of the bar as the reference price to apply the trail offset. Subsequently if the open price of the next bar is significantly higher or lower then the current close price then there is a possibility that the calculated trail stop price is now an invalid stop price. This is a risk with modifying any stop order closer to the current market price since any modification above/below the current price would be rejected." https://ninjatrader.com/support/help...ttrailstop.htm


    The strategy builder does not have the options as an ATM does for setting different stop strategies.

    You can create your own trailing stop through condition builder sets of the Strategy Builder. Here is a link to an example of using sets to create your own trailing stop in the Strategy Builder: https://ninjatrader.com/support/foru...rategy-builder

    Comment


      #3
      I got it working kinda, I was not aware that if I setup a stop loss the stop trail would not work.. I removed and it started working... I am finding that the Strategies Trailing Stop is not enough. My manual ATM works great. I wish there was a way to call my ATM from code. or a way the ATM could output code I could use in my unlocked strategy.

      Here is what I am trying to do.

      Trade is taken for the Long with 8 Ticks as Initial Stop Loss
      1st Step = is to break even at 4 ticks. by calling SetStopLoss() in OnBarUpdate() this works......as shown in SamplePriceModification_NT8.zip
      2nd Step is to move the stop loss another 4 ticks for profit, (it's a 77/25 chance it can) but when the second time SetStopLoss is set, it's ignored... apparently you can only call it once.
      3rd Step is to catch a runner (it's a 40/60 chance) every 8 Ticks Take another 4 ticks profit by moving the StopLoss bar up on the long and down on the short. but the same issue as in Step 2, can't move the Stop Loss

      I can do this very easy on ATM but I can't figure out a way to do this in Either the Strategy Builder or in Code..

      Attached is the scripts I am playing with... but can't seem to figure it out.





      Attached Files

      Comment


        #4
        Looks like I found one script that works.

        https://ninjatraderecosystem.com/user-app-share-download/profittargettrailingstop_101b/

        It calls SetStopLoss several times, and it works.. Looking at the code to figure out why it works.


        Comment


          #5
          Hello ntcat,

          Thanks for your replies.

          If you want to work directly in Ninjascript there is a hybrid type strategy that allows you to use an ATM template. The Ninjascript strategy would find the entries and place the entry order, once the order fills the ninjascript assigned ATM strategy will then take over providing the stop/target you have previously created. You can also dynamically change the orders as you would for any ATM. Once the position has been closed by the stop or target, the strategy will then seek the next entry.

          In your NinjaTrader is an example of this called SampleATMstartegy. You can open the strategy in the Ninjascript editor and review all of the code along with the instructive comments that explain how to use the sample and how the special properties and methods work. Here is a link to the help guide on these special methods and properties: https://ninjatrader.com/support/help...gy_methods.htm

          Comment


            #6
            NinjaTrader_PaulH I will check out.


            I have been playing with https://ninjatraderecosystem.com/use...lingstop_101b/ and I really like it, from the SimAccount it works great, but when taking live trades it does not work, Stop Losses do not work and there are no errors in the log, but if you switch back to the sim mode it works once gain.

            Is this a problem with SetStopLoss() method?

            Comment


              #7
              Hello ntcat,

              Thanks for your reply.

              Please write into PlatformSupport[at]Ninjatrader[dot]com, mark the e-mail attend: Paul and include ticket # 2604914 in the subject line. In the body of the e-mail include a link to this forum thread for reference.

              Please send detail concerning the application of the strategy: Instrument, bar type, bar size, days to load, calculate setting used. Please advise what specific day and time you used the strategy on your live account. If you can, also point out when the stop loss "did not work" that would be helpful.

              Attach your log and trace files to the e-mail:
              • Open your NinjaTrader folder under, "Documents" (sometimes called, "My Documents")
              • Right click on the 'log' and 'trace' folders and select Send To> Compressed (zipped) Folder.
              • Send the 2 compressed folders as attachments to the email.
              • Once complete, you can delete those compressed folders.

              Comment

              Latest Posts

              Collapse

              Topics Statistics Last Post
              Started by NullPointStrategies, Yesterday, 05:17 AM
              0 responses
              64 views
              0 likes
              Last Post NullPointStrategies  
              Started by argusthome, 03-08-2026, 10:06 AM
              0 responses
              139 views
              0 likes
              Last Post argusthome  
              Started by NabilKhattabi, 03-06-2026, 11:18 AM
              0 responses
              75 views
              0 likes
              Last Post NabilKhattabi  
              Started by Deep42, 03-06-2026, 12:28 AM
              0 responses
              45 views
              0 likes
              Last Post Deep42
              by Deep42
               
              Started by TheRealMorford, 03-05-2026, 06:15 PM
              0 responses
              50 views
              0 likes
              Last Post TheRealMorford  
              Working...
              X