Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Multiple Simultaneous Strategies

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

    Multiple Simultaneous Strategies

    Hi all,

    Would love some insight into running multiple strategies simultaneously. I have a single strategy that I’m trying to run using different parameters and data series timeframe for each part of the trading day. I have 7 “trading windows” during the day, each of which requires a different set of parameters and data series timeframe, but using the same strategy. The most optimal way I could think of was to add a trading window parameter to the strategy and then run 7 instances of the same strategy, each with its unique parameters, and mutually exclusive trading window. i.e. each strategy can only ENTER a position if it’s within its own unique trading window. All entries are accompanied by a target and trailing stop, however, when one strategy gets into its trading window there’s usually an open position from the previous strategy instance. Despite checking for status of ‘position.MarketPosition’ before any conditions, I was still getting multiple positions opened in the same direction, even when ‘EntriesPerDirection’ is set to 1 and ‘EntryHandling’ is set to ‘EntryHandling.UniqueEntries’. I then revised the script to check open positions using the ‘Account.Positions’ property instead. This got rid of the multiple positions being opened, however, targets and stop-losses look like they’re being carried over resulting in a single position being opened while multiple targets and stop-losses are still there. This resulted in the strategy sometimes thinking there are multiple positions open when in fact there’s only 1 or none.


    My objective is to have a trading system running 24/7 with the same strategy but using different parameters during each trading window. Doing this with one single script doesn’t seem possible since the parameters are set in the ‘State == State.SetDefaults’ section of the script. Or is it?

    Would appreciate any input on how to best deal with this.

    #2
    Hello Dexter_13,

    Thank you for your post.

    Having multiple strategies running on the same instrument and account will likely cause the strategy instance's position to not be in sync with the account position (which is likely what you are seeing leading to the unexpected behavior).

    It is recommended to run these on separate accounts instead, to prevent unwanted account positions. Further, each strategy instance has an independent position which does not have any supported methods to be read by another strategy instance.

    Below is a link to forum post that provides a warning about this.



    You could combine all the logic into one strategy. Parameters, like user inputs, set in State.SetDefaults can be accessed and changed from later in the script.

    Please let me know if you have any other questions. ​​
    Last edited by NinjaTrader_Gaby; 06-17-2024, 08:38 AM.

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by NullPointStrategies, Today, 05:17 AM
    0 responses
    50 views
    0 likes
    Last Post NullPointStrategies  
    Started by argusthome, 03-08-2026, 10:06 AM
    0 responses
    126 views
    0 likes
    Last Post argusthome  
    Started by NabilKhattabi, 03-06-2026, 11:18 AM
    0 responses
    69 views
    0 likes
    Last Post NabilKhattabi  
    Started by Deep42, 03-06-2026, 12:28 AM
    0 responses
    42 views
    0 likes
    Last Post Deep42
    by Deep42
     
    Started by TheRealMorford, 03-05-2026, 06:15 PM
    0 responses
    46 views
    0 likes
    Last Post TheRealMorford  
    Working...
    X