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 NullPointStrategies, Yesterday, 05:17 AM
    0 responses
    64 views
    0 likes
    Last Post NullPointStrategies  
    Started by argusthome, 03-08-2026, 10:06 AM
    0 responses
    139 views
    0 likes
    Last Post argusthome  
    Started by NabilKhattabi, 03-06-2026, 11:18 AM
    0 responses
    75 views
    0 likes
    Last Post NabilKhattabi  
    Started by Deep42, 03-06-2026, 12:28 AM
    0 responses
    45 views
    0 likes
    Last Post Deep42
    by Deep42
     
    Started by TheRealMorford, 03-05-2026, 06:15 PM
    0 responses
    50 views
    0 likes
    Last Post TheRealMorford  
    Working...
    X