Create and Test Forex Strategies
This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
| eas-guide:monte-carlo [2021/01/08 11:29] – ilan | eas-guide:monte-carlo [2025/09/12 07:22] (current) – Corrected "Randomize start bar" Miroslav Popov | ||
|---|---|---|---|
| Line 4: | Line 4: | ||
| Monte Carlo is the best tool for testing the strategy robustness. When you create a strategy, you see its backtest statistics. However, the strategy might be over-optimized (curve fitted). The goal of the Monte Carlo tool is to verify that the strategy is not over-optimized. This tool allows you to apply random changes to the market data, the execution of the strategy and the numeric parameters of the strategy indicators. | Monte Carlo is the best tool for testing the strategy robustness. When you create a strategy, you see its backtest statistics. However, the strategy might be over-optimized (curve fitted). The goal of the Monte Carlo tool is to verify that the strategy is not over-optimized. This tool allows you to apply random changes to the market data, the execution of the strategy and the numeric parameters of the strategy indicators. | ||
| + | |||
| + | {{youtube> | ||
| If you make minor changes to the strategy and its environment, | If you make minor changes to the strategy and its environment, | ||
| Line 13: | Line 15: | ||
| When you run the Monte Carlo tool, you actually do not run just a single test but 20 (by default) tests. Each test is random. It can use one or more simulations. | When you run the Monte Carlo tool, you actually do not run just a single test but 20 (by default) tests. Each test is random. It can use one or more simulations. | ||
| </ | </ | ||
| + | |||
| ===== Simulations ===== | ===== Simulations ===== | ||
| Line 18: | Line 21: | ||
| Here you can choose the simulations that will be used in the Monte Carlo tests. You select optional parameters for each simulation from the **Options** tab. | Here you can choose the simulations that will be used in the Monte Carlo tests. You select optional parameters for each simulation from the **Options** tab. | ||
| - | {{ : | + | {{: |
| **Market variations** | **Market variations** | ||
| * **Randomize history data** - The tool will take a certain number of random bars and change their range. It can change the bar's Low and High values in both directions. This will result in having higher or shorter bars. | * **Randomize history data** - The tool will take a certain number of random bars and change their range. It can change the bar's Low and High values in both directions. This will result in having higher or shorter bars. | ||
| - | * **Randomize spread** - If this option is enabled EA Studio can set the spread to a different value. It might vary within the limits set in Options. | + | * **Randomize spread** - If this option is enabled, EA Studio can set the spread to a different value. It might vary within the limits set in Options. |
| **Execution problems** - These are related to problems when executing the signals sent from the Expert Advisor to the broker. | **Execution problems** - These are related to problems when executing the signals sent from the Expert Advisor to the broker. | ||
| - | * **Randomize slippage** - Slippage is present on markets, where the prices change quickly. There may be a situation where the price changes by one or two ticks, before | + | * **Randomize slippage** - Slippage is present on markets where the prices change quickly. There may be a situation where the price changes by one or two ticks before the order gets to the broker and gets executed. If you enable this option, Monte Carlo will sometimes add a slippage in a direction contrary to the direction of the position. In the Options, you can set how often to use slippage and how much the slippage should be. |
| * **Randomly skip position entry** - Will skip opening some of the positions. This sometimes happens in the real world. It might occur due to problems on the broker' | * **Randomly skip position entry** - Will skip opening some of the positions. This sometimes happens in the real world. It might occur due to problems on the broker' | ||
| - | * **Randomly skip position exit** - Will sometimes skip closing the position. This one of course can be very destructive to the strategy. **Not** opening a position is not so bad since we won't lose any money. But **not closing** a position might result in a loss. | + | * **Randomly skip position exit** - Will sometimes skip closing the position. This one, of course, can be very destructive to the strategy. **Not** opening a position is not so bad since we won't lose any money. But **not closing** a position might result in a loss. |
| - | * **Randomly close position** - This happens only occasionally. Your broker might close your position for some reason. Of course brokers who close your positions | + | * **Randomly close position** - This happens only occasionally. Your broker might close your position for some reason. Of course, brokers who close your positions |
| Line 37: | Line 40: | ||
| - | * **Randomize indicator parameters** - EA Studio comes with this option off by default. This is because usually strategies do not change. If enabled EA Studio will choose | + | * **Randomize indicator parameters** - EA Studio comes with this option off by default. This is because usually strategies do not change. If enabled, EA Studio will select |
| - | * **Randomize backtest starting bar** - will randomize starting bar of the test. Sometimes starting at a different point in time might bring your account | + | |
| + | **Backtest start** | ||
| + | |||
| + | We call "order chain" the sequence of executed orders. As we have winning and losing positions, the total performance of the backtest depends on the starting point. | ||
| + | |||
| + | For example, if we start the test on a local performance high, then the following losing period may cause a significant drawdown. | ||
| + | |||
| + | The opposite case is also possible - if we start the test on a local low, the subsequent gains may show overestimated results. | ||
| + | |||
| + | * **Randomize backtest starting bar** - searches for a following opposite direction signal and starts | ||
| ===== Simulations chart ===== | ===== Simulations chart ===== | ||
| - | {{ : | + | {{: |
| By the default running the Monte Carlo tool will run 20 tests with randomized data. The randomization of the data will be done according to the **Simulations** checklist and the values in the **Options** tab. | By the default running the Monte Carlo tool will run 20 tests with randomized data. The randomization of the data will be done according to the **Simulations** checklist and the values in the **Options** tab. | ||
| Line 51: | Line 63: | ||
| ===== Confidence table ===== | ===== Confidence table ===== | ||
| - | {{ : | + | {{: |
| This table shows different statistics from the testing. | This table shows different statistics from the testing. | ||
| Line 69: | Line 81: | ||
| - | ===== Options | + | ===== Settings |
| - | {{ : | + | {{: |
| * **Count of tests** - choose how many tests you want to run. | * **Count of tests** - choose how many tests you want to run. | ||
| Line 102: | Line 114: | ||
| ===== Validation ===== | ===== Validation ===== | ||
| - | {{ : | + | {{: |
| - | When running the [[eas-guide: | + | When running the [[eas-guide: |
| The **Validated tests** setting uses the **Validation** settings in the Monte Carlo tool here. | The **Validated tests** setting uses the **Validation** settings in the Monte Carlo tool here. | ||
| - | {{ : | + | {{: |
| These are very similar and work in the same way as the general [[eas-guide: | These are very similar and work in the same way as the general [[eas-guide: | ||
| - | In the above example a strategy will be considered to have passed the Monte Carlo validation only if at least 80% of the tests pass. | + | In the above example, a strategy will be considered to have passed the Monte Carlo validation only if at least 80% of the tests pass. |
| - | ~~DISQUS~~ | ||