Monte Carlo - Ausführung nach dem Zufallsprinzip verschlechtern
Unvollkommenheiten bei der Ausführung, wie z. B. Kursabweichungen oder vorübergehend größere Spreads, sind beim Live-Handel häufig anzutreffen. Diese Faktoren können dazu führen, dass der tatsächliche Schlusskurs eines Geschäfts ungünstiger ausfällt als der während des Backtests beobachtete oder angestrebte Idealpreis. Diese Monte-Carlo-Simulation modelliert die Auswirkungen solcher zufälligen Ausführungsprobleme.
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 ClosePreis of the selected trades. The amount by which the ClosePreis 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 OpenPrice to the original ClosePreis). A “worse” price means a unter 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 auch 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.
Wie importiert man Snippets / benutzerdefinierte Indikatoren in SQX:
- https://strategyquant.com/doc/programming-for-sq/import-export-custom-indicators-and-other-snippets/