Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Stop Loss - Buy Stop below the market

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

    Stop Loss - Buy Stop below the market

    Hello,

    I got this error with a strategy processing each incoming tick. I attach 3 screenshots: with error messages, with orders and zoomed in chart.

    The error occurred at bar ending at 15.07.2015 03:05. The stop loss is set so that it corresponds to a 0.25 price offset.

    As I understand first EnterShort is submitted at 569.50 (Open price). The corresponding Buy stop is submitted at 569.75 (High price). Then the next EnterShort is submitted at 569.00. The corresponding Buy stop is submitted at 569.25 and it happens to be below the market. Maybe because the price at the current tick is greater than 569.25?

    Now I have some questions regarding this situation:

    I see in the error message that "strategy attempted to close the position". Is always Exit order sent before the strategy terminate itself?

    Is there any way to avoid this termination?

    Thanks,

    Valentin
    Attached Files

    #2
    Hello Valentin,

    Thanks for your post.

    The order was not sent as this was rejected due to an incorrect price.

    The strategy will become disabled anytime an order is rejected or when an overfill occurs.

    It is possible to allow a strategy to continue running after a rejection by setting RealTimeErrorHandling to TakeNoAction, however, I would not recommend this.

    Below is a link to the help guide on RealTimeErrorHandling.
    http://ninjatrader.com/support/helpG...orhandling.htm


    My recommendation would be to check the current ask price and ensure that your order is higher than this.

    First start with a print one line before the order is being placed so you can see the actual prices that are causing the rejection:

    if (/* conditions to enter*/)
    {
    double stopPrice = High[0]+1*TickSize; // <- this is the stop price you are able to set the order to
    Print(DateTime.Now.ToString()+" | CurrentAsk: "+GetCurrentAsk()+" | entry1 stop price: "+stopPrice);
    myOrder = EnterLongStop(stopPrice);
    }

    This would print the current ask and the price of your stop so you can see if you price is lower.


    Then change your conditions to use the current ask price if the current ask price is lower than your stop price.
    Chelsea B.NinjaTrader Customer Service

    Comment


      #3
      Thank you Chelsea,

      It is a stop loss order that is rejected. Currently the stop loss is set with the loss, corresponding to the price offset from entry price. Your recommendation means that I should use CalculationMode.Price for SetStopLoss. In this way the offset will be always large enough so that stop loss price is above current Ask (for short position) or below current Bid (for long position).

      Is it correct?

      Valentin

      Comment


        #4
        Hi Valentin,

        If you are using SetStopLoss then I would recommend using a number of ticks with CalculationMode.Ticks.

        Then you shouldn't be able to set a price that is invalid. (Unless you use 1 tick in a very fast moving market)


        If you are going to use CalculationMode.Price, then you need to make sure that the price is a valid price and set this price to the stop loss before the entry order fills (so that it is not placed using an old price).
        Chelsea B.NinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by Geovanny Suaza, 02-11-2026, 06:32 PM
        0 responses
        572 views
        0 likes
        Last Post Geovanny Suaza  
        Started by Geovanny Suaza, 02-11-2026, 05:51 PM
        0 responses
        331 views
        1 like
        Last Post Geovanny Suaza  
        Started by Mindset, 02-09-2026, 11:44 AM
        0 responses
        101 views
        0 likes
        Last Post Mindset
        by Mindset
         
        Started by Geovanny Suaza, 02-02-2026, 12:30 PM
        0 responses
        549 views
        1 like
        Last Post Geovanny Suaza  
        Started by RFrosty, 01-28-2026, 06:49 PM
        0 responses
        550 views
        1 like
        Last Post RFrosty
        by RFrosty
         
        Working...
        X