Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Exiting positions

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

    Exiting positions

    Will EnterLong and EnterShort exit the previous position and put in the new market order?
    So like if I'm already long and my strategy send EnterShort, that alone will close the long?
    Thats so weird
    Thanks

    #2
    Originally posted by ezrollin View Post
    Will EnterLong and EnterShort exit the previous position and put in the new market order?
    Yes.

    Originally posted by ezrollin View Post
    So like if I'm already long and my strategy send EnterShort, that alone will close the long?
    Yes.

    Originally posted by ezrollin View Post
    Thats so weird
    Nope. Not weird. More like, that's so cool.

    The idea is exceptionally well-suited for an 'always-in' kind of strategy.

    What is that? Well, consider a strategy like an MA crossover. For many
    strategies, the next entry signal is also the exit signal for the current trade.

    Huh? Some strategies produce signals that do double-duty. They produce
    an entry signal, sure ... but that same signal serves as a de-facto exit signal,
    which is only really useful if you currently happen to be in a position.

    Thus, for ex, if you are Long, then EnterShort automatically handles exiting that
    Long position before submitting the Short entry order. If you are not Long, no
    problem, EnterShort runs normally and submits a Short entry order.

    To have that extra logic to exit the prior position (if necessary) is extremely
    convenient.

    It's not really that weird at all ... it turns out to be a very cool feature.

    It can make the code you have to write much simpler, because the NinjaScript
    internal library code for EnterShort/EnterLong does lots of extra work for you,
    but only if needed.

    -=o=-

    This builtin 'exit position if necessary' feature is one of the primary benefits of
    using the Managed mode order methods.

    If you find this 'convenience' getting in the way, you can bypass it completely
    by using Unmanaged mode order methods.


    Last edited by bltdavid; 04-20-2022, 04:22 AM. Reason: typo

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by NullPointStrategies, Yesterday, 05:17 AM
    0 responses
    75 views
    0 likes
    Last Post NullPointStrategies  
    Started by argusthome, 03-08-2026, 10:06 AM
    0 responses
    146 views
    0 likes
    Last Post argusthome  
    Started by NabilKhattabi, 03-06-2026, 11:18 AM
    0 responses
    79 views
    0 likes
    Last Post NabilKhattabi  
    Started by Deep42, 03-06-2026, 12:28 AM
    0 responses
    50 views
    0 likes
    Last Post Deep42
    by Deep42
     
    Started by TheRealMorford, 03-05-2026, 06:15 PM
    0 responses
    54 views
    0 likes
    Last Post TheRealMorford  
    Working...
    X