Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Controlling when trailing stops are entered

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

    Controlling when trailing stops are entered

    I'm having some issues setting my trailing stops and appreciate any overview advice on how to do it in NT.

    I want to enter my trailing stop only after a certain number of bars since entry.

    I thus wrote:
    if (BarsSinceEntry() > 5)
    {
    SetStopLoss(blah, blah);
    }

    However, I see that NT is in fact firing my stoploss the same bar I have my entry...I read that this is the default in the helpfile.

    Anyway, I do not want that - how do I take control of when my stop loss is entered? I don't want NT's default behaviour and yet everything I code, it ignores and puts it in right away regardless.

    In addition, I note that in backtesting, having the stop loss fire on the same bar is also resulting in ridiculous stop outs...its fairly clear that NT is making some gross, worst case assumptions about what happened in that bar and stopping you out based simply on whether your stop *could have been hit* and not whether it really was hit (i.e. the width of a 10 min bar covers the stop, but looking at the minute chart you see that from entry to close of the bar, the stop loss was never touched)...so if there is any info on how to control that as well, I would appreciate it.

    Thanks

    #2
    Never mind, figured it out.

    SetStopLoss autofires regardless of conditions surrounding it...it fires when you original entry takes place.

    ExitLongStop() gives you the ability to wrapper your exit stops in controllable conditions....


    That said, any info on how to control NT's behaviour of what happens inside a bar during backtesting would be appreciated. Its clear its taking the worst case scenario (which is fine) but I want to see if there any 'look inside the bar' controllable options.

    Comment


      #3
      You would need to add a reference to an intrabar granularity for this -

      You can submit orders to different Bars objects. This allows you the flexibility of submitting orders to different timeframes. Like in live trading, taking entry conditions from a 5min chart means executing your order as soon as possible instead of waiting until the next 5min bar starts building. You can achieve this by


      NinjaTrader would always take the most conservative approach to fills, thus if both stop and target could have triggered intrabar, we would assume it was the stop...

      Comment


        #4
        Thanks Bertrand...thats what I needed, and that reference section is a gold mine - I didn't realize it was there but its a huge help.

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by Geovanny Suaza, 02-11-2026, 06:32 PM
        0 responses
        648 views
        0 likes
        Last Post Geovanny Suaza  
        Started by Geovanny Suaza, 02-11-2026, 05:51 PM
        0 responses
        369 views
        1 like
        Last Post Geovanny Suaza  
        Started by Mindset, 02-09-2026, 11:44 AM
        0 responses
        109 views
        0 likes
        Last Post Mindset
        by Mindset
         
        Started by Geovanny Suaza, 02-02-2026, 12:30 PM
        0 responses
        573 views
        1 like
        Last Post Geovanny Suaza  
        Started by RFrosty, 01-28-2026, 06:49 PM
        0 responses
        576 views
        1 like
        Last Post RFrosty
        by RFrosty
         
        Working...
        X