MULTICHARTS BACKTESTING TUTORIAL

Share This Post

Share on facebook
Share on linkedin
Share on twitter
Share on email

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;
End;

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.

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.

MultiCharts Backtesting Automated Trading System
MultiCharts Backtest Trading System

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.

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

If Close < LowW(1) then SellShort 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;
End;

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:

Inputs:
Length_RSI(14),
OverBougth(70),
OverSold(30);

Vars:
Value_RSI(0);

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 strategy equity curve of the trading system

MultiCharts Optimization Trading System

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

Click on Optimization and select regular optimization.

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

Now you only have to set the optimizable inputs.

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

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

multicharts backtesting for optimization
Multicharts optimization backtesting
MultiCharts Optimization graph 3d
backtesting and optimization tutorial
Multicharts equity line trading system

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.

We have to insert a small filter but 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 in order not to decrease the number of operations too much.

Inputs:
Length_RSI(14),
OverBougth(70),
OverSold(30),
Average_Fast(10),
Average_Slow(50);

Vars:
Value_RSI(0),
DownTrend(False);

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.

Inputs:
…….
…….
Time_Exit(5);

 

 

Do you want to learn EasyLanguage & PowerLanguage for TradeStation and MultiCharts? Start here:

Learn more about EasyLanguage Number to String:

TradeStation Link

MultiCharts Link

Subscribe To Our Newsletter

Get updates and learn from the best

Recent Posts

Eurusd Chart Technical Analysis || 2020

In this page, we study Eurusd using a lot of technical analysis indicators and strategies. Eurusd Analysis using RSI Indicator Today we analyze the Eurusd

Donate

My name is Luca. I grew up in Italy. I have a degree in law and I’m an independent trader since 2007. 

I’m a systematic trader and sometimes, I trade using options strategies with US ETFs and Stocks.

I have built hundreds of automated trading systems and indicators for TradeStation, MultiCharts and MetaTrader.

I started this blog in 2017 to share what I learned in the financial market.

Follow us on :-

WhatsApp us whatsapp