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 Haiasi, 04-25-2024, 06:53 PM
          2 responses
          16 views
          0 likes
          Last Post Massinisa  
          Started by Creamers, Today, 05:32 AM
          0 responses
          4 views
          0 likes
          Last Post Creamers  
          Started by Segwin, 05-07-2018, 02:15 PM
          12 responses
          1,785 views
          0 likes
          Last Post Leafcutter  
          Started by poplagelu, Today, 05:00 AM
          0 responses
          3 views
          0 likes
          Last Post poplagelu  
          Started by fx.practic, 10-15-2013, 12:53 AM
          5 responses
          5,407 views
          0 likes
          Last Post Bidder
          by Bidder
           
          Working...
          X