Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Strategy filter for other position on the same instrument

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

    Strategy filter for other position on the same instrument

    Hello i want my strategy that it checks before the entry that only it enter if the position is flat or long. i am trying it woth a group: ((Position.MarketPosition == MarketPosition.Long) || (Position.MarketPosition == MarketPosition.Flat))

    But it stil entering if another strategy is short at the instrument. Have someone a tip?



    protected override void OnBarUpdate()
    {
    if (BarsInProgress != 0)
    return;

    if (CurrentBars[0] < 1
    || CurrentBars[1] < 0
    || CurrentBars[2] < 0)
    return;

    // Set 1
    (Closes[2][0] > Opens[2][0])
    // Long Strategy Filter
    && ((Position.MarketPosition == MarketPosition.Long) || (Position.MarketPosition == MarketPosition.Flat)))
    {
    EnterLong(Convert.ToInt32(QTY), @"Long");
    }​

    #2
    Hello Lopat,

    Strategies do not see what other strategies are doing, if you want to run multiple strategies on the same instrument we would suggest to combine their logic into a single strategy so it has all of the relevant information about what its doing.

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by CarlTrading, 03-31-2026, 09:41 PM
    1 response
    81 views
    1 like
    Last Post NinjaTrader_ChelseaB  
    Started by CarlTrading, 04-01-2026, 02:41 AM
    0 responses
    42 views
    0 likes
    Last Post CarlTrading  
    Started by CaptainJack, 03-31-2026, 11:44 PM
    0 responses
    64 views
    2 likes
    Last Post CaptainJack  
    Started by CarlTrading, 03-30-2026, 11:51 AM
    0 responses
    66 views
    0 likes
    Last Post CarlTrading  
    Started by CarlTrading, 03-30-2026, 11:48 AM
    0 responses
    54 views
    0 likes
    Last Post CarlTrading  
    Working...
    X