Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Setting a Stop Loss to Activate before Interval Close

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

    Setting a Stop Loss to Activate before Interval Close

    I’m fairly new to developing using NinjaTrader and would really appreciate some help with this.
    I’m running 10 minute interval bars, but in cases of rare volatility the unrealized P/L will exceed my stop loss I’ve set (-4%). I need the rest of the variables for entries/exits to calculate on bar close, but the stop loss needs to be calculated at (what I assume to be) a lower interval rate so the close of the 10 minute bar doesn’t have a massive loss exceeding the -4%.

    Is it best to set a lower interval bar specifically for this stop loss, and if so, how do I create a custom interval for this specific exit. Alternatively, if there’s an easier/better way of doing this (where the exit will occur before the end of the 10 minute interval if the unrealized P/L is met) I’d appreciate the advice.
    Thanks


    //Stop Loss -0.04
    if (Position.GetProfitLoss(Close[0], PerformanceUnit.Percent) < -0.04)
    {

    ExitShortLimit(GetCurrentAsk(), "S1L", "S1");
    ExitLongLimit(GetCurrentBid(), "L1L", "L1");
    }

    Last edited by stealthtrading; 04-07-2016, 08:54 PM. Reason: Clarification

    #2
    Hello stealthtrading,

    Thank you for your note.

    As this would require switching between calculating on the bar close and on each tick you would need to look into our sample at the following link: http://ninjatrader.com/support/forum...ad.php?t=19387

    Please let me know if you have any questions.

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by pibrew, Today, 06:10 PM
    1 response
    16 views
    0 likes
    Last Post NinjaTrader_Manfred  
    Started by actualfacts.2021, 07-25-2021, 03:11 PM
    8 responses
    1,182 views
    0 likes
    Last Post linkcou
    by linkcou
     
    Started by reynoldsn, Today, 07:11 PM
    0 responses
    4 views
    0 likes
    Last Post reynoldsn  
    Started by needsomehelp147, 04-29-2024, 06:43 AM
    2 responses
    20 views
    0 likes
    Last Post needsomehelp147  
    Started by sidlercom80, 10-28-2023, 08:49 AM
    177 responses
    2,401 views
    0 likes
    Last Post jeronymite  
    Working...
    X