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 TheTechnician86, Today, 05:47 PM
            0 responses
            6 views
            0 likes
            Last Post TheTechnician86  
            Started by Ryan333, Today, 05:25 PM
            0 responses
            2 views
            0 likes
            Last Post Ryan333
            by Ryan333
             
            Started by hsammons87, Today, 05:21 PM
            0 responses
            4 views
            0 likes
            Last Post hsammons87  
            Started by Gmonte, 10-01-2022, 08:28 AM
            2 responses
            190 views
            0 likes
            Last Post charlesthomas  
            Started by ETFVoyageur, 05-18-2024, 12:45 AM
            5 responses
            32 views
            0 likes
            Last Post ETFVoyageur  
            Working...
            X