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 futtrader, 04-21-2024, 01:50 AM
                  6 responses
                  58 views
                  0 likes
                  Last Post futtrader  
                  Started by sgordet, Today, 11:48 AM
                  0 responses
                  4 views
                  0 likes
                  Last Post sgordet
                  by sgordet
                   
                  Started by Trader146, Today, 11:41 AM
                  0 responses
                  5 views
                  0 likes
                  Last Post Trader146  
                  Started by jpapa, 04-23-2024, 07:22 AM
                  2 responses
                  19 views
                  0 likes
                  Last Post rene69851  
                  Started by funk10101, Today, 11:35 AM
                  0 responses
                  3 views
                  0 likes
                  Last Post funk10101  
                  Working...
                  X