Monte Carlo - Dégradation aléatoire de l'exécution
Les imperfections d'exécution, telles que le glissement des prix ou l'élargissement temporaire des écarts, sont des phénomènes courants dans les transactions en direct. Ces facteurs peuvent faire en sorte que le prix de clôture réel d'une transaction soit moins favorable que le prix idéal observé ou visé pendant le backtest. Cette simulation Monte Carlo modélise l'impact de ces problèmes d'exécution aléatoires.
If we apply this Monte Carlo test, a random percentage of trades (Probability) during the backtest will have their execution outcome degraded. This is achieved by worsening the Prix de clôture of the selected trades. The amount by which the Prix de clôture is worsened is also randomized for each affected trade, calculated as a random percentage (up to Max Degradation Percent) of the price range covered by that specific trade (from Prix ouvert to the original Prix de clôture). A “worse” price means a inférieur closing price for long trades and a higher closing price for short trades, thus reducing profits or increasing losses.
Simply said, by running 500 (or a different number) backtests, where each backtest applies this random price degradation to a different subset of trades and with varying severity, you can acquire a Monte Carlo analysis perspective on the strategy’s sensitivity to execution quality variations.
In this particular example, we might run 100 simulations with randomized execution degradation applied as described.
This test differs from applying a fixed slippage value to all trades. Here, the degradation effect is probabilistic:
-
Which trades are affected is random (based on Probability).
-
How much each affected trade is degraded is également random (up to Max Degradation Percent of its range).
Therefore, each simulation run represents a unique backtest scenario. One simulation might see trades #5, #23, and #58 degraded by small amounts, while another simulation might affect trades #12, #23, #45, and #70, with trade #23 potentially experiencing a larger price degradation than in the first simulation. If the number of Monte Carlo simulations is set to 500, there will be 500 unique backtest results, each reflecting a different plausible pattern of random execution imperfections. This helps assess the robustness of the strategy against unpredictable execution variations encountered in live markets.
Comment importer des snippets / indicateurs personnalisés dans SQX :
- https://strategyquant.com/doc/programming-for-sq/import-export-custom-indicators-and-other-snippets/