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 xepher101, 05-10-2024, 12:19 PM
          9 responses
          112 views
          0 likes
          Last Post jeronymite  
          Started by tkaboris, Today, 07:53 PM
          0 responses
          1 view
          0 likes
          Last Post tkaboris  
          Started by JGriff5646, Yesterday, 05:47 PM
          2 responses
          20 views
          0 likes
          Last Post JGriff5646  
          Started by lezlebric, Today, 06:32 PM
          0 responses
          12 views
          0 likes
          Last Post lezlebric  
          Started by TheTechnician86, Today, 05:47 PM
          0 responses
          9 views
          0 likes
          Last Post TheTechnician86  
          Working...
          X