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 ezrollin, 02-26-2022, 11:14 PM
            4 responses
            189 views
            0 likes
            Last Post kenz987
            by kenz987
             
            Started by futtrader, 04-27-2024, 01:16 PM
            2 responses
            35 views
            0 likes
            Last Post futtrader  
            Started by tradingnasdaqprueba, 04-09-2024, 09:52 AM
            5 responses
            25 views
            0 likes
            Last Post tradingnasdaqprueba  
            Started by marinam, Today, 03:45 PM
            0 responses
            4 views
            0 likes
            Last Post marinam
            by marinam
             
            Started by cmtjoancolmenero, Today, 03:40 PM
            0 responses
            4 views
            0 likes
            Last Post cmtjoancolmenero  
            Working...
            X