/ / MultiCharts backtesting tutorial

MultiCharts backtesting tutorial

MultiCharts backtesting is very simple and fast.

In this tutorial, we will show you how to perform a MultiCharts BackTest of a simple idea from scratch.

We will show you what your way of thinking should be while developing an idea.

It doesn’t matter if your trading system is complex or straightforward; the steps are always the same.

MultiCharts algorithmic trading should not be thought of only for automatic trading.

You can use MultiCharts Backtesting to perform discretionary strategy backtests.

Backtesting a discretionary strategy can be complicated, but at least the basic idea must stand up; otherwise, it is useless to waste time.

Many traders underestimate the importance of the MultiCharts Backtest for understanding the market.

Instead, it is possible to use MultiCharts BackTesting to discover bias or recurring patterns.

MultiCharts BackTest First Step

Let’s start with an idea as simple as it is effective over time.

How many times have you heard that the US stock market responds well to reversal logic? Well, let’s see if it’s true.

A reversal trading system buys when the market is going down and sells when the market is going up.

Meanwhile, let’s try to verify this hypothesis. Let’s create a system that buys on the lows of the previous week and sells on the highs of the last week.

This is our simple EasyLanguage trading system code:

If Close > HighW(1) then SellShort Next Bar at Open;

If Close < LowW(1) then Buy Next Bar at Open;

If barssinceentry > 5 then Begin
if marketposition = 1 then Sell Next Bar at Open;
if marketposition = -1 then BuytoCover Next Bar at Open;

As you can see in the picture, the strategy, however simple it is winning, and therefore, it can be said that this tool responds well to reversal logic.

MultiCharts Backtesting Automated Trading System

You can use this trading system every time you start analyzing a new financial instrument.

Knowing if it fits best in a breakout or reversal trading system is the first step.

At this point, we can obtain a confirmation by doing a MultiCharts BackTest of the opposite trading system: trend follower strategy.

In this case the Automated Trading System will go to buy after the breaking of a weekly maximum and to sell after the breaking of a minimum.

You bet on the continuation of the movement.

multicharts backtesting tutorial

MultiCharts BackTesting Reversal Strategy

Well, we now know that the ETF that reproduces the American stock index responds to reversal logic.

What could be the best way to trade an instrument in a reversal way?

Indeed, the most straightforward and most immediate is the RSI relative strength index indicator.

This important indicator indicates areas of oversold and overbought were to open a position contrary to movement.

We create a very simple EasyLanguage trading system to start trading with the RSI:



Value_RSI = RSI( Close, Length_RSI );

If Value_RSI < OverSold then Buy next bar at Open;

If Value_RSI > OverBougth then Sell Next bar at Open;

With a 1.86 profit factor, the idea may be correct, but the indicator used in its standard version with 14 periods opens only 15 trades in 20 years.

We need at least 100-200 trades to have statistical value.

We can start to try another setting for the RSI Indicator.

In this MultiCharts backtesting tutorial we’ll use the MultiCharts backtest optimization.

multicharts algorithmic trading

MultiCharts Optimization Trading System

To perform a MultiCharts optimization, you have to select the strategy or signal.

We backtest the overbougth and oversold value with 5 step value.

multicharts backtesting for optimization

Click on Optimization and select regular optimization.

We’ll talk about the WalkForward Optimization in other article.

We choose to try a large number of RSI value from 1 to 30 with 1 step.

Now you only have to set the optimizable inputs.

Multicharts optimization backtesting
backtesting and optimization tutorial

As you can see, the trading system operates only long and suffers in times of market collapse.

It is enough to see what happens in the crises of 2000 and 2007.

Multicharts equity line trading system

We have to insert a small filter without compromising the number of operations that must continue to be high.

To filter the signals, we can use an old trick.

Two moving averages, one fast and one slow to identify the trend.

We will have to perform a backtest to understand which settings to use, not to decrease the number of operations too much.



Value_RSI = RSI( Close, Length_RSI );

If Average(Close, Average_Fast) > Average(Close, Average_Slow) then
DownTrend = False;

If Average(Close, Average_Fast) < Average(Close, Average_Slow) then
DownTrend = True;

If Value_RSI < OverSold and DownTrend = False then Buy next bar at Open;

If Value_RSI > OverBougth then Sell Next bar at Open;

With 30 and 60 moving averages, we can stop operations during the downtrend phases without reducing operations too much.

So, in summary, we found a 10 period setting of the RSI with an OverBougth at 90 and an OverSold at 10.
We applied a trend filter with two 30- and 60-period moving averages.

This system produces 111 trades with a profit factor of 2.51, a profitable percentage of 79%.

Finally, we can try an output in time after x bars and see if the system improves.

Change the last line of the EasyLanguage code with this:

If Value_RSI > OverBougth or barssinceentry > Time_Exit then Sell Next bar at Open;

Remember to add Time_Exit in the input.


More from Finance Strategy System