This is the follow-up to my previous post about Traderino, a bot that trades cryptocurrency futures on Binance and reports his action on Telegram. Jump to the previous article if you want to know more, or keep reading to see what happened during his first week of simulated trading.
Timing has been far from perfect for Traderino’s public launch and first week of trading. He started his adventure right after the great Bitcoin crash, in times of high volatility and high uncertainty.
But whatever doesn’t kill you only makes you stronger, and now Traderino is ready to enter the arena again with newly acquired skills. However, before looking at what’s new, let’s stop and analyze what data we have collected and what we can learn from it.
Analyzing Traderino’s performance
Let’s look at the closed positions recap:
He made 613 trades with an average of 2.6 trades per hour. As you can clearly see, most of the trades were losing, although he opened mostly SHORT trades.
As I already mentioned, market conditions were not ideal for a Supertrend-based strategy, however there has to be a way to at least minimize losses or improve performance overall in these kind of scenarios.
By looking the actual trades, one of the first thing I realized is that Traderino would hit a stoploss and then open the same trade again. This happens if the signal to enter the trade is still valid after you hit a stoploss, which can be the case very often especially on longer timeframes, where it takes more time for the current candle to close and invalidate the signal.
I’ve observed the history of trades for pairs like XRPUSDT and seen this behaviour in action, which cause great losses. I’ve now introduced a proper cooldown period, which depends on the current timeframe, that prevents Traderino from opening the same trade if it has been closed as a loss.
In some situations, we might miss some positive trades due to this rule, but I think, overall, the money it will save it’s going to be way more than what it could potentially make.
Adaptive Supertrend threshold
One of the problems with the Supertrend indicator (and all indicators for that matter) is that we can’t use its values as an absolute truth. Specifically, there are multiple instances where the price pierces the Supertrend line before bouncing or, conversely, bounces a few percentage points off, before even touching it. I was supposed to put some screenshots here but I’m too lazy for that, so you’ll need to observe this phenomenon by looking at the charts yourself.
For this reason, even if the Supertrend gives us a precise price level, it would be better to think of it like an area, where the line is kind of a middle point:
The most obvious thing to do would then be to enter at a fixed distance from the Supertrend line, say 2%. The problem with this is that, yes, you will get more trades (those who bounce before touching the actual line), but you’ll hit more stoplosses as well (those who pierce the line before bouncing) cause you entered too early.
Up until now, Traderino was entering positions at a very short distance from the supertrend, like < 0.2%, but slightly different across timeframes.
Since we cannot set a fixed threshold distance for the problem we just discussed, the only reasonable alternative is to make this threshold vary based on something else that can tell us whether we should adjust our threshold.
I decided to use Bitcoin volatility as an indicator. The reasoning being that if Bitcoin has high volatility to the downside, Traderino should be more inclined to take short positions, so if there is a short signal the threshold can be “relaxed” and instead of 0.2% maybe set to 2% or even 5%. The same applies in the other direction.
Without going into too much math about how exactly the threshold is set, let’s just say that it is computed from an average of Bitcoin volatility values over the last 3 hours. This value can then be used as our threshold distance to the Supertrend line.
This change makes the system way more dynamic because it adjust according the the Bitcoin price. In fact, it changes the behaviour of Traderino completely, as it takes a lot of different trades compared to the previous version.
There’s a parameter that allows us to control how much it will follow the Bitcoin movements: if the parameter is zero, then it will behave normally (the threshold distance will not be relaxed), conversely, the greater its value is and the more the bot will relax threshold and open trades. This will need to be tuned after observing how it goes.
That was the biggest change for this “release”, although I’ve also made several minor improvements and bug fixes, which should not impact trading too much.
The most important thing is the integration with Binance API, almost fully completed, in order to make the bot able to trade with real money when the time comes.
That’s all for now, see you next time and if you didn’t already join the Telegram channel!