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

Opposite orders on same bar in 6.5

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

    Opposite orders on same bar in 6.5

    I have the following strategy consisting in having a short order and long limit order on each bar:

    protectedoverridevoid OnBarUpdate()
    {
    (...)
    EnterLongLimit(long_limit);
    EnterShortLimit(short_limit);
    }
    This was working fine in 6.0, both in simulation & live.

    Having migrated to 6.5, only the first order is now placed (ie the long one in the case above, or the short one if I reverse the instructions order)

    Is this normal? Any possible workaround?


    #2
    This is correct behaviour in 6.5.

    Please see the following link and scroll to bottom for order handling rules.

    RayNinjaTrader Customer Service

    Comment


      #3
      Indeed...

      Thanks Ray.

      Comment


        #4
        Another oddity after the migration to 6.5, this time related to stop loss orders:

        protectedoverridevoid Initialize()
        {
        SetStopLoss(200);
        }

        protectedoverridevoid OnBarUpdate()
        {
        (...)
        ExitLongLimit(DefaultQuantity, LongLimit,"ExitL","long");
        }

        In simulation under 6.5, it seems that the stop loss now overrides the limit order. A TraceOrders shows that the limit orders are submitted, but they never get executed.

        How can I submit an OCO order, where if the limit order is executed, the stop is automatically cancelled?

        Comment


          #5
          Not sure I follow.

          - Remaining exit orders are automatically cancelled as a position is exited
          RayNinjaTrader Customer Service

          Comment


            #6
            The issue is that the limit orders are no longer executed if a stop order exists.

            Comment


              #7
              Please see this article on Internal Order Handling Rules. http://www.ninjatrader-support.com/H...verview36.html
              Josh P.NinjaTrader Customer Service

              Comment


                #8
                Yes, I can see that the stop loss overriding the limit order is a design feature in 6.5.

                But the question is, how do I implement a basic OCO order in 6.5?

                ie once an entry order is submitted, I need an profit target and a stop order attached, either of which will be executed in a live environment even if the internet connection goes down etc...

                Comment


                  #9
                  You can have stop/targets submitted via SetStopLoss() and SetProfitTarget(). There are no methods available that will submit stop/targets on a entry order that is unfilled at a time of disconnect but then is filled during disconnect.
                  RayNinjaTrader Customer Service

                  Comment

                  Latest Posts

                  Collapse

                  Topics Statistics Last Post
                  Started by StockTrader88, 03-06-2021, 08:58 AM
                  45 responses
                  3,992 views
                  3 likes
                  Last Post johntraderuser2  
                  Started by TAJTrades, Today, 09:46 AM
                  0 responses
                  7 views
                  0 likes
                  Last Post TAJTrades  
                  Started by rhyminkevin, Yesterday, 04:58 PM
                  5 responses
                  62 views
                  0 likes
                  Last Post dp8282
                  by dp8282
                   
                  Started by realblubb, Today, 09:28 AM
                  0 responses
                  8 views
                  0 likes
                  Last Post realblubb  
                  Started by AaronKoRn, Yesterday, 09:49 PM
                  1 response
                  19 views
                  0 likes
                  Last Post Rikazkhan007  
                  Working...
                  X