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

Dynamic Stops and Targets

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

    Dynamic Stops and Targets

    Hello, I have been trying to understand how to get dynamic stops and targets in my strategy (attached). The NT8 guide says to call them in OnBarUpdate instead of State.Configure or State.DataLoaded. However, on the chart, when I move them they snap back after a few seconds. I could create an ATM strategy with moveable stops & targets but is this the only way?
    Attached Files

    #2
    Hello JohnS52,

    In order to be able to move targets that a strategy submits you need to use regular exit orders isntead of the Set methods and also ensure that your condition to submit the orders is only called one time. Once the orders are active you can then manually move them.

    A live until cancelled order is also needed so you would need to use the following overload for the target orders:

    Code:
    ExitLongStop(0, true, 1, Position.AvgPrice - 10 * TickSize, "MyExit", "MyEntry");
    JesseNinjaTrader Customer Service

    Comment


      #3
      Hello NinjaTrader_Jesse,

      Thank you for your reply. Is there a sample strategy that shows this code in context?

      Comment


        #4
        Hello JohnS52,

        You can see the following sample which submits live until cancelled orders based on an entry fill, the targets are only submitted once when the entry has filled.

        Hello, I have a strategy that places stop and target orders once an order is executed. However, when i see the orders on the chart trader and I want to move


        JesseNinjaTrader Customer Service

        Comment


          #5
          That works great. Thank you.

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by jclose, Today, 09:37 PM
          0 responses
          5 views
          0 likes
          Last Post jclose
          by jclose
           
          Started by WeyldFalcon, 08-07-2020, 06:13 AM
          10 responses
          1,414 views
          0 likes
          Last Post Traderontheroad  
          Started by firefoxforum12, Today, 08:53 PM
          0 responses
          11 views
          0 likes
          Last Post firefoxforum12  
          Started by stafe, Today, 08:34 PM
          0 responses
          11 views
          0 likes
          Last Post stafe
          by stafe
           
          Started by sastrades, 01-31-2024, 10:19 PM
          11 responses
          169 views
          0 likes
          Last Post NinjaTrader_Manfred  
          Working...
          X