• If this is your first visit, you will have to register before you can post. To view messages, please scroll below and select the forum that you would like to visits. Questions? Be sure to check out the Forum FAQ.

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 jeronymite, Today, 01:57 AM
    0 responses
    3 views
    0 likes
    Last Post jeronymite  
    Started by vonboettichert, Today, 01:24 AM
    1 response
    6 views
    0 likes
    Last Post NinjaTrader_Marco  
    Started by U0000999, Yesterday, 11:17 PM
    1 response
    12 views
    0 likes
    Last Post NinjaTrader_Marco  
    Started by tjendra, Yesterday, 10:00 PM
    0 responses
    7 views
    0 likes
    Last Post tjendra
    by tjendra
     
    Started by momchi, Yesterday, 09:19 PM
    0 responses
    8 views
    0 likes
    Last Post momchi
    by momchi
     
    Working...
    X