Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Exact behaviour of EnterLong or EnterShort

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

    Exact behaviour of EnterLong or EnterShort

    Hello,

    I have been playing with those functions and from my results, I understand they behave like this, but I'm not exactly sure, since I have not been able to read their exact behaviour in the documentation (https://ninjatrader.com/support/help...entershort.htm , https://ninjatrader.com/support/help...nterlong.htm):
    - If there are no positions, they will simply open the desired position.
    - If there are other positions of the opposite side (for example, we call EnterLong(50) when having a SHORT position of 200), the current positions will be closed and then the LONG position itself will be opened. Therefore, we end up with a position of LONG with quantity 50. This strikes me as a bit odd. I would expect my position in that case to be SHORT 150 in that case.
    - If there are other positions of the same side, the specified quantity is simply added to the position. So if we have a position of LONG 50, and call EnterLong(200), we end up with a LONG position of 50.

    Are my assumptions correct? Where can I read more about them, or even other possible ways to handle the position for a specific instrument?

    Best regards.

    #2
    Hello Flood,

    Thank you for your note.

    If you're short 50, then call EnterLong(200), you are correct, the short position will be closed then you will be net long 200. This is expected behavior of the managed approach.

    If you are an experienced programmer, I might suggest looking into the unmanaged approach, which does not use EnterLong/Short methods but rather SubmitOrder.

    I would encourage you to read the following section of our helpguide,
    https://ninjatrader.com/support/help...er_methods.htm

    Please let us know if you need further assistance.
    Alan P.NinjaTrader Customer Service

    Comment


      #3
      Hello Alan,

      Thanks for the quick reply. I will take a look into it, and come back here if I have any other questions.

      Best regards,
      Guillermo.

      Comment


        #4
        Originally posted by Flood View Post
        Hello,

        I have been playing with those functions and from my results, I understand they behave like this, but I'm not exactly sure, since I have not been able to read their exact behaviour in the documentation (https://ninjatrader.com/support/help...entershort.htm , https://ninjatrader.com/support/help...nterlong.htm):
        - If there are no positions, they will simply open the desired position.
        - If there are other positions of the opposite side (for example, we call EnterLong(50) when having a SHORT position of 200), the current positions will be closed and then the LONG position itself will be opened. Therefore, we end up with a position of LONG with quantity 50. This strikes me as a bit odd. I would expect my position in that case to be SHORT 150 in that case.
        EnterLong(50) means "NT, make orders so that I end up with a position of 50 Long from this order, when you are done." Therefore, if you are flat or short, NT will take you out, if necessary, and then enter you 50 long. If you are already long, NT will simply add to the position.

        If you are trying to reduce the short position by 50, then simply exit a quantity of 50. ExitShort(50).
        - If there are other positions of the same side, the specified quantity is simply added to the position. So if we have a position of LONG 50, and call EnterLong(200), we end up with a LONG position of 50.

        Are my assumptions correct? Where can I read more about them, or even other possible ways to handle the position for a specific instrument?

        Best regards.
        The part in red seems to make no arithmetic sense. Did you get the numbers wrong? You should end up with 250 long, not 50 long.
        Last edited by koganam; 10-04-2017, 10:15 AM. Reason: Improved explanation of how orders affect market position.

        Comment


          #5
          Originally posted by koganam View Post
          The part in red seems to make no arithmetic sense. Did you get the numbers wrong? You should end up with 250 long, not 50 long.
          Oops, yes, I misstyped them, I wanted to write 250 long at the end. Nice catch!

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by Wessel, Today, 12:50 PM
          0 responses
          1 view
          0 likes
          Last Post Wessel
          by Wessel
           
          Started by asmmbillah, Today, 12:39 PM
          0 responses
          3 views
          0 likes
          Last Post asmmbillah  
          Started by dtmtradingco, Today, 12:30 PM
          0 responses
          3 views
          0 likes
          Last Post dtmtradingco  
          Started by Franck Z, Today, 09:49 AM
          0 responses
          6 views
          0 likes
          Last Post Franck Z  
          Started by pvtrader, Today, 08:02 AM
          2 responses
          7 views
          0 likes
          Last Post pvtrader  
          Working...
          X