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 NullPointStrategies, Today, 05:17 AM
      0 responses
      44 views
      0 likes
      Last Post NullPointStrategies  
      Started by argusthome, 03-08-2026, 10:06 AM
      0 responses
      126 views
      0 likes
      Last Post argusthome  
      Started by NabilKhattabi, 03-06-2026, 11:18 AM
      0 responses
      65 views
      0 likes
      Last Post NabilKhattabi  
      Started by Deep42, 03-06-2026, 12:28 AM
      0 responses
      42 views
      0 likes
      Last Post Deep42
      by Deep42
       
      Started by TheRealMorford, 03-05-2026, 06:15 PM
      0 responses
      46 views
      0 likes
      Last Post TheRealMorford  
      Working...
      X