Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Submitting limit + stop loss order?

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

    Submitting limit + stop loss order?

    Hello,

    I'm starting to carve out my strategy. I have the logic working as an Indicator.

    I am having trouble submitting my orders, I would like to submit:
    1. A limit buy order based on current price (I don't want the order floating as a market order)
    2. Profit target of 4 ticks
    3. Stop loss of 8 ticks.

    This example shows the entry price and stop proce, but not target price.

    EnterLongStopLimit(High[0] + 2 * TickSize, High[0], "SMA Cross Entry");

    How can I do this?

    Many Thanks, Caesar.

    #2
    Hello Caesar,

    Thank you for your note.

    The example for EnterLongStopLimit() that you are looking at refers to a stopPrice as where to place the "stop" part of the Stop Limit order. This is not the same as a stop loss, like the stop loss of 8 ticks you mentioned. If you simply want a limit order for your entry, you could use the EnterLongLimit() or EnterShortLimit() order methods:



    When using the managed approach for your NinjaScript strategy, you could submit protective Stop Loss and Profit Target orders using the SetStopLoss() and SetProfitTarget() methods. A reference sample of how the SetStopLoss() and SetProfitTarget() methods could be used is located here:


    In that example, you could change the StopLossTicks to 8 and ProfitTargetTicks to 4. The sample also demonstrates how to set your Stop Loss to a breakeven price after 50 ticks of profit is met; this wouldn't occur if you had the ProfitTargetTicks set to 4.

    Please let us know if we may be of further assistance.

    Comment


      #3
      Many Thanks Emily!

      Comment


        #4
        Hello Emily,

        Also when submitting EnterLongLimit ... is the price used Close[0] or Close[0] + or - TickSize (this is a Renko bar)?

        Many Thanks, Caesar.

        Comment


          #5
          Hello Caesar,

          Thank you for your reply.

          The price used for EnterLongLimit() will depend on where you would like the limit order to be placed. Close[0] would place it at the Close price of the current bar. If you add or subtract ticks from the Close[0] then the order will be placed at a price that many ticks above or below the Close price for the current bar. If you are unsure which order type you would like to use, I suggest reviewing the blog post here for an explanation of how LImit, Stop-Market, and Stop-Limit orders function to gain a better understanding of which order type and what price you would want to utilize in your strategy:
          Explore futures trading platforms designed for traders of all levels at NinjaTrader. Learn how to open a brokerage account and take the next step.


          Please let us know if we may be of further assistance.

          Comment


            #6
            I am having an issue with a trailing stoploss lmt order where the price has moved too fast and I get a canceled order message that casues the NT8 strategy crash. for example I am in a short position and I have the script place the stop lmt order at the high of the previous bar. But sometimes the market price has already moved above that value. How can I test and correct my order for this condition?

            Comment


              #7
              Hello,

              For a buy stop order, such as when exiting a short position or entering a long position, the stop price must be above the current ask price.
              For a sell stop order, such as when exiting a long position or entering a short position, the stop price must be below the current bid price.

              You can use GetCurrentBid() and GetCurrentAsk() to make sure that the price you are submitting or changing the order to is a valid price and on the correct side of the market.

              Help Guide: NinjaScript > Language Reference > Common > Analytical > GetCurrentBid()
              Help Guide: NinjaScript > Language Reference > Common > Analytical > GetCurrentAsk()

              For example, for a sell stop market order:

              Code:
              ​double stopPrice = Low[0];
              if (stopPrice >= GetCurrentBid())
                 stopPrice = GetCurrentBid() - TickSize
              EnterShortStopMarket(stopPrice);
              This will ensure that your stopPrice is below the current Bid price, by checking is the stopPrice is above the current Bid and if so moving it below.

              Please note that if the error occurred due to market volatility, then there is no way to 100% avoid this occurring, as in volatile markets the market could move so far and fast that this would occur.​

              Please let us know if you have any further questions. ​

              Comment

              Latest Posts

              Collapse

              Topics Statistics Last Post
              Started by NullPointStrategies, Yesterday, 05:17 AM
              0 responses
              66 views
              0 likes
              Last Post NullPointStrategies  
              Started by argusthome, 03-08-2026, 10:06 AM
              0 responses
              141 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
              46 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