Announcement

Collapse

Looking for a User App or Add-On built by the NinjaTrader community?

Visit NinjaTrader EcoSystem and our free User App Share!

Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less

Partner 728x90

Collapse

Bug

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

    Bug

    Hi

    My strategy was trying to place a buy limit order and I got the message "Buy Stop or Buy Limit Orders cannot be placed below the market"

    Surely a buy limit order HAS to be placed below the market ... It could not have been a buy stop order as my strategy only places buy limit orders

    Any help or insight appreciated ...

    Thanks

    Paul

    #2
    Hi Paul, could it be that you tried placing a StopLimit order below the market? If yes, try placing a regular limit order instead.
    BertrandNinjaTrader Customer Service

    Comment


      #3
      Originally posted by NinjaTrader_Bertrand View Post
      Hi Paul, could it be that you tried placing a StopLimit order below the market? If yes, try placing a regular limit order instead.
      Hi

      I am only using EnterLongLimit & EnterShortLimit - they are correct for regular limit orders?

      Thanks

      Comment


        #4
        murfinp,

        Please provide the exact code you are using. You need to submit at valid prices for any order type you submit.
        Josh P.NinjaTrader Customer Service

        Comment


          #5
          Originally posted by NinjaTrader_Josh View Post
          murfinp,

          Please provide the exact code you are using. You need to submit at valid prices for any order type you submit.
          Josh

          Here you go ...

          ==================
          protected void openLongs() {

          double currAsk;
          double prc;

          flattenAll(false,"Open Longs");

          currAsk = GetCurrentAsk();

          stopLossPrice = currAsk - maxPosition*TickSize - TickSize*stopLossAdjustment;
          SetStopLoss(CalculationMode.Price,stopLossPrice);
          cancelOrdersPrice = currAsk + targetCancelOrders*TickSize;

          for (int i= 1; i<= noOrders;i++) {
          prc = currAsk -(i-1)*TickSize;
          SetProfitTarget("BuyLimitOrder "+prc.ToString(),CalculationMode.Ticks,targetTicks );
          listOpenOrders.Add(EnterLongLimit(0,true,1,prc,"Bu yLimitOrder "+prc.ToString()));
          }

          lastAction = ACTIONOPENEDLONGS;
          }

          Comment


            #6
            You need to ensure prc is a valid price. It likely is not. You can only buy at the ask or above, yet here you have outlined a price below the ask.
            Josh P.NinjaTrader Customer Service

            Comment


              #7
              Originally posted by NinjaTrader_Josh View Post
              You need to ensure prc is a valid price. It likely is not. You can only buy at the ask or above, yet here you have outlined a price below the ask.
              Josh

              It is a buy limit so it has to be at/below the ask??

              Paul

              Comment


                #8
                Pardon the typo, but what you have outlined is still erroneous. You are likely running on a liquid market where the time difference from when you calcualte the ask to when the order is submitted, the actual market price is now lower than what you submitted your limit at. You should not place orders so close to the inside market because of movement that can very quickly and easily make your orders invalid and rejected when they reach the brokerage/exchange.
                Josh P.NinjaTrader Customer Service

                Comment


                  #9
                  Originally posted by murfinp View Post
                  for (int i= 1; i<= noOrders;i++) {
                  prc = currAsk -(i-1)*TickSize;
                  SetProfitTarget("BuyLimitOrder "+prc.ToString(),CalculationMode.Ticks,targetTicks );
                  listOpenOrders.Add(EnterLongLimit(0,true,1,prc,"Bu yLimitOrder "+prc.ToString()));
                  }
                  Hi Paul,

                  not sure if you are aware of, but for int i = 1 you submit a limit order at the ask price. It is very close to the market.

                  Regards
                  Ralph

                  Comment


                    #10
                    Guys

                    Ok ... points taken .... thanks

                    Paul

                    Comment

                    Latest Posts

                    Collapse

                    Topics Statistics Last Post
                    Started by thumper57, Today, 04:30 PM
                    0 responses
                    2 views
                    0 likes
                    Last Post thumper57  
                    Started by OllieFeraher, 05-09-2024, 11:14 AM
                    5 responses
                    16 views
                    0 likes
                    Last Post MisterTee  
                    Started by jackiegils, Yesterday, 11:05 PM
                    1 response
                    10 views
                    0 likes
                    Last Post marcus2300  
                    Started by Skifree, Today, 02:50 PM
                    0 responses
                    8 views
                    0 likes
                    Last Post Skifree
                    by Skifree
                     
                    Started by owen5819, Today, 02:24 PM
                    1 response
                    12 views
                    0 likes
                    Last Post owen5819  
                    Working...
                    X