Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Best way to determine market position?

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

    Best way to determine market position?

    What is the best way to determine and save current market position from within a strategy? Suppose in my strategy class I have a protected varaible:

    protected MarketPosition currentMarketPosition;

    Then it looks like I have several options:

    1. in OnBarUpdate I can use

    this.currentMarketPosition = Position.MarketPosition;

    2. Or, i can implement OnPositionUpdate. I think (but I'm not sure) that OnPositionUpdate passes the current market position in:

    protected override void OnPositionUpdate(Cbi.Position position, double averagePrice, int quantity, MarketPosition marketPosition)
    {
    this.currentMarketPosition = marketPosition;
    }

    Is there any advantage or disadvantage of using either of these? Is my understanding correct that both will work?

    #2
    Hello westofpluto,

    Thank you for your post.

    Position contains position-related information pertaining to a strategy and already holds the current market position in .MarketPosition. That being said, it is not necessary to save the current market position to a variable since we can access the strategy's current market position by calling Position.MarketPosition.

    I have attached a help guide link below for more information.

    Position - https://ninjatrader.com/de/support/h.../?position.htm

    OnPositionUpdate is driven by Position update events and updates the account position (PositionAccount). OnPositionUpdate should not necessarily be considered for a change in strategy position. if you would like to get the current position of an account, you may use AccountPosition.MarketPosition.

    Here is a help guide link for more information.

    PositionAccount - https://ninjatrader.com/de/support/h...ionaccount.htm

    OnExecutionUpdate is driven by Execution events and updates the strategy position (Position). If you want to get the current market position of a strategy the moment an order is filled you could call Position.MarketPosition in OnExecutionUpdate.

    Please review the help guide link below for more information about OnExecutionUpdate.

    OnExecutionUpdate - https://ninjatrader.com/support/help...tionupdate.htm

    Please let us know if we may assist further.
    <span class="name">Brandon H.</span><span class="title">NinjaTrader Customer Service</span><iframe name="sig" id="sigFrame" src="/support/forum/core/clientscript/Signature/signature.php" frameborder="0" border="0" cellspacing="0" style="border-style: none;width: 100%; height: 120px;"></iframe>

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by NullPointStrategies, Today, 05:17 AM
    0 responses
    41 views
    0 likes
    Last Post NullPointStrategies  
    Started by argusthome, 03-08-2026, 10:06 AM
    0 responses
    124 views
    0 likes
    Last Post argusthome  
    Started by NabilKhattabi, 03-06-2026, 11:18 AM
    0 responses
    64 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
    46 views
    0 likes
    Last Post TheRealMorford  
    Working...
    X