• Testing of popular indicators;
  • Trading strategies;
  • Test results.

Hello everyone! DmitryPetrov2 is with you again.

With this post I am starting a complex and important topic..

Automation of trading or trading with bots based on technical analysis indicators. 

The material will be useful for beginners who are just starting their acquaintance with technical analysis, Tradingview and work with trading robots for cryptocurrencies.

What we will analyze today:

  • What is backtesting;
  • How to conduct tests;
  • What are the pitfalls;
  • What types of indicators are available on Tradingview;
  • Let’s run history tests for 5 indicators;
  • We will analyze and find the best indicator for auto trading.

You are probably already familiar with Tradingview (abbreviated as TV) – a platform for technical analysis and a social network of traders from all over the world. And you saw the variety of indicators that are offered there..

Everyone wondered what to choose in order to trade on the machine with constant profit? 

MACD or RSI? Trade moving averages, draw shapes or find popular patterns by eye?

In this article-experiment, we will figure out which of the most famous indicator would bring you the maximum profit if you started using it a year ago or even earlier. Just one indicator and nothing more.

Before embarking on this exciting journey, we need to figure it out. What is strategy testing? What are the tests?

Go!

Why Test Strategies? Backtest or tests on history

In order to successfully trade by indicators, it is extremely important to understand for yourself – What are the chances that this or that indicator will be profitable in the long term?

Of course, you can set up a strategy and understand in a few months that it does not work, but only brings losses. This is called live data testing. The probability that you will be able to launch a successful strategy from 1 or even 10 times is extremely small.

So how to find out at least approximately whether you have chosen a working strategy or not?

For these purposes on TV the strategy testing functionality has been developed. It is called – Backtest, which can be translated as Reverse Test or a test on historical data. People call it simply – Backtest.

How it works:

  1. Choose the desired strategy from the list of indicators;
  2. Open the backtests tab;
  3. See the indicators of the profitability of your strategy;
  4. You decide what to do next. Trade, adjust strategy settings or change strategy.

At first glance, this may sound incomprehensible. But for now, we are dealing with the very concept of a backtest. Below in the course I will show everything in pictures.

The most important thing now is to realize that backtesting is just an indicator of how your trade might turn out if you had been trading for such a long time..

Important! Even if you don’t know English, get used to the terminology. I use the English version and I will write all the points in English with a Russian explanation. 

Where to find backtests

  1. At the very bottom we find the tabs;

  1. We select the icon with a window in the same place below;
  2. Expanding the screen.

Overview

Initially, we get to the overview page. 

And we see the following indicators:

  • Net Profit – the potential net profit that could be obtained;
  • Total Closed Trades – total closed deals;
  • Percent Profitable – percentage of profitable trades;
  • Profit Factor(profit divided by losses) – profit-to-loss ratio during testing. In what follows we will call Profit Factor;
  • Max Drawdown – the maximum drawdown of your trading deposit;
  • Avg. Trade – average profit per trade;
  • Avg. # Bars In Trade – the average number of candles per trade.

As you can see, if you traded my Super Secret strategy on only one bitcoin, then you would earn 28406% for 1455 trades. 78.35% of your bets would be profitable. Profit Factor would be 11.038. The maximum drawdown would be only 2.05%, and the average order would bring us 19.52%. And the average time per trade would be 8 candles. Such is a great strategy) 

Ideally! I bought it on the blue arrows below, and sold it on the red ones above. Profit!

You might think that this has accumulated since the inception of bitcoin. But no. The first trades were made on December 7th. 28406% for 3.5 months!! 

In fact, I deceived you. This does not happen in nature. No indicator can work so perfectly. If you start trading this strategy, you will see the following:

  1. There was a signal to enter;
  2. You are logged in;
  3. After a while, you updated the page and the signal disappeared, but appeared several candles later. 

It is called REPAINT or redrawing. I will not go into too much detail about why this is happening. This is a problem in the strategy programming language. Perhaps in the next article on auto-trading by indicators I will dwell on this point in more detail.

I will explain how to determine whether there is a redrawing or not..

  1. Very large Profit Factor (I gave the definition above). In real strategies, it rarely exceeds 2;
  2. Turn on the strategy on minute candles. Watch for frequent signals;
  3. Wait for the first beep. Remember or mark this point;
  4. Wait 5-15 minutes and reload the page;
  5. Has the entry point shifted? The strategy is in the trash heap. Search further. 
  6. Is the point left? Most likely your strategy is normal. But it’s better to play it safe before betting money on this strategy. Run and wait longer. Better to wait once than to lose.

Basic backtest metrics

There are 24 indicators in the strategy effectiveness section. We won’t dwell on them. 

Let’s focus on Net Profit – net profit, Max Drawdown – maximum drawdown, Profit Factor – the ratio of profit to loss and Percent Profitable – percentage of profitable trades. This will be enough.

Let’s summarize. Backtest tasks

  1. A backtest is needed in order to see how the strategy works in different situations: growth, decline, flat (market movement with minimal price fluctuations);
  2. Using the indicator settings to achieve maximum profitability on history;
  3. Minimize possible losses when trading.

IMPORTANT! 

  • If you decide to trade cryptocurrencies through a bot, do not blindly trust indicators. 
  • Always keep track of the current market situation;
  • Study thoroughly money and risk management in trading;
  • There is no guarantee that the strategy will work in real trading. Different volumes of market capitalization, fake news, new laws – everything can affect the price movement;
  • In general, always keep your finger on the pulse and do not overestimate backtesting. It’s just a starting point.

How to do the experiment?

In order for beginners to better understand the essence of the experiment, I will say a few words about the types of indicators on TV and their difference. Indicators on TV are computer programs or scripts that are written in the language Pine and calculate mathematically determined data and plot graphs. 

There are two kinds of scripts – Study and Strategy.

  1. Study – translated means research. This is a common indicator that you will trade. You can assign an alert to it, which will be sent to you when a signal appears. Study cannot be back tested.
  2. Strategy – the type of script that allows backtesting. Visually, it can be recognized by two arrows near the name.

What indicators are used?

There are hundreds and hundreds of indicators on TV. But we will focus on the most basic and famous:

  • RSI;
  • MACD;
  • Bollinger Bands;
  • Parabolic SAR;
  • Ichimoku Clouds.

How will we work?

  • Let’s take these indicators with their default settings;
  • We get on different candles (Timeframe) results;
  • Let’s analyze the results;
  • Let’s choose the best timeframes for each indicator;
  • As a result, we will choose the best indicator.

Backtests on indicators

I will not go into details about the essence of indicators. There is a lot of information in the public domain. I will leave links to definitions from the TOP-5 Google links for further independent study.

RSI

Relative Strength Index (RSI from English relative strength index) – determines the strength of the trend, as well as the likelihood of a trend reversal. Wikipedia

  • Find a strategy and add it to the chart.

  • We will not see the indicator itself. Signals only. Therefore, for convenience, add the indicator itself to the chart. In the same search, enter RSI and select Relative Strength Index;

Indicator parameters

  • Buy when the indicator curve crosses level 30;

IMPORTANT! To correctly identify the signal, it is important to take a closed candle into account. Otherwise, we may receive a false signal. Therefore, on the chart, we see the entry point 1 candle later. Consider this when creating your trading system.

Crossed the line and received a strategy signal on the next candle.

IMPORTANT! 

  • Due to the peculiarities TV we analyze only at the distance that we are allowed to. This is due to the internal limits of the platform itself;
  • Our exchange balance will be $ 100,000;
  • Commission 0.075% (Binance);
  • We trade only in LONG. Those. we earn only on growth;
  • We do not use Pyramiding(additional purchase within one order), i.e. one purchase = one sale.

Result

IMPORTANT! HODLIM – means what would happen if we bought a coin and did not twitch, do not trade, but simply hold.

Output

The result was so-so. More than half of the trades turned out to be profitable, but in the end this was not enough to overcome the losses.

Outsider Winner – 4 Hour Timeframe.

IMPORTANT! If we followed the transactions, then we would not allow such a deplorable state.

for instance:

We traded well. -37.54%

slightly smiling face

In reality, we would have closed at -3-5% maximum.

Profit in 3 days could have been almost 24%, but we closed in negative territory. When setting Trailing StopLoss or trailing, we would have come out in a guaranteed plus. Let not 24%, but + 3-5% for sure.

IMPORTANT! 

  • I’ll say it again – don’t blindly trust backtests;
  • Analyze coins by eye with a ruler;
  • Track the entry points and imagine how the bot would exit the trade by trailing;
  • If there is an understanding of those. analysis and support / resistance levels, try to figure out how you could get out with your hands. At what level would it be comfortable to do?

Everything that I wrote important in the section RSI, will apply to other indicators as well. I will no longer focus on these points. 

MACD

MACD indicator (English Moving Average Convergence / Divergence – moving average convergence / divergence) – as follows from the translation, the indicator displays the ratio between moving averages. Thus, it follows the trend, displays its strength and shows the expected reversal. Wikipedia

Indicator parameters

Buy when the blue curved line MACD crosses the orange signal line. 

Remember, huh? We buy after the closed candle, on which the event occurred.

results

Output

By all parameters, the 4-hour timeframe won. Good result.

Again unjustified falls.

But entrances before big growth are good enough. 

Bollinger Bands

Bollinger lines (stripes) (English Bollinger bands) – reflects the price deviation from the moving average. Lines limit price dynamics from above and below. Conventionally, they create a corridor within which prices are considered “normal”. Inside this “corridor” is a simple moving average SMA.

We buy when the price leaves the corridor, and then crosses its border back. We sell according to the same scheme – we broke through the line and returned inside. Sell ​​on the next candle.Wikipedia

Options

results

Output

Again we see an unimportant picture. Solid cons.

The entrances are pretty good. So, I think, you can configure the bot to work sanely according to this strategy..

Parabolic SAR

Parabolic SAR – (English Parabolic SAR System) A trend indicator that displays the direction of the trend, changes acceleration depending on the price movement, shows well the pivot points. Wikipedia

Options

results

Output

Again, we see a large spread in profits. This comes from the fact that we are exploring different periods. In standard strategies, there is no way to set a period. This is done separately in the Pine editor. But the results are very interesting.

Out of trend, the strategy is useless. Since it trades either at zero or at a slight disadvantage.

But it keeps up with the trend very well, gives good outputs and shows pleasant results. 

Ichimoku Clouds

Ichimoku indicator, Ichimoku kinko hyo (Jap. 一 目 均衡 表 itimoku kinko: hyo 🙂 Ichimoku indicator, Ichimoku Clouds is an indicator that allows you to determine the trend, support and resistance levels. Based on this, signals are generated. Wikipedia

This is the last indicator for today..

I took a strategy from an unknown developer, because TV hasn’t made its strategy.

Options

results

findings

On a 2-hour timeframe, quite interesting results were obtained both in terms of profit and Profit Factor + percentage of profitable trades. 

According to this strategy, the most strange entries and exits. Either they entered too late, or they kept it for a very long time. In a flat, as expected, to no avail, since this is a trend strategy.

What do we do: again, we look at the inputs with a ruler, find some common features of the strategy, think about how to optimize.

General conclusions. Outcome

After analyzing 5 indicators, we got the following results. 

I must say right away that the results are not correct for the reason that they were tested at different distances. You can’t do this.

For a full test, it is important to set the date of the countdown. This is done by programmers according to your tech. assignment. 

Results reports contain little data for meaningful analysis and comparison. Because, this was already beyond the scope of the introductory material..

The main purpose of this material – to acquaint with the tool for testing strategies, to show in practice how to check the performance of indicators on history.

What conclusions did I draw for myself in this experiment

  • It is impossible to set up a full-fledged auto-trading based on one strategy;
  • Low profit in backtesting is not always a bad indicator of a strategy’s performance. Some strategies have good inputs, while others have better quality outputs.
  • Show that in our time there is no point in keeping coins for future use. Perhaps in the future everything will grow very much, but hardly any of the readers can afford to buy bitcoin and forget about it for a couple of years;
  • The number of profitable trades is not always a determining indicator of the effectiveness of a strategy;
  • It is important to be able to see with your eyes on the chart the advantages and disadvantages of a particular strategy;
  • The main conclusion is that there is no universal ideal strategy. Each strategy is good in its own way and is designed for its specific tasks..
  • A good trader needs to understand the essence of these strategies and use them skillfully;
  • Do not rely only on a strategy, but take part, observe the course of trading, see key levels / zones;
  • It’s important to learn to see which strategies would work well together. Ideally, you can combine them yourself or at least write a competent technical task for an indicator developer.

Self-improvement assignment for aspirants

  1. Find 10 any indicator strategies on TV and read their definition and the tasks they perform;
  2. Check each indicator for redrawing on the 1-minute timeframe and by the Profit Factor;
  3. Perform backtests on 5 different timeframes at will;
  4. Visually evaluate the entries and exits of the strategy;
  5. Evaluate backtesting results on standard settings;
  6. Try changing the settings to get higher profit margins;
  7. Set up alerts for these signals for reading in 3commas;
  8. Configure the bot for the desired cryptocurrencies;
  9. Place your minimum bid. Let’s say $ 10;
  10. Be sure to set StopLoss;
  11. Run the bot for a few days or 1 week;
  12. Check results periodically;
  13. If the strategy works, then increase your bet carefully..

DmitryPetrov2 was with you. No Pasaran! I wish you fresh trading ideas and successful trades!

Mike Owergreen Administrator
Sorry! The Author has not filled his profile.
follow me