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

How to get SHORT StopLimit order with Limit higher than Stop

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

    How to get SHORT StopLimit order with Limit higher than Stop

    is it true that using the unmanaged order entry, is the only option to bypass the error resulting from the below ?:

    I am trying to use the Managed

    EnterShortStopLimit(1, true, tradesize ,StopLimit_LimitLevel, StopLimit_StopLevel , "Short-1");

    while having the StopLimit_LimitLevel above the StopLimit_StopLevel .
    This gives an error !
    my wish is the trigger the short on the particular level (on touch of that level) but the actual entry should be with an offset above that level.

    Interactivebrokers for example have this type of order with an offset. So is it true that Ninjatrader does not have it in managed order type ?


    thanks
    Last edited by dadarara; 08-29-2020, 10:20 AM.

    #2
    Originally posted by dadarara View Post
    EnterShortStopLimit(1, true, tradesize ,StopLimit_LimitLevel, StopLimit_StopLevel , "Short-1");

    while having the StopLimit_LimitLevel above the StopLimit_StopLevel .
    When using a StopLimit order, I have in my notes,

    A 'Buy' StopLimit as an Entry order means going LONG,
    where StopPrice > Market and LimitPrice < StopPrice,
    when Market rises to StopPrice, a 'Buy' Limit order is activated at LimitPrice,
    when Market falls back to LimitPrice or lower, your 'Buy' Limit order is filled,
    when filled you are LONG with your EntryPrice at or below LimitPrice.

    A 'Sell' StopLimit as an Entry order means going SHORT,
    where StopPrice < Market and LimitPrice > StopPrice,
    when Market falls to StopPrice, a 'Sell' Limit order is activated at LimitPrice,
    when Market rises back to LimitPrice or higher, your 'Sell' Limit order is filled,
    when filled you are SHORT with your EntryPrice at or above LimitPrice.

    Seems like you're doing the correct thing to me.

    Originally posted by dadarara View Post
    Interactivebrokers for example have this type of order with an offset. So is it true that Ninjatrader does not have it in managed order type ?
    I going to presume Buy/Sell StopLimit orders are fully supported in both Managed/Unmanaged modes.

    So, first things first,
    What does the error message say, exactly?
    Can you post a screenshot?

    Comment


      #3
      bltdavid

      your description is exactly what I am trying to do.
      but it seams its not working.
      please see the error. and also the log with the order that generated the error.
      Click image for larger version

Name:	Screen Shot 2020-08-29 at 22.33.01.png
Views:	523
Size:	206.5 KB
ID:	1116100
      I am really at a loss. dont know what I am doing wrong.

      Comment


        #4
        Well, rats, my notes may be wrong ... perhaps I need some re-education myself.

        Comment


          #5
          Yep, I think my brain and notes had some things garbled.

          Some good insights w/good examples here.

          I'll correct my notes and provided an updated description once
          I get my brain whipped into shape by Support.

          Comment


            #6
            To the experts : what is the answer on the above :
            is it true that using the unmanaged order entry, is the only option to bypass the error resulting from the below ?:


            what is the way to create a stoplimit order with the limit being lower than the stop in case of BUY and higher than the Stop in case of SHORT ?
            Last edited by dadarara; 08-30-2020, 02:24 AM.

            Comment


              #7
              It may not be possible. Let me explain my new thinking.

              First, I use Buy/Sell Stop orders a lot, but the instrument
              is ES, so it's very liquid, and doesn't usually 'jump' prices,
              so I don't see much slippage on entry.

              Let's start by studying Buy Stop. The idea is that prices are
              rising, and you want to get in if it rises to your price, which
              is called the Stop price -- you must give a Stop price above the
              Market for a Buy Stop order. When your Stop price is reached,
              (I'm not sure if the Stop price just has be touched, meaning at
              least one transaction at the Stop price, or if the Stop price has
              to be traded completely through, meaning at least 1 transaction
              greater than Stop price) a Market order is entered and you are
              Long at whatever Ask price the auction is at. For the ES, the
              the Entry price is usually the Stop price, because the Ask price
              usually hasn't moved, but there is no guarantee (this was a Buy
              Market order, after all, so it could be higher).

              Anyways, I don't worry about the slippage too much, at least
              with the ES, I've not been burned too badly with simple Buy Stop
              and Sell Stop orders for my entries.

              The point of these Stop entry orders is: you want price to keep
              advancing to hit your Stop price -- this is the threshold at which
              you want to enter
              -- with a Buy Stop you want price to keep rising
              to your Stop price, with a Sell Stop you want price to keep falling
              to reach your Stop price -- when your Stop price is hit, you get
              in with a Market order.

              Now, let's consider a Buy StopLimit order. What's different?
              Short answer: A StopLimit order has two threshold prices.

              A 'Buy' StopLimit as an Entry order means going LONG,
              where StopPrice > Market and LimitPrice > StopPrice. <-- notice the correction

              StopPrice must be above Market, that makes sense, that's the
              point of the Buy Stop order: it is directional and resting, waiting
              at a price higher than Market for entry, so as prices rise, only then
              do you get in. But a Buy StopLimit has the added twist that when
              your StopPrice is reached, a Limit order is entered, and you will
              buy at a price not to exceed the LimitPrice, so that is why the
              LimitPrice > StopPrice.

              For a Buy Stop, when Market price rises to Stop price, a Buy Market
              order is entered and you are guaranteed Long at whatever price the
              market gives you (because, it's a Market order).

              For a Buy StopLimit, when Market price rises to Stop price, a Buy Limit
              order is entered at the Limit price, which must be above the Stop price,
              and you are Long only if your order can be filled at or below that Limit
              price -- the Limit price represents your second threshold, it is absolute
              highest price you wish to buy at -- so you are guaranteed your Entry
              price is not higher than the Limit price.

              A Sell StopLimit is similar.

              A 'Sell' StopLimit as an Entry order means going SHORT,
              where StopPrice < Market and LimitPrice < StopPrice. <-- notice the correction

              I've found some threads that mentioned a negative offset (in ticks) to specify
              the Limit, which allowed a Sell StopLimit to have a LimitPrice > StopPrice,
              but this was known as a Simulated Stop -- see the section with Examples,
              where a Sell StopLimit with LimitPrice > StopPrice is illustrated.
              (EDIT: See screenshot below)

              Simulated Stop might be a feature of the Chart Trader and DOM only.

              I think the real question to support may be: is it possible to do Simulated
              Stop orders using NinjaScript?

              I'll bow out and take my suffrage off-line. I've enjoyed (re?)learning all this,
              helps to fill the brain gaps, which were hidden and needed to be fixed.
              Attached Files
              Last edited by bltdavid; 08-30-2020, 04:00 PM.

              Comment


                #8
                looks like Simulated Order type is what I am looking for.

                should I open a new topic or maybe the experts will join in this one?

                is SIMULATED ORDER technology available in strategy scripting ?

                Comment


                  #9
                  Originally posted by dadarara View Post
                  Should I open a new topic or maybe the experts will join in this one?

                  Is SIMULATED ORDER technology available in strategy scripting ?
                  Patience, they'll stop by soon ... no need to start a new thread.

                  Comment


                    #10
                    Hello dadarara,

                    Outside of our normal support hours the support has a minimal amount of representatives to provide replies and limited bandwidth to work on complex inquiries.
                    The normal support hours are from 9:00 AM Eastern until 6:00 PM Eastern, Monday through Friday.

                    A simulated stop order, such as the one that can be placed with Chart Trader or the SuperDOM (or with SetStopLoss()), uses logic to submit the order when the price is touched instead of submitting the order immediately.
                    This means that the order is not working on the exchange servers and instead will be submitted by NinjaTrader once the price is touched. (If NinjaTrader is off or disconnected, the order will not be sent)

                    This means that instead of using a stop limit with invalid prices, use logic in your script to submit a limit order when the price is touched.

                    if (Close[0] <= 1000.25)
                    {
                    EnterShortLimit(Close[0] + 4 * TickSize);
                    }
                    Chelsea B.NinjaTrader Customer Service

                    Comment

                    Latest Posts

                    Collapse

                    Topics Statistics Last Post
                    Started by MarianApalaghiei, Today, 10:49 PM
                    1 response
                    7 views
                    0 likes
                    Last Post NinjaTrader_Manfred  
                    Started by love2code2trade, Yesterday, 01:45 PM
                    4 responses
                    28 views
                    0 likes
                    Last Post love2code2trade  
                    Started by funk10101, Today, 09:43 PM
                    0 responses
                    8 views
                    0 likes
                    Last Post funk10101  
                    Started by pkefal, 04-11-2024, 07:39 AM
                    11 responses
                    37 views
                    0 likes
                    Last Post jeronymite  
                    Started by bill2023, Yesterday, 08:51 AM
                    8 responses
                    46 views
                    0 likes
                    Last Post bill2023  
                    Working...
                    X