Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

backtesting error: Sell Stop Limit Order has been ignored

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

    backtesting error: Sell Stop Limit Order has been ignored

    I have a strategy that puts in sell stop limit order at 11/15/2024 05:46 AM. Once it is triggered, in the OnExecutionUpdate method, it will put in the stop loss order and profit target order. I am very puzzled with the following error.

    Time Category Message
    11/16/2024 12:54:42 PM Default Strategy 'SilverBulletInvertedStrategy/339703792': An order has been ignored since the stop price ‘5909’ near the bar stamped ‘11/15/2024 05:46:00’ is invalid based on the price range of the bar. This is an invalid order and subsequent orders may also be ignored.


    This is the chart I have. It should have triggered the stop but since the stop order was determined "invalid", it went to target. The debugger shows the order was placed at 05:46 AM. Entry price was 5906. It computed stop price to be 5909. The order was a sell stop limit order with stop price and limit price to be both 5906. Since the low of the bar at 05:46 AM was 5906.25, it should not trigger. However, as soon as this order was placed, the OnExecutionUpdate method was called, and Time[0] shows it is still currently 05:46 AM. Since the high of this bar was 5911.75, it rejected my stop loss order of 5909 because it was an invalid price.

    Can anyone please let me know what went wrong here? What was shown in my Visual Studio debugger was a little different from what's on the chart. The chart shows the order was triggered on 05:47 AM, which was correct. But in the debugger, when the OnExecutionUpdate method was called, Time[0] was showing 05:46AM.

    Click image for larger version

Name:	image.png
Views:	72
Size:	264.9 KB
ID:	1324810Click image for larger version

Name:	image.png
Views:	63
Size:	406.6 KB
ID:	1324811​​

    #2
    I changed it from sell stop limit to sell stop market and it started working properly. However this is very bizarre. I want to be guaranteed with the fill price so I would prefer stop limit order instead of stop market orders. It is unclear what went wrong here.

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by NullPointStrategies, Yesterday, 05:17 AM
    0 responses
    64 views
    0 likes
    Last Post NullPointStrategies  
    Started by argusthome, 03-08-2026, 10:06 AM
    0 responses
    139 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