Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Move to Breakeven with SetStopLoss in Strategy

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

    Move to Breakeven with SetStopLoss in Strategy

    Hi,

    I am developing a strategy that moves Stop Loss to Breakeven after price moves certain amount of ticks but I have run into an issue when backtesting. During backtesting there is a situation when price moves sharply within the single bar and in that case stop loss is moved to breakeven which is fine. Problem is that stop loss is now higher than bar's low and it gets executed at the bar close although the current price is well above stop loss.

    I'm using Calculate.OnEachTick.
    Primary data series is 1 minute data on ES futures
    I have added secondary data series (1 tick data) and I'm submitting orders to that data series in backtesting (as described in sample SampleIntrabarBacktest).

    I have 2 questions:
    1. is this normal behaviour or it is a bug?
    2. can I work around this issue by using unmanaged approach (since I'm using Rithmic)?

    Thank you,
    FalcoTrader



    Click image for larger version

Name:	image.png
Views:	312
Size:	10.8 KB
ID:	1273581

    #2
    Hello alausic,

    Thank you for your post.

    A strategy running real-time will produce different results than the performance results generated during a backtest.

    In backtest, Calculate is always OnBarClose unless TickReplay is enabled. Set methods cannot use TickReplay for intra-bar fills, so it is necessary to use ExitLongStopMarket submitted from OnExecutionUpdate when the entry fills, with isLiveUntilCancelled as true, and using the barsInProgress index of an added 1 tick series (intrabar granularity).

    Calculate - https://ninjatrader.com/support/help.../calculate.htm
    ExitLongStopMarket - https://ninjatrader.com/support/help...stopmarket.htm

    Please read the forum post below for more details and instructions on how to implement intrabar granularity:
    https://forum.ninjatrader.com/forum/...ive#post773377

    If you have any other questions, please let us know.

    Comment


      #3
      Hello Gaby,

      thank you for your explanation. I missed that piece of information that Set functions cannot use TickRepay. It is really pity.

      Anyway, that means I must rewrite strategy and I'm probably going to switch to unmanaged approach.

      Regards

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by CarlTrading, 05-11-2026, 05:56 AM
      0 responses
      53 views
      0 likes
      Last Post CarlTrading  
      Started by CarlTrading, 05-10-2026, 08:12 PM
      0 responses
      32 views
      0 likes
      Last Post CarlTrading  
      Started by Hwop38, 05-04-2026, 07:02 PM
      0 responses
      195 views
      0 likes
      Last Post Hwop38
      by Hwop38
       
      Started by CaptainJack, 04-24-2026, 11:07 PM
      0 responses
      356 views
      0 likes
      Last Post CaptainJack  
      Started by Mindset, 04-21-2026, 06:46 AM
      0 responses
      277 views
      0 likes
      Last Post Mindset
      by Mindset
       
      Working...
      X