Documentação e Guias do Usuário

Aprenda o básico, ou aperfeiçoe suas habilidades com tutoriais projetados para inspirar.

Last updated on 29. 8. 2025 by Kornel Mazur

Testes de Monte Carlo

Testes de Monte Carlo

Testes de Monte Carlo are an integral component of StrategyQuant X’s robustness testing framework, designed to assess the stability, resilience, and potential risk exposure of trading strategies. Through the use of controlled randomness, these simulations allow users to evaluate how their strategies might perform under a range of unpredictable and adverse conditions.

What Are Monte Carlo Tests?

Monte Carlo Tests are a statistical simulation method that evaluates trading strategies by subjecting them to randomized variations in parameters such as:

  • Trade execution order
  • Market conditions (spread, slippage)
  • Strategy input parameters
  • Historical price data

These simulations generate a distribution of outcomes rather than a single result, providing deeper insight into a strategy’s potential behavior and highlighting worst-case scenarios that may not be visible in traditional backtesting.

O primary purpose of Monte Carlo testing in StrategyQuant X is to:

  • Detect sobreajuste ou fragility
  • Assess robustez under random perturbations
  • Evaluate confidence intervals of key metrics like Net Profit and Drawdown
  • Apoio informed decision-making before deploying strategies in live environments

Monte Carlo Methods in StrategyQuant X

In StrategyQuant X, two types of Monte Carlo tests are available:

1. Monte Carlo Trade Manipulation

This method performs simulations by manipulating the sequence and availability of executed trades. It is computationally efficient as it does not require backtesting; instead, it operates directly on the existing trade list from the main backtest.

Available Manipulation Techniques:

  • Randomizar a ordem de comércio
    • Shuffles the order of executed trades.
    • 2 types of Randomization:
      • Resampling: the program randomly samples a specified number of trades from the entire pool of historical trades. The key difference with this method is that the list of trades may vary each time; it can select the same trade multiple times while potentially omitting others entirely.
      • Exact: This method considers all trades.
  • Saltar aleatoriamente
    • Simulates skipped trades with a defined probability.
    • Reflects real-life issues such as:
      • Connectivity loss
      • Platform failures
      • Manual trading interruptions

Interpretation of Results

Each simulation produces:

  • A unique equity curve
  • A summary table of key metrics (Net Profit, Max Drawdown, etc.) across selected confidence levels (e.g., 80%, 90%, 95%)

Exemplo:

If the original Net Profit was $6,990 and Monte Carlo results at 95% confidence show $3,943, this means there's a 5% chance the strategy would earn less than $3,943 under similar trade disruptions.

Key Insight: Helps identify the risk of deterioration in performance due to execution variance.

2. Monte Carlo Retest Methods

Unlike trade manipulation, these simulations introduce variations that require full re-backtesting of the strategy for each scenario. They are computationally intensive but offer valuable insights into strategy sensitivity.

Monte Carlo Retest Methods:

  • Randomize history data (by tick), with probability X% up / X% down and max price change of ATR X% up / X% down
    • This randomizes tick values as they come from the data feed, with independently adjustable probability and size of change up and down.
    • DOES THIS REQUIRE TICK DATA????

Key Retest Methods:

  • Randomizar os parâmetros estratégicos
    • Applies random changes to parameters (e.g., indicator periods) within a defined range.
    • Configurações:
      • Probability of Change – chance that a parameter will be modified
      • Max Parameter Change – % deviation from original value
      • Example: Parameter = 60, Max Change = 10% → new value range = 54–66
  • Randomizar dados históricos
    • Alters OHLC values slightly using a defined probability and magnitude (based on ATR).
    • Simulates sensitivity to small changes in price behavior
    • Configurações:
      • Probability of Change – per bar
      • Max Price Change – % of ATR
  • Randomize a barra inicial - isto testará o comportamento da estratégia quando os testes começarem em uma barra inicial diferente. É óbvio que uma boa estratégia não pode ser sensível à barra em que se inicia o teste.

These methods test if the strategy is overfitted to specific conditions in the historical data or parameter values.

Performance Considerations

Each Monte Carlo Retest simulation requires a full backtest.

Exemplo:

If one backtest takes 0.5 seconds, running 100 simulations would require approximately 50 seconds per strategy.

Confidence Levels

StrategyQuant X supports the following confidence levels:

50, 60, 70, 80, 90, 92, 95, 97, 98, 99, 100

Filtering Support

You can configure filters to automatically reject strategies that deteriorate significantly in MC scenarios.

Exemplo:

Filter out any strategy where MC Net Profit < 80% of original Net Profit.

Only these values are accepted for valid results.

Monte Carlo testing provides a powerful way to stress-test strategies, offering a more realistic assessment of their live trading potential. By identifying weaknesses that are not visible in standard backtests, traders can make more robust and confident deployment decisions.

Este artigo foi útil? O artigo foi útil O artigo não foi útil

0 Comentários
mais antigos
mais recentes Mais votado