Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Issue with ExitShortStopLimit causing Errors

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

    Issue with ExitShortStopLimit causing Errors

    Hi NT8,

    when I am short and then create an order with ExitShortStopLimit using the code below, I get an error box. However, I don't get the same error when I am long - it creates the ExitLongStopLimit using the same code below. I simply want to create a stop for my orders in my strategy without using MIT orders for shorts. please help thank you: See snapshot for clarification.



    Short - does not work - gives error box

    if ( ShortEntry())

    {
    EntryPriceShort1 = (GetCurrentAsk(0));
    EnterShortLimit(Convert.ToInt32(1), GetCurrentAsk(0), @"1");
    }

    if ((Position.MarketPosition == MarketPosition.Short))
    {
    ExitShortStopLimit(Convert.ToInt32(1), EntryPriceShort1 + 3.00 , "", @"1");
    }




    Long - works - no error box

    if ( LongEntry())

    {
    EntryPriceLong1 = (GetCurrentAsk(0));
    EnterLongLimit(Convert.ToInt32(1), GetCurrentBid(0), @"1");
    }

    if ((Position.MarketPosition == MarketPosition.Long))
    {
    ExitLongStopLimit(Convert.ToInt32(1), EntryPriceShort1 - 3.00 , "", @"1");
    }

    Attached Files

    #2
    Hello Austiner87,

    Your screenshot appears to disagree with you.
    In the screenshot, this is a buy stop limit order shown.
    This has the limit price below the stop price.

    As you are providing a price of $1 for the limit price, this is invalid as the limit price of a buy stop limit order must be equal to or above the stop price.
    For a sell stop limit order, the limit price must be equal to or below the stop price.

    ExitShortStopLimit(double limitPrice, double stopPrice, string signalName, string fromEntrySignal)


    Try setting the limit price to the same price as the stop price.

    Chelsea B.NinjaTrader Customer Service

    Comment


      #3
      Extremely helpful, thank you!

      Comment


        #4
        Hello, this seemed to help in most cases as I am not getting constant error messages, but I am still getting a good number. My code is below for my StopLimitExits, I am trying to replicate the ATM strategy by having my stoplimit follow behind the price of the instrument a few ticks. second snapshot is the error message I get.

        asking for help in how I change the code to avoid all (or nearly all) error messages. Thank you!!!
        Attached Files

        Comment


          #5
          Hello Austiner87,

          The error 'Stop price can't be changed below the market' means you are choosing an invalid stop price for a stop order.

          This is a buy to cover. A buy stop order must be above the current ask. A sell stop must be below the current bid.

          Choose a price at least 1 tick above GetCurrentAsk().
          Chelsea B.NinjaTrader Customer Service

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by NullPointStrategies, Yesterday, 05:17 AM
          0 responses
          56 views
          0 likes
          Last Post NullPointStrategies  
          Started by argusthome, 03-08-2026, 10:06 AM
          0 responses
          133 views
          0 likes
          Last Post argusthome  
          Started by NabilKhattabi, 03-06-2026, 11:18 AM
          0 responses
          73 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
          49 views
          0 likes
          Last Post TheRealMorford  
          Working...
          X