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:	298
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 NullPointStrategies, Today, 05:17 AM
      0 responses
      32 views
      0 likes
      Last Post NullPointStrategies  
      Started by argusthome, 03-08-2026, 10:06 AM
      0 responses
      124 views
      0 likes
      Last Post argusthome  
      Started by NabilKhattabi, 03-06-2026, 11:18 AM
      0 responses
      64 views
      0 likes
      Last Post NabilKhattabi  
      Started by Deep42, 03-06-2026, 12:28 AM
      0 responses
      41 views
      0 likes
      Last Post Deep42
      by Deep42
       
      Started by TheRealMorford, 03-05-2026, 06:15 PM
      0 responses
      46 views
      0 likes
      Last Post TheRealMorford  
      Working...
      X