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 funk10101, Today, 09:43 PM
      0 responses
      6 views
      0 likes
      Last Post funk10101  
      Started by pkefal, 04-11-2024, 07:39 AM
      11 responses
      37 views
      0 likes
      Last Post jeronymite  
      Started by bill2023, Yesterday, 08:51 AM
      8 responses
      44 views
      0 likes
      Last Post bill2023  
      Started by yertle, Today, 08:38 AM
      6 responses
      26 views
      0 likes
      Last Post ryjoga
      by ryjoga
       
      Started by algospoke, Yesterday, 06:40 PM
      2 responses
      24 views
      0 likes
      Last Post algospoke  
      Working...
      X