Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Confusion about ExitLongStop()

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

    Confusion about ExitLongStop()

    I’m confused about the use of ExitLongStop().

    Say I have a long position.

    Code:
    [FONT=Courier New][COLOR=black][COLOR=black][FONT=Courier New]entryOrder = EnterLong(0, 100, For the entry order (within OnBarUpdate):
    [/COLOR][COLOR=maroon][FONT=Courier New]"Long Entry"[/FONT][/COLOR][COLOR=black][FONT=Courier New]);[/FONT][/COLOR]
    [/COLOR][/FONT]
    [/FONT]
    I want to set a stop loss, below my entry, with a stop limit order (which will execute as a market order if price drops to the stop price).

    Code:
    [FONT=Courier New][COLOR=black][COLOR=black][FONT=Courier New]stopOrder = ExitLongStop(0, For the stop loss order (within OnBarUpdate):
    [/COLOR][COLOR=blue][FONT=Courier New]true[/FONT][/COLOR][COLOR=black][FONT=Courier New], [/FONT][/COLOR][COLOR=black][FONT=Courier New]100[/FONT][/COLOR][COLOR=black][FONT=Courier New], Positions[0].AvgPrice - (stopLoss*[/FONT][/COLOR][COLOR=purple][FONT=Courier New]0.01[/FONT][/COLOR][COLOR=black][FONT=Courier New]), [/FONT][/COLOR][COLOR=maroon][FONT=Courier New]"Long Entry - Stop"[/FONT][/COLOR][COLOR=black][FONT=Courier New], [/FONT][/COLOR][COLOR=maroon][FONT=Courier New]"Long Entry"[/FONT][/COLOR][COLOR=black][FONT=Courier New]);[/FONT][/COLOR]
    [/COLOR][/FONT]
    [/FONT]
    I also want to set a target, above my entry, also using a stop limit order (again, which will execute as a market order if my target price is touched).

    For the target order (within OnExecution):
    Code:
    [COLOR=black][FONT=Courier New]targetOrder = ExitLongStop(0, [COLOR=blue][FONT=Courier New]true[/COLOR][COLOR=black][FONT=Courier New], execution.Order.Filled, execution.Order.AvgFillPrice + (profitTarget*[/FONT][/COLOR][COLOR=purple][FONT=Courier New]0.01[/FONT][/COLOR][COLOR=black][FONT=Courier New]) , [/FONT][/COLOR][COLOR=maroon][FONT=Courier New]"Long Entry - Target"[/FONT][/COLOR][COLOR=black][FONT=Courier New], [/FONT][/COLOR][COLOR=maroon][FONT=Courier New]"Long Entry"[/FONT][/COLOR][COLOR=black][FONT=Courier New]);   [/FONT][/COLOR]
    [/FONT][/COLOR]
    [/FONT]
    I am coding the orders as above, but TraceOrders reports that the target order is cancelled as the stop price (in the target order) is not valid.

    Am I using ExitLongStop() correctly for the target order?

    Any ideas what’s wrong or what I should do to achieve what I am after?

    Many thanks.

    #2
    You are confusing Long Stop, with Stop Loss, Long Stop is the limit price for entering long orders, StopLoss is what you need, look it up in help.
    Don't feel too bad, I know this because I did the same thing.

    Comment


      #3
      Hi AnotherTrader,

      In your targetOrder, it looks like you're using an ExitLongStop() still, though you mentioned you wanted to use an ExitLongStopLimit()

      Your ExitLongStop() is invalid if submitted with a price above the market.

      More info on ExitLongStopLimit - http://www.ninjatrader-support.com/H...?ExitStopLimit
      TimNinjaTrader Customer Service

      Comment


        #4
        Originally posted by NinjaTrader_Tim View Post
        In your targetOrder, it looks like you're using an ExitLongStop() still, though you mentioned you wanted to use an ExitLongStopLimit()
        Tim, I don't think this is correct.

        I am looking for a target order which will execute as a market order if my target price is touched.

        According to the link you posted, ExitLongStopLimit() will generate a sell stop limit (i.e. not market) order to exit a long position.

        Comment


          #5
          Originally posted by NinjaTrader_Tim View Post
          Your ExitLongStop() is invalid if submitted with a price above the market.
          OK, fair enough; so in NT, an ExitLongStop() command can only be used to execute an exit on the loss side of the trade. Thank you for clearing that up ...

          How can I therefore achieve what I am looking for?

          I want an NT order type that will allow me to exit (on the profit side) with a market order if my target price is touched (n.b. ExitLongLimit() doesn't do the trip as it exits with a limit order).

          Thanks.

          Comment


            #6
            Originally posted by Sleeping Troll View Post
            ...StopLoss is what you need, look it up in help...
            No, Long Stop is what I need (which is why I though the ExitLongStop() would do the trick).

            Look it up in help.
            Last edited by AnotherTrader; 04-27-2010, 09:17 AM.

            Comment


              #7
              Hi AnotherTrader,

              If you want to submit a market order to exit the position, you can use ExitLong() that is conditioned to exit at the price you want.

              For example...

              Code:
              if (Close[0] > #)
              ExitLong();
              The ExitLongStop is a Stop order that cannot be submitted above the current market price.
              TimNinjaTrader Customer Service

              Comment

              Latest Posts

              Collapse

              Topics Statistics Last Post
              Started by Kaledus, Today, 01:29 PM
              0 responses
              3 views
              0 likes
              Last Post Kaledus
              by Kaledus
               
              Started by PaulMohn, Today, 12:36 PM
              1 response
              16 views
              0 likes
              Last Post NinjaTrader_Gaby  
              Started by yertle, Yesterday, 08:38 AM
              8 responses
              37 views
              0 likes
              Last Post ryjoga
              by ryjoga
               
              Started by rdtdale, Today, 01:02 PM
              1 response
              6 views
              0 likes
              Last Post NinjaTrader_LuisH  
              Started by alifarahani, Today, 09:40 AM
              3 responses
              19 views
              0 likes
              Last Post NinjaTrader_Jesse  
              Working...
              X