Optimize Trading Strategies Using Freqtrade Crypto Trading Bot
HTML-код
- Опубликовано: 3 апр 2021
- In this video, I run through how to install and setup Freqtrade Crypto Trading Bot using a basic 'Naive' strategy. I run though backtesting the strategy, optimizing the strategy, running the bot in a sandbox as well as viewing and controlling the bot via Telegram and the Freq Web App UI. NOTE That I do not endorse using this bot for real trading and I am not providing any financial or trading advice here. I am merely showing how you can use this tool to try out your own strategies should you wish.
Useful links:
Freqtrade Docs: www.freqtrade.io/en/stable/
DevBootstrap Github Repo: github.com/devbootstrap/optim...
RSI Indicator: www.investopedia.com/terms/r/...
Bollinger Band Indicator: www.investopedia.com/terms/b/...
Sharpe Ratio Loss Function: www.investopedia.com/terms/s/...
Contents:
This video is quite long, so if you want to jump to specific parts, below are the timestamps for each of the major sections covered:
00:06:59 Install Freqtrade via Docker
00:12:04 Config the Bot
00:16:47 Create a 'Naive' Strategy
00:25:15 Run in Sandbox mode
00:31:17 Download historical OHLCV datasets
00:34:09 Backtest the 'Naive' Strategy
00:40:11 Plot the results on a graph
00:46:42 Optimize the strategy using Hyperopt
01:04:35 Update the 'Naive' Strategy
01:17:15 Run the updated strategy in Sandbox mode
01:21:33 View the trades via the Freqtrade Web App
01:26:38 View the trades via a Telegram Bot
If you like this video please like and subscribe. I'll be producing more videos as soon as I can!
Feel free to donate and help me to buy a coffee or even a new MacBook pro! ;)
BTC: bc1q3fddwnufucdkpqz6fzj03xsskaqjxv8dag90x2
ETH: 0x67cC81389f44c0B980F93dc003300a31aD5dadA2
Many thanks everyone and I appreciate your support in any way! Наука
You are awesome, thank you so much ! I hope this channel grows exponentially, it is definitely a hidden gem
This is absolute GOLD... thank you ever so much for your hard work
Thanks for this tutorial. Was able to get freqtrade going in a docker on my Rpi in no time!
Your timing could not have been better. Exactly what I was looking for. I sent you some eth!
A phenomenal tutorial to a phenomenal tool. Thank you, this is great value.
Thank you so much!
Fantastic video and also serves quite well as an introduction to the bot from a novice perspective. I suggest that maybe you include that in the title as this video would have been very helpful when I first started looking into the bot
If that video was just one week earlier!
I spent the last week getting used to the codebase and documentation, after I lost hope in finding a youtube video that would help. Would be great to have a video on deploying the bot on the cloud! Thanks for the good work! :)
very helpful, i was looking for a explanation like this for days. thank you
Great tutorial! Whoever filmed this tutorial is a saint!
Great vid! One addition: In the config file @18:15 ROI is: between 0 to 30 minutes, if a profit target of 4% is hit then sell; then between 30 to 60 minutes if 2% profit is hit then sell; then anything after 60 minutes sell if 1% target is hit. Cheers!
thx for this tutorial, help a lot mate getting to run my own strategy independent and decentral
Great video and thank you for the clarity in explanations!
My pleasure!
BTW fantastic tutorial , I understood every step and you was very clear. I do not understand if I can run more strategies at the same time, probably not. I hope you will continue with your screencast , personally I'm very interested to Freqtrade Strategies (especially startegies which can follow the trend!) and Hyperopts and I hope you will do other video with these arguments. Thank you !
Well done on the tutorial. It's nice to see that in practice.
Thank you!
really thank you buddy! you saved me from paying a lot of money to get this done :D
Thanks you so much ! I was struggling to install it who helped me a lot !
Thanks for your efforts to create such a useful video...👍
Great tutorial! Thank you very much!
Great! Let's now implement the Elliott-wave strategy on this 😎
This is SUPER! Much appreciated.
MUCH better than some of the tutorials than I've seen from the more "popular" Freqtrade Channels. Please do moar. Thank you.
Thank you so much John!
Very nice, really very nice video. Thank you for spending your time to us
Thank you, explaining strategies, pro. all best
Awesome Video. Did a few online courses on Freqtrade and this video summed up most of it in less than 2 hours. Thanks for this definitely subscribing to this channel.
Great to hear!
Thank you a lot, that was very informative video. Thanks you for your sharing again.
This tutorial is amazing and I'm testing it right now.
Did you got goods results ?
Great Content, appreciate your time!
You help me a lot thx for your wonderful work!
Very clear and very usefull. Thank you very much
Great video thanks
Insane... this tutorial is priceless... I am totally new to freetrade, python, etc. I have basic programming though and this tutorial helps me a lot
32:30 - how to populate pair data for the last one month for backtesting purpose
Did you find the solution?
@@robin5845 nope... i did not continue my project
If I Can ask… You got good results?
@@PedroBrandesitsme i dropped my project and bought a ready made robot and focus on tweaking the bot to run based on my parameter
@@ursokind where did you buy your bot?
Excellent tutorial!!
simply awesome video!
Great video thanks!
Thanks for this tutorial!
wow awesome!! this video helped a lot.
thanks you. great intro!
This is awesome. Cheers
You are legendary !
awesome my friend.. thank you
great tutorial!
Great job!
In the interface version 3 of freqtrade, some of the syntax seems to have changed. The bb indicator written as in the video returns errors in the logs. Need to look into it some more but this great tutorial might deserve a 10 min video to highlight changes since version 2
great user guide!!😃 btw do u have sample strategy for future trade study?
Brilliant mate
Amazing tutorial!! Can you explain how this can be used for non crypto data?
As far as I understood, the data download uses the pairs whitelist from config.json and not the pairlist.json file to collect data.
Also, in the backtesting command, you do not have to specify where the data is. By default the command will take downloaded data from the corresponding exchange folder inside 'data'.
You only need to use --datadir PATH if you want to use a specific set of data, saved elsewhere.
thanks! This comment helped a lot!
That is amazing. Thank you so much. Also can you make a follow up video on deploying freqtrade to some online server such as Heroku or something else :D
Thank you !
Seems really intriguing. Question. How would I make my bot leverage trade?
This is fantastic, thank you! Could it be configured to trade futures? So sending long/short signals instead of buy/sell?
Probably, but I've not tried that yet.
I have the same problem here. There was an update to Freqtrade and it no longer allows you to do the step-by-step described. Hopefully you can update the page or RUclips video. Thank you!!
Hi Amazing video, thanks for you motivation so teach this. Please can you share the code of the strategy and the hyperopt ? please, thanks!!!
congratulations on the channel and video, I wanted your contact because I am wanting to set up a grid robot that will act according to RSI would have and have the function of dragging upwards?
Thanks a lot for this amazing job you've done !
I'm planning to install and run my bot on a Raspberry Pi 3, would you recommend this ?
Thanks again !
Have you tried it? Looking at using a raspberry Pi zero I have
At 30:36 how do you open that second command prompt in "workspace"? Sorry if this is a noob question. I know how to open a second terminal obviously but how did you get to "workspace"?
Life saviour
My hero
Is it possible to enter with open price as backtesting doing? Because for me it's enter on next candle with the same enter price as it was triggered.
Great Video DevBootStrap. Do you mind doing another video showing how to optimize without creating a hyperopt class file, and then backtest it. I'm using the latest freqtrade with the strategy class and hyperopt in the same file-strategy file. Getting all zeros when backtest. Thanks
Yes, as a matter of fact, I just posted that video today! Here is the link: ruclips.net/video/lpazvgFezLY/видео.html
@@Reanblock Thanks a lot. Just seeing this message now, and i've watched the video. Great, looking forward to implementing the changes.
hi, what is tradeable balance ration and how you start and close this bot and enter to its terminal again...
Which application did you use to run the commands? Is it equivalent to Windows PowerShell?
Thanks so much for this. Which editor did you use?
visual studio code
@@neveragny Thanks!
Awesome tutorial! I wonder if you still get profits with using this bot in this bear market. And can you recommend any good strategy for this bot? Many thanks!
thank god youtube has the option to change the speed... nontheless it had some helpful parts
just an observation, if you've put your telegram token and chat id and it still doesn't work, it might be because you're using a new bot you just created. In this case you have to actually click on the bot name in the last message from botfather in order to open a chat with your bot and click on /start. Once the bot is initiated, if the token & id are valid, it should work.
Thanks a lot for this vid, I was wondering how do I run in the live account ?
Just use live API keys for your trading account that holds real crypto.
@@Reanblock 1 more question, this bot is trading in spot market right, how do I make it trade in futures? I didn't find any good solutions on net, I did change the ccxt config in config.json but it's seems to trade in spot!
And, umm is there any way to implement super trend indicator crossover technique in the strategy?
Professor. For buy signals you used RSI>25. That makes no sense though. It ought to be
Awesome
hello
i have been following your tutorial but i am stuck in the new hyperopt segment as it doesn't matches with this older freqtrade ..
can you please upload a new video as to how to use hyperopt in new freqtrade using this bbrsi
Awesome tutorial, been working on my own trading bot, freqtrade seems much more powerful.
One question: Is it possible to implement multi-timeframe strategies with it?
Thanks a lot!
So far I have only ever run Freqtrade with one strategy at a time and each strategy has one timeframe setting. I've also been considering this and will dig into the options soon.
I think you can add a method to convert the class strategy timeframe to the desired time frame of the second strategy and run those two strategies in the same class
can we run it with Mac M1 and Anaconda installation? I get some errors when I try to follow the steps
What do i do with new version of freqtrade if i want to use your method for BBRSI ?.... some commands for hyperopt isn't working anymore :(
Hello Sir, very good material, thank you. Isnt the stoploss -28% to risky? If I modified stoploss to -10% will I get less profit?
A lower stop loss will cut your losses sooner yes.
As far as I understand, the hyperopt uses a machine learning model in order to adjust the parameters of the strategy, however, those values could become incorrect with the time. I mean, we need to adjust those values after some time. Do you recommend to run the hyperopt all days, one a week?? how often is it recommended to run the hyperopt?
It really depends on what you are trying to do. I would check a machine learning course to learn more about handling data.
谢谢
thanks for the video. whats the file manager / text editor you're using?
found it. i think its "Sublime Text". :)
@@JonsRegularStuff It's vscode
@@slstudio2591 thanks
thank you so much for the video. could you help for installing on windows?
For windows, you just need to install Docker runtime and then everything else follows pretty much the same approach. There might be differences with setting up the terminal alias and so on, but since Freqtrade runs in a Docker container you should be good.
@@Reanblock thank you so much.
can you help me? when where a hyperopt they say it is a newer version so your method dont work anymore. can you help me fix it
@ 40:10 This is what would have happend IF the sells / buys did not timeout due to not selling or buying the order!
Backtesting and running in real trading are mode are will not have the same results.
Could you do a seperate in-depth video on how to code hyperopt?
That is a great idea. I intend to dive deeper into hyperopt and I think that would be a very useful screencast to produce.
Question: Shouldn't a good trading bot perform better than "market change" itself? In all my back-tests my bot performs very well but most of the time the market outperformed my bot's ROI (also in this video btw). Do you guys have solid strategies that perform better than "market change"?
Theoretically, if buy and sell signals based on bollinger bands, rsi, macd, etc. are used effectively, the bot should be much better than market change or am I wrong?
In this video for instance 1:16:06 total profit is 22,3% and market change is 29,98%
Market Change is the change of the market during the backtest period which is calculated as average of all pairs changes from the first to the last candle using the "close" column. Perhaps try out the free strategies available at Freqtrade here (or develop your own) to see how that goes and if it produces better results github.com/freqtrade/freqtrade-strategies.
@@Reanblock I was wondering the same thing. If I understood Theo S correctly, we both think that if the bot performance is lower than the market change, actually a simple and dumb buy and hold would have been more effective. Or is there something I am not seeing?
thank you very much for your kindness. but Since 2021.4 release you no longer have to write a separate hyperopt class, but can configure the parameters directly in the strategy. so we cant use optimize the strategy using Hyperopt in your video with bolinger band. any solution?
Ok, thanks for your insights into the updates. I'll look into it.
@@Reanblock I also have a new merge files (hyperopt and strategy) using RSI and BB band like yours. Thanks a lot.
Got the same problem and would be very happy if there is any solution, since I couldn't find anything useful in internet, regarding that
The bitcoin is kind of leading everything. Could you show me (us) how a strategy should look like when monitoring bitcoin for up or down trends on other cryptos?
compare BTC/USDT to BTC/YOURALTCOIN Chart
@@BennoExno easier said than done... How do you automate this...
@@iamkian look at the Charts, use google to further know more about altcoin rally setups and then make your own decisions
@@BennoExno The point is that Fregtrade is to automate this and take away emotions. If I look at it myself, and decide myself, the emotions (my own decisions) are back again.
@@iamkian First you need to learn how to Trade and then you can setup your own Bot. If you are noob at Trading how do you want to setup a Bot? You can buy a bot that is already setup. But I dont know what you expect, mate. Somebody coming to you and helping you to make money for free?
Thank you very much really nice video. I have a question. Do u know how to open the freqtrade ui when i run freqtrade on a vps? So how can I open vps localhost in the browser. Is there a way?
Yes that is possible since you can run any kind of software on a VPS server you can also run Freqtrade UI and configure a domain to point to that server to open up Freqtrade UI. I am running Freqtrade in AWS using Docker Compose and I am using an Nginx container as a web server. I'll make a new tutorial on how I set that up in the coming weeks,
@@Reanblock i see thank you, i hoped there would be any easier way maybe haha. I have now also get the idea to try to connect via remote desktop on my ubuntu vps. That will probably work too but dont know if that is easier than running a webserver on the vps. (Webserver has of course more benefits at the end) thanks for ur answer and cant wait for your next video.
Hello and thanks for a grate video.
Can someone tell me why no one of my tries get any bey or sell signals, by using trade in dry-run or live mode?
Thanks in advance!
Maybe because there are no buy or sell signals during the testing period for the strategy you are using?
Can freqtrade developers access the strategy that we create.
It's awesome video but I always taking error in creating Hyoperopt.
Parse error at offset 23: The document root must not be followed by other values.
How can I fix this?
It should work out of the box if nothing is changed. Try checking the Freqtrade docs.
How does one edit the strategies?
Does the bot continue to run when the mac goes into standby mode, or does it terminate the process?
It would terminate (if you close the laptop that is). If you just lock your screen then it will keep running . To be sure, you should run on a server like AWS so its on 24 / 7.
Quest: I ran the hyperopt a couple of times and it gave me several different best results coming with different sets of params. How can I come up with an optimized strategy in this case? Thanks.
You should try the Hyperopt tool of Freqtrade which I touch on towards the end of the video.
Thanks! And also I have an issue about the timestamp.
When I tried to load up the bot with API connection, I got the below msg related to Binance:
{"code":-1021,"msg":"Timestamp for this request is outside of the recvWindow."}
I saw people figure it out but they are using php.
What is the issue and how do we solve it in Visual Studio?
Thanks and greatly appreciated.
@@kelvinkong7783 I would check that you are using the correct timestamp format which needs to be a UNIX timestamp in seconds or milliseconds. Binance expects the timestamp in seconds, I believe.
Hi DevBootstrap, I've tried many different things and doesn't work:
1. I changed my system time to be UTC
2. making sure my wsl and my system is sync on the date and time
3. make sure my internet time sync to time.window.com
4. Go to Regirtry Editior, get into the NTP server and change the value to 1; then get into W32Time\config and change the AnnounceFlags's value to 5
5. In Vstudio, go to my config.json, add a line of "options" after "ccxt_config", like this:
"ccxt_config": {"enableRateLimit": true},
"options": {"adjustForTimeDifference": true},
6. recreate new API key and secret
But all the above doesn't work. I still got the same msg as below:
freqtrade.exceptions.TemporaryError: Could not get balance due to InvalidNonce. Message: binance {"code":-1021,"msg":"Timestamp for this request is outside of the recvWindow."}
It seems some people figure it out with ntpd in Ubuntu. But I am using window 10, Vstudio, powershell and docker (exactly like what you are using in the video).
I'ver been trying for many hours and frustrated. Is it okay that I personally send you email and ask for a step-by step guideline to solve the issue? Will come with reward for sure. Thanks!
@@kelvinkong7783 Thank you for your question and apologies for not responding sooner! Firstly, in the video I am using a MacBook and Visual Studio Code Version: 1.56.2. Also, it appears that the Freqtrade Docker container should be running using UTC time by default. The running container should get its time from the host machine and then use UTC accordingly. So given that, I would not recommend changing your system time to UTC but leave that in your current local timezone. Regarding Windows specific settings, I cannot comment as I do not use Windows at all I am afraid.
do the backtesting can consider also the commissions ?
I don't think backtesting includes transaction fees.
How the F do you make plot work? = 40:57
I have only been waiting years for that solution. Thanks!
It's explained in the video, I think. Should also be in the shared repo. There is a dependency required here. Give us a shout if you can't solve it!
When optimizing using hyper opt, does it put into account the fees on the platform e.g. binance?
The Hyperopt tool itself does not consider the trading fees. However, your strategy should. By the way, I just published a new screencast on the Freqtrade Hyperopt tool: ruclips.net/video/lpazvgFezLY/видео.html
@@Reanblock Thanks.
@@Reanblock Thanks.
I am having a problem in vs code when i open remote container anyone can help me Plz? I really need to made a bot
but can you use this bot for real trading or is it just for backtesting?
Yes, Freqtrade can be used for real / live trading.
Hello,wery good video,but please tell me for command DCR,i have not this command.Thank you
you can use docker and make in terminal alias dcr='docker-compose run'
What is "dcr" exactly (32:00) on my mac it says command not found. And where is the pairs file linked. I have tried running the command with docker-compose run instead of "dcr" but id doesn't download anything. It says "about to download pairs []". Thee brackets are empty. Does anyone have an idea?
dcr is docker-compose run, you need to create pairs.json first 31:38
Question:
I wrote the new strategy and backtest it with 13 pairs.
After that, I backtest with one pair which pair still in the list of 13 pairs.
But the number of trade when I backtest in 13 pairs is less than I backtest 1 pair.
For ex: BTC/USDT when backtest 13 pairs at the same time. The number of trade is 13
BTC/USDT when backtest only BTC/USDT. The number of trade almost 20
Can you help me please?
Its likely because when you change the number of pairs that you use for backtesting they number of actual trades may differ due to the available balance for trading will be different.
@@Reanblock I already change the "max_open_trades" = -1 and "stake amount" = 300,
But when I test for 13 pairs, the actual trades always less than I test only 1 pair.
For ex. ALICE/USDT when test 13 pairs, trade 9 times. When test only ALICE/USDT, trade 16 times. Please help me
I'm already your sub mate. Do you understand smth about Enecuum? The main goal is to make trades and pay for the goods and products fast, secure and without banking fees. Could you observe them pls??
I've taken a look at Enecuum. Thank you for sharing!