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

Partial Exits and StopLoss in Managed Approach

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

    Partial Exits and StopLoss in Managed Approach

    Hello,

    I'm testing my strategy (managed Approach), which send a limit order with 3 contracts of CL and set a Stop Loss and 3 different partial exit targets (1 contract each).

    At the first step, SetStopLoss works fine, it open the stop order with 3 contracts when the Limit Order fills, but there is a problem then.

    When the script close the first contract according to logic (remaining 2 contracts from the original 3 ones), the Stop Loss order does not refresh the contracts quantity (this remains with the 3 contracts). The same happens when the others partial targets trigger, the Stop Loss order remains with the original 3 contracts, never follow the sequence quantity of contracts that really remains live.

    How could I do for the SL order updates the number of contracts remaining in the position?

    BR,
    Fede

    #2
    Hello federicoo,

    Thank you for your post.

    This behavior is expected with the managed order methods. You can work around this in the managed order approach by using three unique entries with three individual signalNames, then use three individual SetStopLoss methods each that call the unique signalName for their entry order.

    For example, using the EnterLong for market orders (same concept applies to Limits and Stops):
    Code:
    EnterLong(1, "enter1");
    EnterLong(1, "enter2");
    EnterLong(1, "enter3");
    
    SetStopLoss("enter1", CalculationMode.Ticks, 5, false);
    SetStopLoss("enter2", CalculationMode.Ticks, 5, false);
    SetStopLoss("enter3", CalculationMode.Ticks, 5, false);
    Please let me know if you have any questions.

    Comment


      #3
      I will do this, but could I know when each one of these limit orders fills? How can I do this under OnExecution ?

      Thanks

      Comment


        #4
        Hello federicoo,

        Thank you for your response.

        If you use the signalNames then you can use execution.Order.Name.

        Please let me know if you have any questions.

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by chartchart, 05-19-2021, 04:14 PM
        3 responses
        577 views
        1 like
        Last Post NinjaTrader_Gaby  
        Started by bsbisme, Yesterday, 02:08 PM
        1 response
        15 views
        0 likes
        Last Post NinjaTrader_Gaby  
        Started by prdecast, Today, 06:07 AM
        0 responses
        3 views
        0 likes
        Last Post prdecast  
        Started by i019945nj, 12-14-2023, 06:41 AM
        3 responses
        60 views
        0 likes
        Last Post i019945nj  
        Started by TraderBCL, Today, 04:38 AM
        2 responses
        18 views
        0 likes
        Last Post TraderBCL  
        Working...
        X