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

Trailing Stop in Strategy Builder.

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

    Trailing Stop in Strategy Builder.

    I'm trying to figure out how to get a trailing stop to work in Strategy Builder. I read a number of other threads and it still isn't working so I'm posting some screenshots here. My goal is to set a trailing stop at x*ATR, where "x" is defined as my "TrailStopATRmultiplier" variable.

    The strategy works as intended with the exception of it doesn't add a trailing stop. Previously I had a standard stop at a fixed value included and it would enter the standard stop.

    Any help is appreciated.


    #2
    Hello TriGuy818, thanks for your post.

    The protective orders that are set up in the Stops and Targets section are set up in the State.Configure state of the script lifecycle, so there should be no data access within the stop or target section. If you need to set a stop and target based on an indicator price you must use one of the Exit methods within one of your sets in the builder. I attached a related example where a trailing stop is implemented.

    Please let me know if you have any questions on this material.
    Attached Files
    Chris L.NinjaTrader Customer Service

    Comment


      #3
      In an effort to understand how trailing stops work and to simplify it a bit, I updated it to a fixed currency amount of $80. However, this still doesn't seem to enter a trail stop. The rest of the strategy still looks like the screenshots above.

      Comment


        #4
        Hello TriGuy818, thanks for your reply.

        Do you get any errors in the Log tab of the Control Center? Is the stop completely ignored and not get submitted at all or something different? From the screen shot, it looks like it is set up properly.

        I look forward to hearing from you.
        Chris L.NinjaTrader Customer Service

        Comment


          #5
          Ok - I figured out the fixed stop. It appears to only accept tick values as the offset. I updated the fixed value to be an input parameter and it works with the tick type. However, the optimizer doesn't seem to allow me to optimize on this input parameter. Am I doing something wrong or is that the way it's designed?

          Comment


            #6
            Hello TriGuy818, thanks for your reply.

            Any user input value should be available through the strategy analyzer. Did you set up the value as a user input or a variable? Did you set the strategy analyzer from Backtest to Optimize?

            Kind regards,
            -ChrisL
            Chris L.NinjaTrader Customer Service

            Comment


              #7
              Originally posted by NinjaTrader_ChrisL View Post
              Hello TriGuy818, thanks for your post.

              The protective orders that are set up in the Stops and Targets section are set up in the State.Configure state of the script lifecycle, so there should be no data access within the stop or target section. If you need to set a stop and target based on an indicator price you must use one of the Exit methods within one of your sets in the builder. I attached a related example where a trailing stop is implemented.

              Please let me know if you have any questions on this material.
              This helped me a lot Chris, thanks!

              Comment

              Latest Posts

              Collapse

              Topics Statistics Last Post
              Started by bortz, 11-06-2023, 08:04 AM
              47 responses
              1,610 views
              0 likes
              Last Post aligator  
              Started by jaybedreamin, Today, 05:56 PM
              0 responses
              9 views
              0 likes
              Last Post jaybedreamin  
              Started by DJ888, 04-16-2024, 06:09 PM
              6 responses
              19 views
              0 likes
              Last Post DJ888
              by DJ888
               
              Started by Jon17, Today, 04:33 PM
              0 responses
              6 views
              0 likes
              Last Post Jon17
              by Jon17
               
              Started by Javierw.ok, Today, 04:12 PM
              0 responses
              16 views
              0 likes
              Last Post Javierw.ok  
              Working...
              X