Announcement

Collapse

Looking for a User App or Add-On built by the NinjaTrader community?

Visit NinjaTrader EcoSystem and our free User App Share!

Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less

Partner 728x90

Collapse

Position.MarketPosition across multiple instruments

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

    Position.MarketPosition across multiple instruments

    I have a strategy that I want to simultaneously run on multiple instruments (6E, 6B, 6A, etc). Before entering a trade I want to make sure I'm not already in a trade. I usually do a Position.MarketPosition != Long/Short check. However, I only want to make sure I'm flat on a given instrument, but if I'm long or short on another instrument I still want to get in. For example, if I'm already long on the 6E and I get a signal to go short or long on the 6B, I want to be able to, but if I'm already in a position on the 6B I want ti avoid the signal. So how do I check my market position on a given instrument instead of my entire account?

    #2
    Hello,

    Try using Positions[inx]:
    DenNinjaTrader Customer Service

    Comment


      #3
      Originally posted by NinjaTrader_Ben View Post
      The link you gave me is an example how to manage positions in multiple instruments in 1 strategy.

      I want to run multiple strategies, each one on a different instrument, so instead of checking Positions[] I want to check to see if I have a position on a specific instrument, which may be managed inside of another strategy.

      Comment


        #4
        Hello,

        Strategies don't/can't communicate between each other and I believe each marketposition is specific for each strategy and instrument. So what you are trying to do is likely not possible, but I'll have someone double check this on Monday to be sure I am correct.
        DenNinjaTrader Customer Service

        Comment


          #5
          I'm not trying to communicate intra-strategy, I just want to know if I'm long or short in the instrument I'm trading, not if I have a long or short position on any instrument.

          Comment


            #6
            shodson,

            Unfortunately account level positions is not available from a NinjaScript. You can only access information in relation to the particular instance of the strategy. There is no information across multiple strategies and aggregating a position off of that.
            Josh P.NinjaTrader Customer Service

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by FAQtrader, 04-25-2024, 12:00 PM
            15 responses
            230 views
            0 likes
            Last Post op1031
            by op1031
             
            Started by RaddiFX, Today, 11:26 AM
            2 responses
            8 views
            0 likes
            Last Post RaddiFX
            by RaddiFX
             
            Started by morleyc, Today, 11:37 AM
            2 responses
            10 views
            0 likes
            Last Post morleyc
            by morleyc
             
            Started by martin70, Today, 04:06 AM
            5 responses
            10 views
            0 likes
            Last Post NinjaTrader_Jesse  
            Started by haakonflaar, 07-04-2023, 02:13 PM
            3 responses
            147 views
            0 likes
            Last Post NinjaTrader_Gaby  
            Working...
            X