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, 05-11-2026, 05:56 AM
    0 responses
    52 views
    0 likes
    Last Post CarlTrading  
    Started by CarlTrading, 05-10-2026, 08:12 PM
    0 responses
    29 views
    0 likes
    Last Post CarlTrading  
    Started by Hwop38, 05-04-2026, 07:02 PM
    0 responses
    194 views
    0 likes
    Last Post Hwop38
    by Hwop38
     
    Started by CaptainJack, 04-24-2026, 11:07 PM
    0 responses
    355 views
    0 likes
    Last Post CaptainJack  
    Started by Mindset, 04-21-2026, 06:46 AM
    0 responses
    274 views
    0 likes
    Last Post Mindset
    by Mindset
     
    Working...
    X