Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Buy Stop or Buy Stop Limit Orders Can't Be Placed Below The Market

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

    Buy Stop or Buy Stop Limit Orders Can't Be Placed Below The Market

    Hello,
    I'm working through some ways to avoid these error messages in my strategy so my order is placed correctly based on the LastPrice which I have from OnMarketData. This works 75% of the time but there must be one or more choices to avoid the error message entirely. Maybe I need more ticks between the stop and limit prices...

    Code:
    //NEW TEST
    //entryPrice is my desired LimitPriceEntry
    if (entryPrice> 0){
    	//Limit price can't be less than stop price - is this true?
    //not sure the best adjustment to use for the limit and stop prices
    	limitOrderPriceL = entryPrice + 0 * TickSize;
    	stopOrderPriceL = entryPrice - 1 * TickSize;
    	}
    
    	//Buy stop or buy stop limit orders can't be placed below the market
    	//Therefore BuyStop or BuyStopLimit must be placed above the market
    	//Therefore BuyLimit must be placed below the market
    	if (entryPrice > LastPrice)//testing "="?
    	{
    		entryOrder = EnterLongStopLimit(0, true, 1, limitOrderPriceL,stopOrderPriceL, "long stop limit entry");
    	}
    	else
    	{     
                    entryOrder = EnterLongLimit(0, true, 1, limitOrderPriceL, "long limit entry");
    	}
    Please help with any advice you can.
    Thanks,
    Last edited by zeller4; 10-31-2014, 08:39 PM.

    #2
    Originally posted by zeller4 View Post
    Hello,
    I'm working through some ways to avoid these error messages in my strategy so my order is placed correctly based on the LastPrice which I have from OnMarketData. This works 75% of the time but there must be one or more choices to avoid the error message entirely. Maybe I need more ticks between the stop and limit prices...

    Code:
    //NEW TEST
    //entryPrice is my desired LimitPriceEntry
    if (entryPrice> 0){
    	//Limit price can't be less than stop price - is this true?
    //not sure the best adjustment to use for the limit and stop prices
    	limitOrderPriceL = entryPrice + 0 * TickSize;
    	stopOrderPriceL = entryPrice - 1 * TickSize;
    	}
    
    	//Buy stop or buy stop limit orders can't be placed below the market
    	//Therefore BuyStop or BuyStopLimit must be placed above the market
    	//Therefore BuyLimit must be placed below the market
    	if (entryPrice > LastPrice)//testing "="?
    	{
    		entryOrder = EnterLongStopLimit(0, true, 1, limitOrderPriceL,stopOrderPriceL, "long stop limit entry");
    	}
    	else
    	{     
                    entryOrder = EnterLongLimit(0, true, 1, limitOrderPriceL, "long limit entry");
    	}
    Please help with any advice you can.
    Thanks,
    Check the current price against the order price, and if exceeded, place either a Limit of Market order instead of a Stop entry order. This is exactly what you would do if you were manually clicking the mouse. Just mimic it.

    Comment


      #3
      Hello Zeller4,

      Thank you for your post.

      Koganam's suggestion is correct. You will want to check the current close price against the order price and then take according action based on that info.
      Cal H.NinjaTrader Customer Service

      Comment


        #4
        Thanks Koganam and Cal,

        so, if I understand correctly, I wouldn't have an "else" to be able to select two different types of orders in case the condition between the desired limit price and the current price changes if the fill didn't happen?
        Last edited by zeller4; 11-01-2014, 07:44 PM.

        Comment


          #5
          Originally posted by zeller4 View Post
          Thanks Koganam and Cal,

          so, if I understand correctly, I wouldn't have an "else" to be able to select two different types of orders in case the condition between the desired limit price and the current price changes if the fill didn't happen?
          Code:
          double entryPrice = ???? //the result of some calculation or condition
          double stopPrice = ???? //determined per your trading style or requirements
          if (GetCurrentAsk() < entryPrice) EnterLongStopLimit(...);
          else EnterLongLimit(...);
          is an example of the skeleton of what you would do.

          Comment


            #6
            Thanks koganam,

            I'm also searching for the answer of the what the distance between the stop and limit should be from each other. At least to avoid error messages regarding order placement.

            Code:
            limitOrderPriceL = entryPrice + x * TickSize;
            stopOrderPriceL = entryPrice + y * TickSize;
            					
            
            entryOrder = EnterLongStopLimit(0, true, 1, limitOrderPriceL,stopOrderPriceL, "long limit entry");
            what should "x" or "y" be? and which should be "above(for long)" the other?

            Comment


              #7
              Originally posted by zeller4 View Post
              Thanks koganam,

              I'm also searching for the answer of the what the distance between the stop and limit should be from each other. At least to avoid error messages regarding order placement.

              Code:
              limitOrderPriceL = entryPrice + x * TickSize;
              stopOrderPriceL = entryPrice + y * TickSize;
              					
              
              entryOrder = EnterLongStopLimit(0, true, 1, limitOrderPriceL,stopOrderPriceL, "long limit entry");
              what should "x" or "y" be? and which should be "above(for long)" the other?
              They can be anything, as long as the stopPrice is not more than the limitPrice. So, in your case, if x >= y, the order will not be rejected.

              Comment

              Latest Posts

              Collapse

              Topics Statistics Last Post
              Started by Geovanny Suaza, 02-11-2026, 06:32 PM
              0 responses
              633 views
              0 likes
              Last Post Geovanny Suaza  
              Started by Geovanny Suaza, 02-11-2026, 05:51 PM
              0 responses
              364 views
              1 like
              Last Post Geovanny Suaza  
              Started by Mindset, 02-09-2026, 11:44 AM
              0 responses
              105 views
              0 likes
              Last Post Mindset
              by Mindset
               
              Started by Geovanny Suaza, 02-02-2026, 12:30 PM
              0 responses
              567 views
              1 like
              Last Post Geovanny Suaza  
              Started by RFrosty, 01-28-2026, 06:49 PM
              0 responses
              568 views
              1 like
              Last Post RFrosty
              by RFrosty
               
              Working...
              X