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

NinjaScript Strategy: Independent Orders

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

    NinjaScript Strategy: Independent Orders

    Hi

    Is it possible code a NinjaScript Strategy (unmanaged orders) in such a way that placing a SellShort order doesn't close a previously filled (and open) Buy order, and vice-versa?

    Kind Regards
    Vivek

    #2
    Hello Vivek,

    Thanks for your post.

    You cannot fill an order opposing a position and expect it not to affect it.
    Paul H.NinjaTrader Customer Service

    Comment


      #3
      Thanks Paul for clarification!

      I thought unless a Sell order be placed, the previously filled (and open) Buy order won't close.
      Similarly, BuyToCover closing an open SellShort order.

      Yet, thanks for clarifying that any opposite order will close previously opened opposite position.

      Kind Regards
      Vivek

      Comment


        #4
        Originally posted by engrvivs View Post
        I thought unless a Sell order be placed, the previously filled (and open) Buy order won't close.
        Similarly, BuyToCover closing an open SellShort order.

        Yet, thanks for clarifying that any opposite order will close previously opened opposite position.
        This sounds like a perfect opportunity to plug this:


        From your broker's point of view, going short is no different than a sell. Covering a short is no different than a buy.

        [Edit: I am assuming futures here, not stocks]

        For ex:
        ES Buy LONG 3 -- you are now LONG 3 at your broker
        ES Sell SHORT 3 -- you are now FLAT at your broker

        Managed vs Unmanaged has nothing to do with it.

        Comment


          #5
          Thanks bltdavid for your comments!

          Yet, now I have another question.

          I copied same strategy's logic as two separate NS strategies. In one, I allowed only Buy orders to be placed, while in another I allowed placed only SellShort orders.
          On applying these two strategies, simultaneously, on the same chart (instrument), I was able to achieve desired behavior of ensuring co-existence of Buy and SellShort orders.

          But how is this achieved, if from "broker's point of view, going short is no different than a sell. Covering a short is no different than a buy"?

          I mean for the same account, any long should close previously opened short position and vice-versa; but it didn't happen in the afore-mentioned case of two separate NS strategies. What is the reason of such behavior?

          Kind Regards
          Vivek

          Comment


            #6
            Originally posted by engrvivs View Post
            Thanks bltdavid for your comments!

            Yet, now I have another question.

            I copied same strategy's logic as two separate NS strategies. In one, I allowed only Buy orders to be placed, while in another I allowed placed only SellShort orders.
            On applying these two strategies, simultaneously, on the same chart (instrument), I was able to achieve desired behavior of ensuring co-existence of Buy and SellShort orders.

            But how is this achieved, if from "broker's point of view, going short is no different than a sell. Covering a short is no different than a buy"?

            I mean for the same account, any long should close previously opened short position and vice-versa; but it didn't happen in the afore-mentioned case of two separate NS strategies. What is the reason of such behavior?

            Kind Regards
            Vivek
            NT keeps it separate.

            If you are +2 in one NT window and -2 in another NT window - you are 0 at your broker.

            Comment


              #7
              Originally posted by sledge View Post
              NT keeps it separate.

              If you are +2 in one NT window and -2 in another NT window - you are 0 at your broker.
              Are the orders actually open in such scenario
              or
              there is no order open at broker's end?

              Comment


                #8
                [QUOTE=engrvivs;464065]Are the orders actually open in such scenario
                or
                there is no order open at broker's end?[/QUOTE]

                You would be FLAT. No orders.

                Comment


                  #9
                  Is there any way to circumvent such scenario, ensuring open opposite orders?

                  I'm accustomed to MetaTrade 4 order management style and have been trying to emulate MT4 style in NT.

                  Thanks
                  Last edited by engrvivs; 06-16-2016, 11:25 PM.

                  Comment


                    #10
                    Originally posted by engrvivs View Post
                    Is there any way to circumvent such scenario, ensuring open opposite orders?

                    I'm accustomed to MetaTrade 4 order management style and have been trying to emulate MT4 style in NT.

                    Thanks
                    I've never used MT4 and have probably never seen it.... so honestly I have no idea.

                    Maybe they were keeping it separate in the one window but your broker was "flat".

                    I haven't tried to run 2 strategies on same instrument in same chart that can be opposing entries in NT.

                    Comment


                      #11
                      Thanks alot sledge for your comments!

                      They have been very useful!

                      Still, I will happy if there can be more pointers in the direction to independently handle opposite orders.

                      Comment


                        #12
                        Originally posted by engrvivs View Post
                        Still, I will happy if there can be more pointers in the direction to independently handle opposite orders.
                        Use 2 different accounts with the same broker.

                        Run strat for LONG entires in acct A on chart #1.
                        Run strat for SHORT entries in acct B on chart #2.

                        You don't need a multi-broker license.
                        Acct A is always for longs.
                        Acct B is always for shorts.

                        Problem solved.
                        Last edited by bltdavid; 06-17-2016, 10:32 AM.

                        Comment


                          #13
                          Originally posted by engrvivs View Post
                          Thanks bltdavid for your comments!

                          Yet, now I have another question.

                          I copied same strategy's logic as two separate NS strategies. In one, I allowed only Buy orders to be placed, while in another I allowed placed only SellShort orders.
                          On applying these two strategies, simultaneously, on the same chart (instrument), I was able to achieve desired behavior of ensuring co-existence of Buy and SellShort orders.

                          But how is this achieved, if from "broker's point of view, going short is no different than a sell. Covering a short is no different than a buy"?

                          I mean for the same account, any long should close previously opened short position and vice-versa; but it didn't happen in the afore-mentioned case of two separate NS strategies. What is the reason of such behavior?

                          Kind Regards
                          Vivek
                          Already discussed a few times. Here is one such.

                          ref: http://ninjatrader.com/support/forum...d.php?p=303022

                          Comment


                            #14
                            Originally posted by engrvivs View Post
                            I mean for the same account, any long should close previously opened short position and vice-versa; but it didn't happen in the afore-mentioned case of two separate NS strategies. What is the reason of such behavior?
                            Did you read that link about strategy position vs account position?

                            Study it carefully. It said:
                            "A Strategy Position is a virtual position that is created by the entry and exit executions generated by a strategy and is independent from any other running strategy’s position or an Account Position."

                            Thus, as Sledge said, NT keeps them separate.

                            The buys/sells of one strategy are unknown by all other running strategies. This is just the way NT designed it -- it probably removed some very serious complexity in the early stages of development. If NT were to change this now, I'm sure it would be a very complex solution and would require extensive non-trivial code changes.

                            The point is: if all strategies are trading inside the same account, obviously your broker sees all buys & sells.

                            Comment

                            Latest Posts

                            Collapse

                            Topics Statistics Last Post
                            Started by TheMarlin801, 10-13-2020, 01:40 AM
                            21 responses
                            3,915 views
                            0 likes
                            Last Post Bidder
                            by Bidder
                             
                            Started by timmbbo, 07-05-2023, 10:21 PM
                            3 responses
                            151 views
                            0 likes
                            Last Post grayfrog  
                            Started by Lumbeezl, 01-11-2022, 06:50 PM
                            30 responses
                            808 views
                            1 like
                            Last Post grayfrog  
                            Started by xiinteractive, 04-09-2024, 08:08 AM
                            3 responses
                            11 views
                            0 likes
                            Last Post NinjaTrader_Erick  
                            Started by Johnny Santiago, 10-11-2019, 09:21 AM
                            95 responses
                            6,194 views
                            0 likes
                            Last Post xiinteractive  
                            Working...
                            X