• If this is your first visit, you will have to register before you can post. To view messages, please scroll below and select the forum that you would like to visits. Questions? Be sure to check out the Forum FAQ.

Announcement

Collapse
No announcement yet.

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:
        https://ninjatrader.com/support/help..._account_p.htm

        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 darkgreen, Today, 03:35 PM
                            0 responses
                            6 views
                            0 likes
                            Last Post darkgreen  
                            Started by GTBrooks, Today, 02:44 PM
                            2 responses
                            13 views
                            0 likes
                            Last Post GTBrooks  
                            Started by GLFX005, Today, 12:22 PM
                            4 responses
                            41 views
                            0 likes
                            Last Post NinjaTrader_Kate  
                            Started by AspenHiker, Today, 08:37 AM
                            1 response
                            13 views
                            0 likes
                            Last Post NinjaTrader_Kate  
                            Started by MartinT, Yesterday, 01:12 PM
                            3 responses
                            17 views
                            0 likes
                            Last Post MartinT
                            by MartinT
                             
                            Working...
                            X