Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

SetTrailStop not working on simple strategy

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

    SetTrailStop not working on simple strategy

    Hi - the instrument is ^DJIA and I'd like to set a trail stop of 10 Dow points for every trade. I'm working with 1000 range bars.

    The relevant part of my code looks like this:

    protected override void Initialize()
    {
    SetTrailStop("Longtrade", CalculationMode.Ticks, 10, true);
    CalculateOnBarClose = true;

    ...

    protected override void OnBarUpdate()

    ... conditions...

    EnterLong(1, "Longtrade");


    There's something here that isn't right and I'm sure the trail stops aren't being entered properly. I can tell visually this is a fairly profitable strategy yet in the Analyzer, the it just loses and loses!

    I wonder if a possible source of confusion is that with ^DJIA, Range = 1000 is the same as 10 points in the Dow. This is something which I've never really fathomed.

    By the way, I'm using a Sim account.

    Thanks for any help you can provide.

    #2
    arbuthnot,

    I am happy to assist you.

    There are known discrepancies in live trading vs. backtesting : http://www.ninjatrader.com/support/h...ime_vs_bac.htm

    You could try using the following reference to give your strategy intrabar granularity in backtesting.

    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


    The ticks would be set by the instrument you are trading, so if 1 tick is 0.1 this would be used in calculating the strategy's stop loss.

    Please let me know if I may assist further.
    Adam P.NinjaTrader Customer Service

    Comment


      #3
      Thanks, Adam. With your help, I seem to have got these auto trails figured out now. I was indeed using the wrong 'tick' amount corresponding to the instrument in question.

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by Geovanny Suaza, 02-11-2026, 06:32 PM
      0 responses
      672 views
      0 likes
      Last Post Geovanny Suaza  
      Started by Geovanny Suaza, 02-11-2026, 05:51 PM
      0 responses
      379 views
      1 like
      Last Post Geovanny Suaza  
      Started by Mindset, 02-09-2026, 11:44 AM
      0 responses
      111 views
      0 likes
      Last Post Mindset
      by Mindset
       
      Started by Geovanny Suaza, 02-02-2026, 12:30 PM
      0 responses
      577 views
      1 like
      Last Post Geovanny Suaza  
      Started by RFrosty, 01-28-2026, 06:49 PM
      0 responses
      582 views
      1 like
      Last Post RFrosty
      by RFrosty
       
      Working...
      X