Announcement

Collapse

Looking for a User App or Add-On built by the NinjaTrader community?

Visit NinjaTrader EcoSystem and our free User App Share!

Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less

Partner 728x90

Collapse

How to add two SetProfitTargets for one Entry order?

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

    How to add two SetProfitTargets for one Entry order?

    When I use a managed approach, I place one limit order 2 lots. Then I want to place two profit targets by 1 lot each. Can I do that using the Managed Approach?

    Can you provide me an example of code doing that?
    Thank you.
    Handlar
    NinjaTrader Ecosystem Vendor - Handlar

    #2
    Hello handlar,

    Thanks for your post.

    In the managed approach, the "set" methods will only deal with the total position (note that there is not a quantity field in the set method overloads), however this can be done through the use of "signal names" as described in the help guide for managed approach here: (See the section, " Order Entry Methods"): https://ninjatrader.com/support/help...d_approach.htm

    Using signal names would require you to place two entry orders with a different signal name, then you can create the set methods with those signal names and their respective target/stop values. The signal names also auto create the OCO relationship between SetProfit and SetStopLoss.

    Example:

    if (entry Condition)
    {
    SetProfitTarget("my1stentry, CalculationMode.Ticks, 10);
    SetProfitTarget("my2ndentry, CalculationMode.Ticks, 20);
    SetStopLoss(CalculationMode.Ticks, 10); // would apply to both entries if there there is no other signal named set stop loss.
    EnterLongLimit( 1, myLimitPrice, "my1stentry");
    EnterLongLimit( 1, myLimitPrice, "my2ndentry");
    }


    Please Note that this will also require you to change the setting of entries per direction or EntryHandling:


    Here is another example using multiple entry and exits (Not using set methods): https://ninjatrader.com/support/help..._exit_sign.htm
    Paul H.NinjaTrader Customer Service

    Comment


      #3
      Thank you, PaulH! I'll try this approach.
      Handlar
      NinjaTrader Ecosystem Vendor - Handlar

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by RideMe, 04-07-2024, 04:54 PM
      6 responses
      31 views
      0 likes
      Last Post RideMe
      by RideMe
       
      Started by tkaboris, Today, 05:13 PM
      0 responses
      2 views
      0 likes
      Last Post tkaboris  
      Started by GussJ, 03-04-2020, 03:11 PM
      16 responses
      3,281 views
      0 likes
      Last Post Leafcutter  
      Started by WHICKED, Today, 12:45 PM
      2 responses
      19 views
      0 likes
      Last Post WHICKED
      by WHICKED
       
      Started by Tim-c, Today, 02:10 PM
      1 response
      10 views
      0 likes
      Last Post NinjaTrader_ChelseaB  
      Working...
      X