Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Multiple SL errors

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

    Multiple SL errors

    Hello support team.
    I have faced a weird issue with error about stop loss above/below the market. The error itself is not problem for me. Let's consider it step by step. The strategy (ES, 987 ticks) implements the following scenario:
    1. The position is flat. Stop loss is placed for 40 ticks. Let's call it "original" SL.
    2. The strategy get short signal and places entry order with entry price 4300.75 (3 contracts) (stop price = 4300.75 + 40 * 0.25 = 4310.75)
    3. The strategy get target profit 1 signal by indicators and places exit order with exit price 4300.00 (2 contracts)
    4. The strategy places breakeven for the rest 1 contract as stop loss: SetStopLoss(CalculationMode.Price, 4300.75). This way "original" SL is changed.
    5. Error occurs "Sim_v4_es_987, Stop price can't be changed below the market. affected Order: BuyToCover 1 StopMarket @ 4310.75".
    I understand, the stop price is too close to the entry price. I guess the price movement possibly was so fast that stop price got below the market. It is clear to me. The unclear thing is why I see that error window for hundreds times? I guess it is displayed at each tick until the current bar is closed. The number of ticks is 987. My trading environment was heavy loaded. There is no any loop in the strategy logic because breakeven was placed in OnOrderUpdate method once TP1 has been filled. I think the loop was somewhere inside NT8 logic... Also it is unclear to me why there is 4310.75 value in the text of error and not 4300.75?

    Here is log imported from NT8 as excel file in the attachmrnt. You can check weird behaviour of error message from November 2, 3:52pm. Is it possible to be explained and what will be your suggestions? Thank you.
    Attached Files

    #2
    Hello PopovDS,

    For a buy stop ensure the price chosen is greater than GetCurrentAsk() at the time of submission, for a sell stop ensure the stop price is less than GetCurrentBid().

    https://forum.ninjatrader.com/forum/...ed#post1199001

    You've not posted the code that submits the order, so we wouldn't be able to provide any guidance..

    With Set methods, these update on every tick. (Which is why if you manually change the order price it will revert right back to the code set price)

    Use exit methods with IsLiveUntilCancelled as true if you only want these submitted once.
    Chelsea B.NinjaTrader Customer Service

    Comment


      #3
      Hello ChelseaB. Thank you for your response. Yes, I know that approach with checking of bid/ask. But in rare occasions when price movement is unpredictable and very-very fast it may not work, correct? The main problem that I want to point to is hundreds of error windows. I would like to avoid it in future.

      Comment


        #4
        Hello PopovDS,

        It could still be rejected in a really fast moving market, but generally as long as it's at least one tick above the ask or below the bid it should be ok.

        Use Exit methods instead of Set methods to avoid the hundreds of error windows.

        See the 'ProfitChaseStopTrailExitOrdersExample' example linked below.
        Chelsea B.NinjaTrader Customer Service

        Comment


          #5
          Your suggestion "Use exit methods with IsLiveUntilCancelled as true if you only want these submitted once."... Do you mean usage of ExitLongLimit and ExitShortLimit methods instead of SetStopLoss one?

          Comment


            #6
            Hello PopovDS,

            Yes, this is what I am referring to. (Though for a stop loss it would be ExitLongStopMarket()/ExitShortStopMarket())
            Chelsea B.NinjaTrader Customer Service

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by NullPointStrategies, Yesterday, 05:17 AM
            0 responses
            71 views
            0 likes
            Last Post NullPointStrategies  
            Started by argusthome, 03-08-2026, 10:06 AM
            0 responses
            143 views
            0 likes
            Last Post argusthome  
            Started by NabilKhattabi, 03-06-2026, 11:18 AM
            0 responses
            76 views
            0 likes
            Last Post NabilKhattabi  
            Started by Deep42, 03-06-2026, 12:28 AM
            0 responses
            47 views
            0 likes
            Last Post Deep42
            by Deep42
             
            Started by TheRealMorford, 03-05-2026, 06:15 PM
            0 responses
            51 views
            0 likes
            Last Post TheRealMorford  
            Working...
            X