• CROX ROAD
  • Posts
  • Why Your Crypto Trading Bot Isn’t Profitable?

Why Your Crypto Trading Bot Isn’t Profitable?

Bot trading strategies and backtests demonstrate how it may [in theory] generate profits. But we need to further investigate the specific reasons why certain methods are unsuccessful in actual trading.

THE 4 HORSEMEN OF PROFIT EROSION

Why these trading tactics are not successful in real life situations

In no particular sequence, however having a firm grasp of the costs involved is of the utmost importance·     

  • Exchange rate difference·

  • Gap-effects·  

  • Opacity that trails behind the stop-loss following·   

  • Exchange fees

These factors will not only reduce earnings in live trading, but they will also lead your backtesting findings to differ from actual trading. This difference will become more pronounced as the frequency and complexity of your model rises.

THE DISTRIBUTION

You will not have purchased at the price shown in the historical data since, by definition, you would have acquired it in a market order at a higher price than what is shown there. I believe it sums up what we mean when we talk about the market spread.

The difficulty is because historical data does not include the book for each second of each tick; instead, it has the opening price for each tick, and this price represents the midpoint of the spread at that specific instant in time.

The historical data includes the ‘ohlcv’ notation, which stands for opening price (at the beginning of the tick), high and low prices (during the course of the tick), closing price (at the conclusion of the tick), and volume. Everything that goes on within the tick is a mystery, with the exception of its high and low points. To put it another way, if there is an upward or downward gap inside the tick, it is possible that the previous data will not reflect it. This topic will be revisited in a little while.

When the above snapshot was taken, the ‘price’ for bitcoin was 22,497.68 (this is what would be in the historical data for a tick starting price), but the ask indicated in the spread was 22,489.91. This discrepancy is due to the fact that the spread shows the bid price first.

That amounts to a difference of around $9 (0.04% of the total). Of course, there are instances when the spread is narrower, and there are other occasions when it is wider. The important takeaway from this is that the spread does not appear in the historical data that is utilized in backtesting.

Bottom-line:

Backtesting will almost always result in an increased entrance price compared to the price of historical data, whereas backtesting will almost always result in a decreased exit price. Both are detrimental to earnings.

Is this a really significant issue? Over hundreds of positions, you can bet your bottom dollar that it is!

Yield -24.16 positions 744 days 123 average/day 6.05 profit% 0.370 avg loss -0.16 avg gain 0.18 Yield -24.16 positions 744 days 123 avg/day

The same lucrative backtest as before, but this time with an estimated 0.05% spread-effect degradation on the entry/exit price. Do you see the result?

Spread-effect: A real live-trading entrance or exit price for a position that we cannot adequately depict using past data and so have to guess instead.

When you combine the price erosion caused by the spread-effect with the majority of online techniques, your earnings will disappear, exactly as they did in this case.

Why isn’t the novel based on actual historical events? Because you would require the book’s data for every second inside each tick, this would amount to 60 times 3 times 10 times 2, which is 3,600 data points for each tick if the tick was for three minutes and the book had ten ask records and ten bid records.

Because we do not have access to historical book data, we have to make an estimate of the typical dispersion.

Why do we presume that there will be a market order? A market “maker” or “limit” order is far more complicated, and there is a greater chance that you will not be able to get the price you want or that your order will not be fulfilled. In the event that your model generates an entry or exit trigger, a market order will allow you to enter or exit the position, but a limit order could not. In addition, it is possible for your backtest code to be unable to determine whether or not a certain priced limit order would have been filled, once again as a result of the granularity of the data.

Limit orders contain considerable restrictions (no pun intended), and given the current state of the market, you cannot be confident of creating any particular position with absolute certainty. When you wish to get out of a position that has turned into a loss, this presents a particularly difficult challenge.

GAP-EFFECTS

What is a gap-down in the gap? Or gap-up? It is not necessary to elaborate.

Gap-effect: The price will then increase or decrease across a price gap that occurs in between ticks or inside a tick.

Why is it important to consider gap effects? In point of fact, they have a significant impact on the amount of money a model makes.

Scenario 1) In the event that you get an entry trigger and attempt to open a trade, but a gap-up occurs prior to the market order, the entry price will be greater than the open price.

Scenario 2) if you have an exit trigger and are looking to terminate a trade, but a gap-down occurs before the market order, the price at which you leave the position will be lower than the trigger price.

Scenario 3) You have a market stop-loss at a certain price level, and a gap-down leaps over your stop-loss, causing the exit price to be lower than it would have been otherwise.

Scenario 4) You have set your limit stop-loss at a certain price level, but a gap-down vaults above your limit price, which means the trade stays open. This “orphaned position” has the potential to rack up extremely high costs very fast.

Given the data that is currently available, none of the four situations can be readily represented in a backtest, which is one reason why the performance of your model will become worse over time regardless of whatever scenario you choose. In real trading, particularly during times of extreme volatility, Scenarios 3 and 4 are very challenging and may be seen rather often.

Gap-effects:Inside a tick are not reflected in the gap’s historical data, for instance: a 1-minute candles (left) might indicate a price gap, however a 3-minute overlap for the same data (right) does not show any gap at all.

The 1-minute tick data and a gap-down are shown on the left of the image above, however the identical data is displayed on the right of the image using 3-minute data, which conceals the gap. A backtest that worked off of data collected every three minutes would miss this gap, and as a result, none of the situations described above could be understood correctly.

Obviously, a backtest could look at the tick data at a lower level, but in many cases, the minute-by-minute data is the most granular data that is available, thus the impact remains.

Taken different manner: There is always a limit to the level of granularity that can be achieved with historical data, which may obscure the gap-effect.Gap effects aren’t taken into consideration in any of the trading method tutorials on YouTube. They all presume that your stop-loss order would be carried out at the price at which it was set! During times of severe market volatility, the spread effect might cause you to incur an average loss of 0.03% on a market order, and 20%-30% of all exits could result in a price gap that is lower than your stop-loss price.

Why do we presume that there will be a market order? Please refer to the previous section for an explanation.

OPAQUENESS THAT TRAILS BEHIND THE STOP-LOSS TRAILING

Once again, we are unable to conduct an accurate backtest of a strategy that uses a trailing stop-loss since the fine-grained data included inside each tick are not known to any greater accuracy than what is now available.

What is meant by the term “trailing stop loss”? The strategy of moving a stop-loss order higher when the price advances in the investor’s favor is a frequent one. It’s a specific kind of model complexity that causes backtesting results to differ from real-world trading.

This is a good technique, however there is no way to process it in a backtest since a shift of price within a tick might activate a trailing stop-loss without the past data telling us of it.

The motion shown in the figure above might, in fact, all take place inside the same tick for which we have collected historical data. The data for each tick labeled ‘ohlcv’ does not tell us whether or not a trailing stop-loss was formed or not.Let’s take a look at a real-world example using a five-minute tick:

Date     2021-11-01 23:57:00

o                  61022.36

h                  61152.56

l                   61020.14

c                  61123.54

v                  0.964251

Imagine for a moment that our model, when applied to real-time trading:

·     The trailing stop-loss was raised from 61050 to 61075 (using round values), and then…·     After moving it up one more to 61100, I then.

·     Was unable to complete the trade due to a gap-down dip to 61030.

Therefore, in spite of the trailing stop equipment, it actually reduced the amount of money made inside the tick.

When all it has to go on is the tick data given above, how could our backtest code possibly make sense of all this? It would have to dissect the data for each one-minute tick inside the framework of the five-minute tick, and even then, it’s feasible that all of this may have taken place within only one minute.

Within the context of past tick data, trailing stop-loss movements are often incomprehensible.

This is another another reason why your backtest is always going to provide different results than the data from your live rig. Why? Because the available historical data are very lacking.

There is always going to be a difference between the outcomes of backtesting and actual trading. There is no backtest that is 100% correct.

EXCHANGE FEES

The vast majority of exchanges either levy commission fees on market orders or deduct a “carry” fee from each transaction.

Read this article for more information on the order kinds and costs that are applicable on binance.us and coinmetro.

The recent announcement by binance.us that there would be no fees charged for btc/us* transactions is good news for anybody who trades these particular currency pairings; however, the exchange has the right to reinstate costs at any moment.

When you look at the tactics on YouTube and how they estimate their earnings, you’ll see that they almost never take into account exchange costs (or any other effect described here). When we take another look at the “trade pro” backtesting (which was done “by hand”), we see that the accounting does not include any exchange costs. This happens rather often. Neither do we see an accounting for gaps or spread.

He quickly arrived at the answer by multiplying 55 by 1.5 and deducting 45 by 1, which gave him 37.5.

How amazing?! It is presumed that not a single one of these transactions had any kind of profit erosion due to spread-effect, gap-down, or any other kind. It is functioning in a vacuum of sorts, in terms of the magical trade effects.

However, only the exchange fee (on binance.us) would cut earnings in this backtest by 100 times 0.15, which would equal 15% and be equivalent to almost half of the predicted profit.

In a nutshell, exchange costs will have a negative impact on earnings, which will already be reduced due to the other three consequences stated above. The vast majority of strategy videos and their accompanying backtesting do not take costs into consideration. That really is

MODEL PARAMETERIZATION

Every single trading model contains a set of parameters, as does every single indicator and rule. Parameters may be found everywhere. In the third and last part of this series, we will investigate how the combination of these parameters may very easily produce a strategy that is successful for a certain period of time, but how the same model and the same parameters would be unprofitable for another period.

We are going to investigate how machine learning not only makes it simple to engage in this activity, but also has the potential to amplify its illusionary consequences.

That’s a wrap for today, see ya tomorrow!

Reply

or to participate.