Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

SetProfitTarget and Limit order

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

    SetProfitTarget and Limit order

    Is SetProfitTarget using a limit order?

    If I use the following code:

    SetProfitTarget("", CalculationMode.Ticks, 5, true);

    Is the 5 tick counted from "Close[0]" or the "Position.AveragePrice"?


    I tried using an explicit limit order to replace SetProfitTarget:

    if (BuySignal == true)
    {
    EnterLongLimit(Close[0], "T2");
    ExitLongLimit(Close[0] + (5.0 * TickSize), "T2");
    }

    Please refer to the attachment.

    The strategy was supposed to exit the long position after 5 tick. But it did not until it hit the stop loss.
    May I have some enlightenment on this?

    I think of that maybe the limit order with the same signal name has not been cancelled after the previous trade ended with a stop loss. May that be the case? How can I cancelled the exit limit order when the trade is hit by a stop loss?

    Thank you!
    Attached Files

    #2
    Hi alantse123, thanks for your question.

    SetProfitTarget uses the Position.AveragePrice property to calculate the stop.

    We have a full example on setting up manual protective orders here:
    https://ninjatrader.com/support/help...and_onexec.htm

    That will demonstrate how to set up the protective orders in "OCO" or Once cancels other.

    We also have an example here that demonstrates how to cancel an order:
    https://ninjatrader.com/support/help...thod_to_ca.htm

    Please let me know if I can assist any further.

    Comment


      #3
      Originally posted by NinjaTrader_ChrisL View Post
      Hi alantse123, thanks for your question.

      SetProfitTarget uses the Position.AveragePrice property to calculate the stop.

      We have a full example on setting up manual protective orders here:
      https://ninjatrader.com/support/help...and_onexec.htm

      That will demonstrate how to set up the twc mail protective orders in "OCO" or Once cancels other.

      We also have an example here that demonstrates how to cancel an order:
      https://ninjatrader.com/support/help...thod_to_ca.htm

      Please let me know if I can assist any further.
      Thnks for the helpful links. I've been tangled in this scenario for about a week now. Finnally got the solutions. Hope this helps
      Last edited by jrjong; 07-08-2020, 08:49 PM.

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by CarlTrading, 03-31-2026, 09:41 PM
      1 response
      80 views
      1 like
      Last Post NinjaTrader_ChelseaB  
      Started by CarlTrading, 04-01-2026, 02:41 AM
      0 responses
      40 views
      0 likes
      Last Post CarlTrading  
      Started by CaptainJack, 03-31-2026, 11:44 PM
      0 responses
      63 views
      2 likes
      Last Post CaptainJack  
      Started by CarlTrading, 03-30-2026, 11:51 AM
      0 responses
      63 views
      0 likes
      Last Post CarlTrading  
      Started by CarlTrading, 03-30-2026, 11:48 AM
      0 responses
      54 views
      0 likes
      Last Post CarlTrading  
      Working...
      X