Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Strategy Analyzer execution order

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

    Strategy Analyzer execution order

    Hello fellow humans,
    I'm running into a suspicious case with the strategy analyzer. For context: I have a strategy which is set to calculate on price change. The strategy enters with two entry orders at the same time (in code one line after the other). Each has its profit target (T1 and T2) and a common stop loss. Now, when T1 is hit, the stoploss gets updated to the breakeven/entry price of both positions. In the code, this happens in OnOrderUpdate. Usually, this works as intended. However, on rare occasions, when T1 is hit, the exit for the respective entry order gets executed correctly, but the other entry order hits the initial stop loss, not on the breakeven level.
    I assume that is expected to happen when prices move quick enough, i.e. quicker than the strategy updates the stop loss. The reason I'm opening this post however is that while I was inspecting the executions, I found that in such cases the execution order looks strange. In the attached image, take a look at the bottom executions. What I would expect to happen is to see Entry 5S, Entry 10 ... like with the other executions. But what seems to happen is that the first entry is processed, hits its profit target, then the second entry is processed but hits the initial stop loss.
    Is it possible to clarify that what I'm seeing here is indeed the result of rapid price movement, or has it something to do with the strategy analyzer itself?
    Further, should I expect such cases to see in live trading as well or not?
    For more context: The strategy analyzer runs with tick replay enabled. With it disabled such cases don't seem to happen, which I would say is to be expected.
    Also, why do all executions happen on the first second of each minute? And not like in between? The timeframe is 1min., but I would expect executions to happen throughout the minute if tick replay is enabled and the strategy updates more frequent than on bar close. This is something which I've noticed in general, not just this specific case. I assume that this is just how the strategy analyzer displays the executions, but I'd like a confirmation for that if possible.

    Click image for larger version

Name:	image.png
Views:	144
Size:	249.1 KB
ID:	1285557

    #2
    Hello Human#102,

    These items would require that you print out each ticks price to get a better idea of what is happening for the fills, that is not something I could answer from the screenshot. If you are trying to have more accurate fills you can turn off tick replay and instead use the high order fill resolution or add a secondary series for the purpose of fill accuracy. We have a sample that goes over that topic here: https://ninjatrader.com/support/help...ipt_strate.htm

    To know if this happens in realtime you would need to test the script in realtime and see how it works. Based on that observation you can make any modifications you may need to your logic to make it work the way you wanted.


    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by NullPointStrategies, Yesterday, 05:17 AM
    0 responses
    62 views
    0 likes
    Last Post NullPointStrategies  
    Started by argusthome, 03-08-2026, 10:06 AM
    0 responses
    134 views
    0 likes
    Last Post argusthome  
    Started by NabilKhattabi, 03-06-2026, 11:18 AM
    0 responses
    75 views
    0 likes
    Last Post NabilKhattabi  
    Started by Deep42, 03-06-2026, 12:28 AM
    0 responses
    45 views
    0 likes
    Last Post Deep42
    by Deep42
     
    Started by TheRealMorford, 03-05-2026, 06:15 PM
    0 responses
    50 views
    0 likes
    Last Post TheRealMorford  
    Working...
    X