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

General Questions

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

    General Questions

    What affect does calling SetProfitTarget() and SetStopLoss() have if there already is a stop loss and profit target order?

    I'm looking to change the stop and limit orders.

    Thanks!
    Last edited by RiversideDude; 03-23-2017, 12:05 PM.

    #2
    Hello RiversideDude, and thank you for your question. This depends entirely on the way your strategy is set up.

    • SetProfitTarget and SetStopLoss are typically called before you enter a trade, defining trades to be placed in the future, so that as soon as you enter a trade, a profit target and stop loss order will be placed at the same time
    • If you are using limit, MIT, stop market, or stop limit orders as your user controlled stop loss and profit target orders, these will be placed in addition to any existing SetStopLoss and SetProfitTarget orders, and new SetStopLoss and SetProfitTarget orders will ignore these
    • If you are using market orders tied to strategy logic to exit a trade, or whenever any of the above orders closes your position, existing orders placed by SetStopLoss or SetProfitTarget will be cancelled

    Generally, to prevent overfill conditions that can occur when one trade fills while another cancels, it is advised that you rely on either SetProfitTarget/SetStopLoss, or exit methods, to close your position.


    Please let us know if there are any other ways we can help.
    Jessica P.NinjaTrader Customer Service

    Comment


      #3
      Thanks for the info and I am actuallycalling SetProfitTarget and SetStopLoss before I open a position. What is the best way for me to update my profit target and stoploss?

      Thanks!

      Comment


        #4
        Originally posted by RiversideDude View Post
        Thanks for the info and I am actuallycalling SetProfitTarget and SetStopLoss before I open a position. What is the best way for me to update my profit target and stoploss?

        Thanks!
        Call it after you enter a position.

        Comment


          #5
          Can someone from NT support reply, I want to test over the weekend.

          I'm still looking for a recommendation. I'm using ChangeOrder even though it's not listed for managed orders.

          Thanks!!
          Attached Files
          Last edited by RiversideDude; 03-24-2017, 01:11 PM.

          Comment


            #6
            To expand on Sledge's answer, if you call SetStopLoss or SetProfitTarget in OnBarUpdate, and you are already in a position, these methods will update your profit target and stop loss orders, respectively. You will still want to set an initial value with SetStopLoss and SetProfitTarget in your Initialize section, and if you are trailing stops, you will also want to reset these to your initial values whenever you are in MarketPosition.Flat .

            You can learn more about these here,


            Jessica P.NinjaTrader Customer Service

            Comment


              #7
              Thanks. I'll test it out tonight.

              Comment

              Latest Posts

              Collapse

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