Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Conditional StopLoss and ProfitTarget

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

    Conditional StopLoss and ProfitTarget

    How do I attach a stop loss and target to a entry order, so they only are activated if the entry is hit?

    Lets say I want to submit orders that match my LONG criteria or my SHORT criteria. If my long criteria is hit, I wan't the corrosponding SL/PT to become active. If my SHORT criteria is hit, I want the other set of SL/PT orders to become active.


    That is 6 orders in total, I think:
    Long:
    #1 Buy-stop at price X
    #2 Stop Loss X (Only active if #1 is executed)
    #3 Profit Target X (Only active if #1 is executed)

    Short:
    #4 Sell short-stop at price Y
    #5 Stop Loss Y (Only active if #4 is executed)
    #6 Profit Target Y (Only active if #4 is executed)

    I know that is possible in Market Scope on FXCM, I hope I can do the same in NT
    Last edited by joely; 02-16-2015, 02:41 PM.

    #2
    Hello joely,

    Thank you for your post and welcome to the NinjaTrader Support Forum!

    You can achieve this just by using the SetStopLoss and SetProfitTarget in the Initialize() method or on the Stops and Targets tab of the Strategy Analyzer.

    When an entry is filled the Stop Loss and Profit Target will be submitted, so they won't submit too early.

    Information on Stop Loss: http://www.ninjatrader.com/support/h...etstoploss.htm
    Information on Profit Target: http://www.ninjatrader.com/support/h...ttrailstop.htm

    Comment


      #3
      Hey Patrick

      I dont in advance know if my trade is going to go long or short, it all depends on the market. Therefore I don't know which of my stoploss/profittarget pairs should be active at initialize, since there are different stoploss/profittarget values for each situation.

      Setting the StopLoss and ProfitTarget in the initialize seems that it would only allow me to set a single set of StopLoss/ProfitTarget. How do I set multiple that each depend on (or are connected to) a specific order?

      Is it clear what I mean?

      Comment


        #4
        Originally posted by joely View Post
        Hey Patrick

        I dont in advance know if my trade is going to go long or short, it all depends on the market. Therefore I don't know which of my stoploss/profittarget pairs should be active at initialize, since there are different stoploss/profittarget values for each situation.

        Setting the StopLoss and ProfitTarget in the initialize seems that it would only allow me to set a single set of StopLoss/ProfitTarget. How do I set multiple that each depend on (or are connected to) a specific order?

        Is it clear what I mean?
        So set those values immediately before your entry.

        Remember to reset them when you go flat.

        Comment


          #5
          Hello Joely,

          An alternative to what koganam provided, you could use separate entrySignalNames and ensure your entries are using unique signalNames, that way you have two SetProfitTarget and SetStopLoss in Initialize() - one for each signalName.

          Comment


            #6
            Ah, from the documentation for SetStopLoss it reads:
            The entry signal name. This ties the profit target exit to the entry and exits the position quantity represented by the actual entry.

            That sounds very useful, in that the StopLoss would only activate for a specific signalname - so far so good and thank you for that :-)

            However, I am forced do to this in unmanged mode, as NT does not allow me to place both the Buy-Stop and SellShort-Stop orders at the same time. How would I go about placing the StopLoss/ProfitTarget in unmanaged mode? Am I forced to do that in OnExecution?, and if so, wouldn't that pose a risk that my position moves too much between the entry and the placement of my stoploss? What if my PC crashes or my internet goes offline, then I never get to place the stoploss. I would very much prefer to have the ability to submit everything at once and not simulate it on my PC.

            Besides that, I don't see any paramter to tie a call to SubmitOrder to a specific signal. How is that done?

            Placing the stoploss/profittarget in Initialize is not an option, since they values will be based on a value when a specific criteria is met.
            Last edited by joely; 02-17-2015, 09:29 AM.

            Comment


              #7
              Hello Joely,

              Thank you for your response.

              SetStopLoss and SetProfitTarget cannot be set in Unmanaged Approach. You would need to use SubmitOrder() to submit exit orders. Unfortunately, you cannot directly tie an entry to an exit like in Managed Approach - this means you must use your own logic to determine when to use the exits and when to cancel them.

              Comment

              Latest Posts

              Collapse

              Topics Statistics Last Post
              Started by bortz, 11-06-2023, 08:04 AM
              47 responses
              1,603 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