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

double stop limit before stop order?

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

    double stop limit before stop order?

    Sceanrio:

    Can I have 2 limit orders and a stop order with the same oco?

    Scenario:
    currently I want out....
    change the target to current price.
    Move the stop order to 1 tick down.

    I lose an extra tick on ecbot on the stop order.

    What I want to do:
    I want out...
    change the target to current price (same as above)
    have a limit order 1 tick under to try and get out 1 at just that price and not 1 tick under.
    Then have my official stop order 2 ticks down from where I was trying to get out. I might still lose a tick but tried twice to get out at a better price.

    This would never work on the ES because it is too fast and also it doesn't use stop orders (1 tick down).

    Can I use the same oco for the target, limit order, and stop order?

    Bottom line I am trying to not use the stop order but need it as a fail safe. I also don't want to get multiple orders filled for my exit if I can help it.

    I hope my end result is understood. You may have a better solution.

    Regards

    Cliff

    #2
    I believe what you want is possible through NT6.5's OnOrderUpdate(). It requires some more advanced programming, but you can check out this reference sample for some help in getting it done. Although the reference sample does not do exactly what you want, but it should suffice in giving you an idea of how to approach it. http://www.ninjatrader-support.com/v...ead.php?t=3917
    Josh P.NinjaTrader Customer Service

    Comment


      #3
      Josh

      It was that program that gave me idea I could do it.

      Will I need to change "EntriesPerDirection" to 2 to allow for the double unless I use a different name? Pros or cons?

      Comment


        #4
        Josh

        One last question... Where is the 6.5 help?

        Comment


          #5
          In NT 6.5 select the menu Help > Help
          RayNinjaTrader Customer Service

          Comment


            #6
            If you use a SetStopLoss() as your reserve stop and you use ExitLongLimit() as your "stop" you don't need to worry about EntriesPerDirection. You only need to worry about EntriesPerDirection if you want to enter the market long/short more than once at a time. For instance, you enter long then 5 bars later you see another entry opportunity before you closed your original long position. EntriesPerDirection lets you add onto your original position.
            Josh P.NinjaTrader Customer Service

            Comment


              #7
              Ray

              Do I get a white cane for being so blind?

              Cliff

              Comment


                #8
                Josh

                I know it is only a sample but you might want to add the following to your example at the end of OnOrderUpdate:
                // If order canceled and 0 quantity reset EntryOrder
                if (order.OrderState == OrderState.Cancelled && order.Filled == 0)
                {
                entryOrder = null;
                }

                I had an issue where the order was canceled for some reason, no clue why. That left me in a limbo state where no new orders would be generated becuase entryOrder was not null. Drove me nuts till I debugged it.

                Regards

                Cliff

                Comment


                  #9
                  Great find ct. Thanks for the heads up on that situation. I will make modifications to address those conditions.
                  Josh P.NinjaTrader Customer Service

                  Comment

                  Latest Posts

                  Collapse

                  Topics Statistics Last Post
                  Started by RookieTrader, Today, 07:41 AM
                  1 response
                  5 views
                  0 likes
                  Last Post NinjaTrader_ChelseaB  
                  Started by kujista, Today, 05:44 AM
                  1 response
                  9 views
                  0 likes
                  Last Post NinjaTrader_ChelseaB  
                  Started by elderan, Yesterday, 08:03 PM
                  1 response
                  12 views
                  0 likes
                  Last Post NinjaTrader_BrandonH  
                  Started by samish18, Yesterday, 08:57 AM
                  8 responses
                  25 views
                  0 likes
                  Last Post samish18  
                  Started by DJ888, 04-16-2024, 06:09 PM
                  3 responses
                  10 views
                  0 likes
                  Last Post NinjaTrader_Erick  
                  Working...
                  X