Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Restricting Trade Direction Based on Active Strategy

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

    Restricting Trade Direction Based on Active Strategy

    Hi there,

    I'm currently trading with two strategies on my account, both of which can take long and short positions.

    Is there a way to ensure that if Strategy A is in a long position, Strategy B will only be able to take long positions (and not shorts) while Strategy A's position remains open?

    In essence, I want to make sure that when multiple strategies are running, if one is active, all other strategies are forced to trade in the same direction until the initial position is closed.

    Any guidance will be much appreciated, thanks.

    #2
    Hello RoswellTrader,

    Thank you for your post.

    NinjaScript strategies aren't aware of each other's positions. Each strategy instance has an independent position that does not have any supported methods to be read by another strategy instance. Instead of having multiple strategies, you could consider combining the strategies into one strategy.

    If you want to use unsupported methods, consider using static properties in an Add On class to share information. However please note that as this is unsupported, the support team is not able to assist you with unsupported code.

    Please let me know if you have any other questions.​

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by Hwop38, 05-04-2026, 07:02 PM
    0 responses
    164 views
    0 likes
    Last Post Hwop38
    by Hwop38
     
    Started by CaptainJack, 04-24-2026, 11:07 PM
    0 responses
    318 views
    0 likes
    Last Post CaptainJack  
    Started by Mindset, 04-21-2026, 06:46 AM
    0 responses
    246 views
    0 likes
    Last Post Mindset
    by Mindset
     
    Started by M4ndoo, 04-20-2026, 05:21 PM
    0 responses
    350 views
    0 likes
    Last Post M4ndoo
    by M4ndoo
     
    Started by M4ndoo, 04-19-2026, 05:54 PM
    0 responses
    179 views
    0 likes
    Last Post M4ndoo
    by M4ndoo
     
    Working...
    X