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 argusthome, 03-08-2026, 10:06 AM
    0 responses
    66 views
    0 likes
    Last Post argusthome  
    Started by NabilKhattabi, 03-06-2026, 11:18 AM
    0 responses
    41 views
    0 likes
    Last Post NabilKhattabi  
    Started by Deep42, 03-06-2026, 12:28 AM
    0 responses
    24 views
    0 likes
    Last Post Deep42
    by Deep42
     
    Started by TheRealMorford, 03-05-2026, 06:15 PM
    0 responses
    26 views
    0 likes
    Last Post TheRealMorford  
    Started by Mindset, 02-28-2026, 06:16 AM
    0 responses
    53 views
    0 likes
    Last Post Mindset
    by Mindset
     
    Working...
    X