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 SalmaTrader, 07-07-2026, 10:26 PM
    0 responses
    92 views
    0 likes
    Last Post SalmaTrader  
    Started by CarlTrading, 07-05-2026, 01:16 PM
    0 responses
    51 views
    0 likes
    Last Post CarlTrading  
    Started by CaptainJack, 06-17-2026, 10:32 AM
    0 responses
    23 views
    0 likes
    Last Post CaptainJack  
    Started by kinfxhk, 06-17-2026, 04:15 AM
    0 responses
    34 views
    0 likes
    Last Post kinfxhk
    by kinfxhk
     
    Started by kinfxhk, 06-17-2026, 04:06 AM
    0 responses
    34 views
    0 likes
    Last Post kinfxhk
    by kinfxhk
     
    Working...
    X