Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Multi-strategy script without cross-strategy interference

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

    Multi-strategy script without cross-strategy interference

    Hi there,

    I’m trying to execute multiple long-only strategies on a single instrument within one account in NinjaTrader, but the FIFO approach is causing issues when trades overlap. My goal is for these overlapping trades to be entirely unaffected by each other.

    Here’s what I’ve done:
    • I’m using a modular approach, coding each strategy as an indicator and using BarsInProgress to manage trades with unique string IDs for each position.
    • However, using Positions[x].MarketPosition to check each strategy's position state doesn’t work as expected. It seems NinjaTrader still views all trades as one aggregated position on the instrument, so if Positions[1] is Long, then Positions[2] also appears as Long, even if no trades were entered on data series 2.
    My questions:
    1. Is what I’m aiming to achieve possible in NinjaTrader?
    2. If I use custom variables to check position states (e.g., int strategy1Position = 1) instead of Positions[x], would this help bypass FIFO limitations on overlapping trades?

    TL;DR: Is it possible to work around NinjaTrader’s FIFO approach to avoid interference among overlapping, same-instrument positions in a single multi-strategy script?

    Any help is greatly appreciated!
    Last edited by TraderJosh; 11-07-2024, 07:41 AM.

    #2
    Hello TraderJosh,

    There would not be a way to avoid that. When you submit orders the position is incremented but there is no way to know which part of that position happened first. The Positions collection in strategies for multiple series use would only be helpful to find different positions on different instruments, that will otherwise work the same as the standard Position property.

    You can use signal names in your strategy to close part of a position but that requires submitting individual entries with unique signal names so the quantities can be associated with specific exits.

    Comment


      #3
      Thanks for your help Jesse.

      So to clarify, the way to circumvent FIFO issues would be to not use the Positions collection and instead use variables to track each sub-strategies position within the master strategy?

      Comment


        #4
        Hello TraderJosh,

        In a single strategy trading one instrument there is only ever 1 position, all orders you place contribute to that overall position and its average price so there is not a specific way to differentiate which order contributed to which part of a position since its just a single value. You could use variables to track which orders were placed first or however you wanted to track that but to the platform and broker you are just submitting orders to add or subtract from that position. The platform has the built in signal name system which can be used to link an entry and exit, that is mainly for making sure the exit uses a specific quantity from the associated entry.

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by argusthome, 03-08-2026, 10:06 AM
        0 responses
        116 views
        0 likes
        Last Post argusthome  
        Started by NabilKhattabi, 03-06-2026, 11:18 AM
        0 responses
        61 views
        0 likes
        Last Post NabilKhattabi  
        Started by Deep42, 03-06-2026, 12:28 AM
        0 responses
        40 views
        0 likes
        Last Post Deep42
        by Deep42
         
        Started by TheRealMorford, 03-05-2026, 06:15 PM
        0 responses
        43 views
        0 likes
        Last Post TheRealMorford  
        Started by Mindset, 02-28-2026, 06:16 AM
        0 responses
        82 views
        0 likes
        Last Post Mindset
        by Mindset
         
        Working...
        X