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 Mindset, 04-21-2026, 06:46 AM
      0 responses
      90 views
      0 likes
      Last Post Mindset
      by Mindset
       
      Started by M4ndoo, 04-20-2026, 05:21 PM
      0 responses
      137 views
      0 likes
      Last Post M4ndoo
      by M4ndoo
       
      Started by M4ndoo, 04-19-2026, 05:54 PM
      0 responses
      68 views
      0 likes
      Last Post M4ndoo
      by M4ndoo
       
      Started by cmoran13, 04-16-2026, 01:02 PM
      0 responses
      120 views
      0 likes
      Last Post cmoran13  
      Started by PaulMohn, 04-10-2026, 11:11 AM
      0 responses
      69 views
      0 likes
      Last Post PaulMohn  
      Working...
      X