Analyzing and improving your strategies using What-If scenarios

What-If scenarios is a feature in Quant Analyzer tool that allows you to test various hypothesis of trading your strategy.

For example, what if:

  • You trade only from Monday through Wednesday?
  • You took maximum 1 trade per day?
  • You trade only from 9:00 to 15:00 each day?

Why to use What-If scenarios?

You can find how different scenarios would improve or damage your strategy performance.
In combination with Trade analysis you can pick days or hours that are not profitable for your strategy and test the strategy performance without these days.

The power of Quant Analyzer is that it allows you to try different ideas quickly. You can create new What-If scenario in less than a second, so you can experiment with various options and their combinations.

What-If analysis example 1 – improving strategy results

Let’s import try a simple example. We’ll start with the following strategy that we’ll import to Quant Analyzer.

It looks ok, but it has quite long period of stagnation. Can it be improved by using a few simple filters?

Trade analysis of this strategy

Let’s check how this strategy looks like in Trade analysis. We can see that trades on Monday and Wednesday generate loss instead of profit.

Let’s try to make a scenario where the strategy will be not traded during these days.
In the What-If tab just uncheck Monday and Wednesday and click on Create What If alternative.

This will compute new statistics from this strategy with trades opened on Monday and Wednesday removed from the results. The new strategy results will be added to the databank below.

We can see immediately that this strategy has bigger profit and much smaller drawdown (12% vs 21%). So by just not trading these two days we might be able to improve the strategy results.
The strategy equity was also improved.

Trying something else

An useful trick that works many times is to limit the number of trades per day. Often strategies have much better results if you set maximum of trades per day they should open.

Again, we can simulate it using What-If analysis. Let’s check all trading days to start from the initial state and this time check also Take maximum 1 trade per day. This means that strategy should not open more than one trade daily.

Click on “Create What If alternative” and new what-if scenario is created in the databank.

We can clearly see that this filter has even better results than the previous one. The net profit increased almost 2x with drawdown reduced to half. By using this condition the strategy is now even profitable on Wednesday!

The equity curve looks also much better than the original strategy:
And the stagnation period is also 4x shorter now.

Conclusion of example 1
The only thing we did is that we limited maximum number of trades to 1 per day.
By trying this simple alternative we doubled the profit and halved drawdown. And it didn’t take longer than 10 seconds to try this alternative in Quant Analyzer.

Example 2 – removing balance transactions

If you import the history of real or demo account to Quant Analyzer it often contains balance transactions – that means deposits and withdrawals. These transactions are loaded by EAA too and they distort the equity chart, making it less readable.

An example of account history with big deposit transaction:

Fortunately, there is an easy way to ignore this balance transaction using What-If scenario. Just check the Remove balance transactions and generate new What-If alternative.

The result is the same strategy, but with normally looking equity curve:

Example 3 – testing strategy dependence on few “great” trades

In this example we’ll use our original strategy example and we’ll try a different scenario – we’ll see how the results would change if the EA misses 5 best trades.

We can see that just by missing 5 biggest trades the strategy has much worse performance. This is common for trend following strategies that try to get as much profit from one trade as possible.

It is not something to worry about if your strategy depends on a very few great trades, so this scenario can act also as a strategy robustness test of a sort.

Other possibilities

There are more things you can try as what-if scenarios – you can set it to use fixed lots size, don’t take trade when another one is opened (remove overlapping trades), etc.

I believe that after this article you have the idea of possibilities of What-If scenario and how you can use it to analyze and improve your trading.

Please note that some of the improvements you can see using What-If scenario might be just pure luck or they might not work the same in real trading because trades might influence each other (depending on your strategy). For example, if you don’t take one trade it might influence subsequent trades and it could lead to different results.

You should always retest your strategy with these settings incorporated to make sure it works as expected.

Mark Fric

Mark Fric

Inline Feedbacks
View all comments

Continue reading

comparison blocks

Creating consecutive blocks in a Strategy Quant X

clonexJune 28, 2021

In StrategyQuant X 131, we have added two new comparison blocks. In this article we will discuss them in more detail. Comparison blocks are snippets that we can use in the Algo wizard or  Builder and are used to be able to compare two values. ( Left and Right )

How to build and backtest strategies in MultiCharts

Tomas VanekJune 15, 2021

Performing backtest of the strategy in the trading platform is a necessary step before going live. Generally, all trading platforms are performing the same tasks which are providing the environment …


Futures contracts and algorithmic trading strategies

tomas262June 4, 2021

Futures contracts have been around for over 300 years. It provides opportunities not only to hedge against future price fluctuations in various commodities and financials and also to speculate and trade more actively both manually and algorithmically. StrategyQuantX offers a very efficient to do so.