Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Detect Strategy position independently from Market position

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

    Detect Strategy position independently from Market position

    Hi,

    I am running on the same instrument two different strategies: one enters only long, the other enters only short. Only 1 contract is traded for each of them.
    In some cases it could happen that both have an open position, therefore MarketPosition = Flat, but Strategy1 = Long and Strategy2 = Short.
    The information about the 2 strategies is correctly reported in the "Strategies" Tab: 1L and 1S.

    My question is the following: is there a way to detect in my script what the Strategy Position is?

    I know about Position.MarketPosition, but Position.StrategyPosition or something equivalent is missing as far as I know. Is there any other option to get the Strategy Position, without having to follow every entry and exit within the script?

    Thank you
    Martin

    #2
    Hello,

    Thank you for your inquiry.

    The position of an account and the position of a strategy are separate., and the performance reports for accounts and strategies are also separate.To reference the strategy position, you would use Position.MarketPosition. For the account position, you would use PositionAccount.

    Running multiple strategies at a time on the same instrument and account will often cause the strategy instance's position to be out of sync with the account position.
    The Account Position will reflect all strategy-generated trades, but each Strategy position would only reflect positions generated by the strategy itself.

    For a strategy to effectively manage your account position, the strategy position and the account position would need to stay synchronized.
    Furthermore, a strategy cannot close orders submitted outside the strategy.

    This can have unintended consequences, and it is a better practice to consolidate the logic of all strategies into a single script.
    If you wish to trade the same instrument with multiple strategies at the same time, consider running them on separate accounts instead to prevent unwanted account positions.

    Please let us know if we may be of any further assistance.

    Comment


      #3
      Originally posted by martin70 View Post
      I am running on the same instrument two different strategies: one enters only long, the other enters only short.


      Same instrument?

      Good God, man, don't do that!

      It's a mistake, and will cost you dearly, sooner or later.

      Two suggestions:

      1. Use two different accounts.

      2. Setup a locking mechanism such that strategies can
      only enter a trade in their direction if they have acquired
      the lock. If the 2nd strategy can't acquire the lock, then
      that entry signal is ignored. The locking strategy should
      release the lock as soon as its position goes flat.

      Using #1 is easier, using #2 takes some coding skills.



      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by NullPointStrategies, Today, 05:17 AM
      0 responses
      19 views
      0 likes
      Last Post NullPointStrategies  
      Started by argusthome, 03-08-2026, 10:06 AM
      0 responses
      119 views
      0 likes
      Last Post argusthome  
      Started by NabilKhattabi, 03-06-2026, 11:18 AM
      0 responses
      63 views
      0 likes
      Last Post NabilKhattabi  
      Started by Deep42, 03-06-2026, 12:28 AM
      0 responses
      41 views
      0 likes
      Last Post Deep42
      by Deep42
       
      Started by TheRealMorford, 03-05-2026, 06:15 PM
      0 responses
      45 views
      0 likes
      Last Post TheRealMorford  
      Working...
      X