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

Long/Short

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

    Long/Short

    Hello,
    Is it possible to EnterLong and short at the same time with the same instrument if some conditions are met?
    I tried:
    if (myconditions)
    EnterLong

    if(myconditions)
    EnterShort

    But it didn't worked. Any idea?

    Thanks

    Daniel

    #2
    Hello,

    When using the Managed approach, you will not be able to go long and short at the same time.

    However you can accomplish this by using the unmanaged order types from your code. Please see our Help Guide article on this subject for more information:

    MatthewNinjaTrader Product Management

    Comment


      #3
      Originally posted by dvercher View Post
      Hello,
      Is it possible to EnterLong and short at the same time with the same instrument if some conditions are met?
      I tried:
      if (myconditions)
      EnterLong

      if(myconditions)
      EnterShort

      But it didn't worked. Any idea?

      Thanks

      Daniel
      No matter the method you use, that is physically impossible in the same account. The second order will always act to cancel the first. In the same account, a short order received when in a long position will always act to reduce/reverse the long position and vice-versa.

      In the particular code that you wrote, as you have no protective orders on your entries, your code will in all case act to reverse you on the next tick.

      Comment


        #4
        What about if I have protective orders? If the long/short orders are at the same time, do they cancel themselves automatically?

        So, no way of doing this?

        Thanks

        Daniel

        Comment


          #5
          Originally posted by dvercher View Post
          What about if I have protective orders? If the long/short orders are at the same time, do they cancel themselves automatically?

          So, no way of doing this?

          Thanks

          Daniel
          That is a very different, uglier can of worms. We went through that in this thread, among others.

          ref: http://www.ninjatrader.com/support/f...42666#poststop

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by PaulMohn, Today, 06:59 PM
          0 responses
          1 view
          0 likes
          Last Post PaulMohn  
          Started by bortz, 11-06-2023, 08:04 AM
          48 responses
          1,744 views
          0 likes
          Last Post carnitron  
          Started by Jonker, 04-27-2024, 01:19 PM
          3 responses
          23 views
          0 likes
          Last Post NinjaTrader_Manfred  
          Started by businessman1929, 04-29-2024, 01:28 PM
          2 responses
          22 views
          0 likes
          Last Post businessman1929  
          Started by bltdavid, 03-27-2023, 05:32 AM
          18 responses
          347 views
          0 likes
          Last Post ETFVoyageur  
          Working...
          X