Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Instrument Lists and Monte Carlo Simulation

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

    Instrument Lists and Monte Carlo Simulation

    Is there a way we can create/configure an Instrument List dynamically in NinjaScript code? I have a multi instrument strategy that uses 5 instruments as a “basket” of instruments, that all take the same positions (long or short) in a given trade.

    The problem is that Strategy Analyzer treats each of these 5 instruments as their own individual trade, which usually isn’t a problem. However, my Monte Carlo simulation results seem to be too consistent and too good to be true. I suspect that it might be randomizing each individual trade, and not randomizing the basket of 5 instruments together, which could yield a very different result. Since my strategy is strictly intraday trades only, it would make the most sense to randomize the daily profit/loss returns.

    Can you shed some light on how Monte Carlo simulation randomizes a multi instrument strategy? Is it each trade, irrespective of the other instruments in the multi instrument strategy?

    Thanks,
    Sam

    #2
    Hello szayedoud,

    Thank you for your post.

    If you're running a basket test in the Strategy Analyzer, it would only run the Monte Carlo on each individual instruments trades - you can't run it on the Combined results which is what it sounds like you're looking to do.

    If you have a multi-instrument strategy that submits to all the instruments you want to use and then run a Monte Carlo on those results, then it would consider trades from all the instruments at the same time. Dynamically adding data series to a strategy is unsupported and can result in errors, so you'd need to hard code the instruments into the strategy that you wish to use.

    Please let us know if we may be of further assistance to you.

    Comment


      #3
      Thanks for your reply. Let me see if I understand this part “If you have a multi-instrument strategy that submits to all the instruments you want to use and then run a Monte Carlo on those results, then it would consider trades from all the instruments at the same time.”

      What do you mean by “submit at the same time?” I have a multi-instrument strategy, where all instruments take the same position (long or short) at the same time, and exit at the same time (within the same minute, each in their own 1 min data series). Even though it’s not defined as a basket or as Instrument List in the code (doesn't seem possible), it does act like a “basket”. These are all intraday trades - they either exit before the close on their own when exit rules are satisfied, or exit 2 min before the RTH close to follow the intraday margin policy.

      So when you say Monte Carlo “consider trades from all the instruments at the same time” - does that mean, these “same time” trades are considered as a group when it randomizes the returns? If so, then it is treating them as a basket, even though it's not spelled out that way in the code.

      So the question is - does it randomize the individual trades in the Strategy or it does randomize each daily return of the Strategy? What I was afraid of is that it was combining random trades across different time periods together, not grouping the same days. But it sounds like its grouping the same days together. Correct?

      Comment


        #4
        Hello szayedoud,

        Thank you for your reply.

        Let me see if I understand this part “If you have a multi-instrument strategy that submits to all the instruments you want to use and then run a Monte Carlo on those results, then it would consider trades from all the instruments at the same time.”

        What do you mean by “submit at the same time?”
        What I'm referring to is that the strategy has more than 1 data series coded into the strategy itself that it submits orders for and the logic to submit to different instruments is in the strategy itself.

        The Monte Carlo simulations will randomly grab trades from the entire run of the strategy. If it is a multi-instrument strategy all the trades for each instrument would be included in the collection it chooses from for the entire duration of the backtest, no grouping by days would take place.

        Please let us know if we may be of further assistance to you.

        Comment


          #5
          Ok, so if each day, the strategy trades Instrument A, B, C, D, and E. It could potentially string together ANY trade of ANY day in that period? So I could have a string of A-A-A-C-A-D--D-D-A-E on any random day of those trades - like this: A on 2/20 - A on 4/1 - A on 5/2 - C on 4/3, etc..... See where I am going with this?

          If this is how it works, this is not realistic representation of how an intra day multi-instrument strategy needs to be randomized. I use interdependent data between each instrument, and all trades for that day act as a group. The end of day's profit or loss is the most important thing. It really should be able to randomize on daily returns.

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by NullPointStrategies, Today, 05:17 AM
          0 responses
          51 views
          0 likes
          Last Post NullPointStrategies  
          Started by argusthome, 03-08-2026, 10:06 AM
          0 responses
          127 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