Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

MarketPosition with multi-instrument strategy

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

    MarketPosition with multi-instrument strategy

    Hi,

    I have a strategy that I'm running fine, but I just added multi-instrument to it. I'm running the strategy on the ES chart. When I do a check of MarketPosition, and I'm flat on ES but long AAPL for example, I get a reading of MarketPosition being flat.

    I'm sure this is an easy fix, but I couldn't find it in the documentation. How do I check the MarketPosition of AAPL (assuming it is my 2nd instrument and ES is my first)?

    Thanks,

    Rich

    #2
    Hello Rich,

    You use Positions[x] , where x is the series index.

    if (Positions[1].MarketPosition == MarketPosition.Long)
    Print(Positions[1].MarketPosition.ToString());
    Ryan M.NinjaTrader Customer Service

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by andrewtrades, Today, 04:57 PM
    0 responses
    1 view
    0 likes
    Last Post andrewtrades  
    Started by chbruno, Today, 04:10 PM
    0 responses
    3 views
    0 likes
    Last Post chbruno
    by chbruno
     
    Started by josh18955, 03-25-2023, 11:16 AM
    6 responses
    436 views
    0 likes
    Last Post Delerium  
    Started by FAQtrader, Today, 03:35 PM
    0 responses
    6 views
    0 likes
    Last Post FAQtrader  
    Started by rocketman7, Today, 09:41 AM
    5 responses
    19 views
    0 likes
    Last Post NinjaTrader_Jesse  
    Working...
    X