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

Backtesting Strategy and Monte Carlo

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

    Backtesting Strategy and Monte Carlo

    Hi,

    I looked at the Monte Carlo simulation and ran the test on a strategy. I don't quite understand Monte Carlo explanation and the chart that is displayed in NT8 documentation page.

    What is Monte Carlo Simulation?
    Monte Carlo Simulation is a mathematical technique that uses repeated random sampling ("sampling with replacement") to compute a range of possible results with their respective probability. NinjaTrader runs Monte Carlo Simulation by randomly combining the trade results in a defined series of simulations. A graph of the results are plotted with the statistic values or Profit/Loss on the Y - axis and the probability on the X - axis as a percentage.

    Question 1: How does NT8 combine trade results in a defined series of simulations? What does it mean by a defined series of simulations or what kind of simulations?


    Question 2: Would you be able to explain in simple terms what does Monte Carlo report means and how I should read it. I read the explanation but I am still a bit confused about the X-Axis explanation. What does the green, blue, yellow, lines means. Are these four different scenarios (Best to Worse)? Can I look at the details of these scenarios?

    https://ninjatrader.com/support/help...carlograph.png

    Thanks,

    #2
    Hello bjunaid,

    Thank you for your post.

    A Monte Carlo Simulation grabs all your trades generated from the backtest, optimization, or strategy optimization (the "defined series of simulations" would refer to which one of these you ran), and randomizes them. It then does this multiple times to generate multiple equity curves. Then it generates statistics off of the multiple equity curves. What is shown is the statistics of those numerous equity curves. As trades are randomized you do not necessarily end up with the same equity curve especially when you run the risk of being wiped out.

    Monte Carlo grabs trades by random to add into its test. This is not to say it can only grab the trade once. The same trade theoretically can be grabbed twice, three times, etc. thus resulting in different probabilities and equity curves.

    A graph of the results is plotted with the statistic values or Profit/Loss on the Y - axis and the probability on the X - axis as a percentage.

    For example, in the below screenshot I've run the Monte Carlo simulation three times on my backtest results for the Sample MA Crossover. The yellow line is the most recent, and we can see that it predicts a 65% chance that the strategy would lose $17,050 (the graph is showing Net Profit probability).

    Click image for larger version

Name:	2020-12-09_09-35-27.png
Views:	516
Size:	131.7 KB
ID:	1131484

    The different lines are generated each time you run a new Monte Carlo simulation, since it's randomized and different each time. This is so you may compare multiple runs to see patterns in them.

    Please let us know if we may be of further assistance to you.
    Kate W.NinjaTrader Customer Service

    Comment


      #3
      Thanks Kate! for the detailed explanation. Really appreciate it.

      Comment


        #4
        Hi Kate,

        I've had a similar question about how to understand and interpret the Monte Carlo graphs. I don't think both of these things can be true:
        'a 65% chance that the strategy would lose $17,050'
        'a 99% chance the strategy would make $60,000'

        What is the right way to read the Monte Carlo graph and actually understand it? What is a 'good' graph going to look like?

        I've attached my Summary and Monte Carlo graph. I would think these are bad results because the sharpe ratio is below 1 and the Monte Carlo is saying there's only a 50% chance of making the backtested profit of $17,000. 50% chance is just flipping a coin so that is very very bad, no better than random.

        Or, are these actually good results but I just don't know how to interpret them as being good? What do good results look like?

        Thanks for your help and education!
        JMC
        Attached Files

        Comment


          #5
          Hello JayMC,

          Thank you for you reply.

          I should be a little more clear here. In my example, there is a 65% chance that your PnL would be -$17,050 or worse.

          From our help guide:

          The horizontal axis of the Monte Carlo Simulation graph shows the percentage of simulations that have fallen below the Y - axis value. For example, if you run a Monte Carlo Simulation setting the # of Simulations to "100" and using the Cumulative Profit graph, the intersection of the 50% X - value and the associated Y value means that 50 of your simulations will be below that cumulative profit/loss value, and oppositely the remaining 50 simulations will have a greater cumulative profit/loss. This type of report allows you to analyze if the risk/reward ratio between worst and best case scenarios is acceptable or not.

          You can think about 100% as being the best possible outcome based on the simulations run. So, if you have $60,000 corresponding with 99%, 99% of the time you can expect that the strategy will make up to $60,000.

          So, looking at your graphs, we can see that in 50% of the time you could likely expect a profit of $17000 or better, but 50% of the time it would be $17000 or worse.

          Please let us know if we may be of further assistance to you.
          Kate W.NinjaTrader Customer Service

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by yertle, Yesterday, 12:24 PM
          1 response
          10 views
          0 likes
          Last Post yertle
          by yertle
           
          Started by Mr Bread, Today, 04:25 AM
          2 responses
          9 views
          0 likes
          Last Post Mr Bread  
          Started by kandise, Today, 09:41 AM
          0 responses
          2 views
          0 likes
          Last Post kandise
          by kandise
           
          Started by Mubeen Haider, Today, 09:41 AM
          0 responses
          5 views
          0 likes
          Last Post Mubeen Haider  
          Started by nicbizz, Today, 09:02 AM
          0 responses
          7 views
          0 likes
          Last Post nicbizz
          by nicbizz
           
          Working...
          X