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

EnterShortLimit wrong price

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

    EnterShortLimit wrong price

    Hi,
    I want to set a sell order at a particular price in the future.

    In my strategy I have tried: EnterShortLimit(1000, 1.15633, "sell");

    This is showing in the execution screen as:
    EURUSD Sell 1,000 1.1572'6 02/10/2018 01:00:00 NT-00012-8429 Entry 1,000 S NT-00019-8429 sell $0.00 1 Backtest

    Why does it not sell at price ''1.15633.?
    Or even better, how can I achieve my requirement?

    #2
    Hello spikeruk,

    Thank you for your note.

    This has to do with two things; the type of order that you are using, and likely how quickly the market was moving when the limit order price was hit.

    Limit orders allow you to specify the price you want to be filled at. These orders are useful on low volatility instruments because they ensure you get filled at the price you specified or better. Take note that limit orders are not guaranteed to execute and may cause only partial fills.

    So basically, when you're placing a Short Limit, you're saying that you want the price that you get filled at to be 1.15633 or better. In this case, the price must have been moving so rapidly that by the time the limit order triggered, a better price had been reached (1.15726 > 1.15633, so a better price for a sell order) and the order was thus filled at this better price.

    You could try just using EnterShort(1000, @"sell"); however, this will enter a market order which is still prone to slippage in volatile markets. With the limit you're guaranteed at LEAST as good of a price as you specify, you're just not guaranteed a fill.

    Here's a link to our help guide on using the various order types in your NinjaScript Strategies:



    Please let us know if we may be of further assistance to you.
    Kate W.NinjaTrader Customer Service

    Comment


      #3
      In this case I am not really worried about the good price, I would rather wait until a specific target was hit for confirmation of a trend.
      Is there any way to achieve that?
      i.e. 'fill at 1.15633 or lower'?
      whereas what you described in your response was 'fill at 1.15633 or higher'

      Comment


        #4
        Hello spikeruk,

        Thank you for your reply.

        No, the only type of order that could possibly fill at a worse price would be a market order. To achieve something close to what you're asking, your best bet would be to do something in your strategy like this:

        If (Close[0] < Open[0] - 4 * TickSize) {
        EnterShort();
        }

        In the above example, if the close of a bar is less than the open price minus four ticks, then we use a market order to enter short, so we know that the price has been going down a reasonable way from the open of the bar first. However, like all market orders, while you are guaranteed a fill, it doesn't guarantee the price the fill is at, so the price may bounce back up and you'd still end up getting filled a little closer to the open price than you might have wanted.

        Please let us know if we may be of further assistance to you.
        Kate W.NinjaTrader Customer Service

        Comment


          #5
          Thanks
          Thats not really what I am looking.
          Inside onBarUpdate() I want to place a buy order that will get triggered at any time in the future if a certain price gets hit. (not before that price)


          Comment


            #6
            Hello spikeruk,

            Thank you for your reply.

            There's nothing keeping you from coding your strategy to trigger an entry when a current price is hit - the issue is that you're looking to be filled at a specific price or worse when that cannot be guaranteed by any order type. As I've mentioned, Market orders are the only type that will possibly fill at a worse price, but there is no way to guarantee the price at which the order fills.

            Please let us know if we may be of further assistance to you.
            Kate W.NinjaTrader Customer Service

            Comment


              #7
              my strategy is based on onBarUpdate() but, i may want to open a trade at any time during the next bar when a price is reached.

              for example: If the currentcurren at the onBarUpdate() is 1.10 then i want to say to buy if it hits 1.12. i understand i may pay more if it can't be filled at 1.12 but i dont want it being filled at anything less than 1.12. Surely this is possibly?

              Comment


                #8
                Hello spikeruk,

                Thank you for your reply.

                Not in the way you're looking for, no. There would not be a way to guarantee a fill at a specific price or worse. Limit orders fill at the specified price or better (limit price or higher price for a sell limit). Market and stop market orders will fill at the market price when touched. These are subject to slippage but would not guarantee a worse price.

                For example, if you are entering short using a limit order, it would fill at 1.12 or more, as this would give you a better entry price.

                If you are using a market order, it's possible it could fill higher than the price the order was submitted at, but also could fill lower as well depending on market dynamics.

                If you wanted to open a short position once the price is falling, a sell stop market order could be set below the current market price, at 1.12. This would turn into a regular market order once your stop price has been met, but still does not guarantee that it will fill at exactly that price if the market moves quickly.

                A sell stop limit order could also be set to have the stop at, for example, 1.14 and limit at 1.12. In this case, however, because this is a limit order it would fill at 1.12 or higher.

                Please let us know if we may be of further assistance to you.
                Kate W.NinjaTrader Customer Service

                Comment

                Latest Posts

                Collapse

                Topics Statistics Last Post
                Started by geddyisodin, Yesterday, 05:20 AM
                7 responses
                46 views
                0 likes
                Last Post NinjaTrader_Gaby  
                Started by gbourque, Today, 06:39 AM
                2 responses
                5 views
                0 likes
                Last Post gbourque  
                Started by cre8able, Yesterday, 07:24 PM
                1 response
                13 views
                0 likes
                Last Post NinjaTrader_ChelseaB  
                Started by cocoescala, 10-12-2018, 11:02 PM
                6 responses
                939 views
                0 likes
                Last Post Jquiroz1975  
                Started by cmtjoancolmenero, Yesterday, 03:58 PM
                1 response
                19 views
                0 likes
                Last Post NinjaTrader_Gaby  
                Working...
                X