Automated Trading Bot

in #bot4 years ago

cadef400-151f-11ea-91a1-7e0f83e7b2cf.jpg

I have always think if there was a way to slightly beat the market using an automated strategy. At some point I was attracted by cryptocurrency and became a trader. With my coding knowledge I wanted to develop a smooth and confident trading strategy.
I will try to reflect in this post how my strategy has been going and the process i took in order to verify and improve the strategy.

First of all, i have been using an open-source library on python called Freqtrade: https://www.freqtrade.io/
This library facilitates the way you can make a trading algo and the way you can test and improve (and i ll take some time explaning how this works) your strategy.

About Freqtrade and its powerful modules.

  • Backtesting
    Backtesting means how you can test or verify how your strategy behaves using the previous market data. This just simply means if your strategy is profitable or not (including trading fees) on a previous bull/bear market. In a bull market, strategies normally tend to be less profitable as hodling might become a better idea when the market is going moon. However, trading strategies must work when a bear market comes. Ill be showing you some screenshot about a trading algo i improved and tested.

  • Hyperopt
    Hyperopt means how you can find the optimal value using the previous market data using a pre-defined hyperopt-loss function. A hyperopt-loss function is a function that tells the optimizer how he should behave.

    There are several functions among these:

  • ShortTradeDurHyperOptLoss (default legacy Freqtrade hyperoptimization loss function) - Mostly for short trade duration and avoiding losses.

  • OnlyProfitHyperOptLoss (which takes only amount of profit into consideration)

  • SharpeHyperOptLoss (optimizes Sharpe Ratio calculated on trade returns relative to standard deviation)

  • SharpeHyperOptLossDaily (optimizes Sharpe Ratio calculated on daily trade returns relative to standard deviation)

  • SortinoHyperOptLoss (optimizes Sortino Ratio calculated on trade returns relative to downside standard deviation)

  • SortinoHyperOptLossDaily (optimizes Sortino Ratio calculated on daily trade returns relative to downside standard deviation)

    Hyperopt can make your strategy a drastic change from being very unprofitable to highly profitable. I am not lying when i say that a very very bad strategy using the proper hyperopt function can make your strategy a very profitable and good one in long term. Howver, hyperopt is costly. Normally, when using many trading pairs and high volume pairs, the strategy gets better but that just means the hyperopt module will take a lot of time to finish in a good pc. FYI, i have a 12 core pc and using a hyperopt function with only 6 months of data, using protections (to avoid potential loses when the full market crashes), about 60 trading pairs, it takes around 3-4 h to completly finish (using around 200-400 epochs in order to find optimal values in the hyperspace)

To end this post, i would like to share with you some of my backtested data using a strategy with 1 m timeframe on Binance. It simply tracks prices and target for potential scalping entries.

This two screenshot show only a 2 months time period using a lot of trading pairs for backtesting:

c380a15f6efd5dbcd75aa3e8b25f7221.png

dc30d37ea12841e3c024e3deae75b51b.png

Thanks for reading.

Sort:  

Hello! This is @riverflows from OCD team. We saw that you already posted your first post here in Hive! Congratulations and welcome!

If you have questions, you can hop into <a href="https://discord.gg/jefzunnG%22%3EOCD%27s Discord server and we'll gladly answer your questions.