Generate Insane Trading Returns with ChatGPT and TradingView

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
hello everyone today we're going to take a thousand dollars and turn it into over more than one million by using open ai's chat GPT to develop a Bitcoin trading strategy for us there's only one problem is that I didn't prepare for this video but then again why would I I can just pass chat GPT to create an outline or an introduction for me let's see how it did hi there and Welcome to our tutorial on using chat GPT to develop trading strategies in this video I'll be showing you how to use chat gbt a powerful language model developed by open AI to create custom trading algorithms without any programming experience whether you're a seasoned Trader looking to automate your trading strategy or complete beginner looking to learn about trading this video is for you so sit backs and and relax and get started with chat GPT so pretty darn good right so essentially we can use natural language or simply ask the computer something it can then take that something and translate it into computer code and give us an answer back now in regards to trading we can have non-traders ask hey give me a momentum strategy using these parameters and it'll do it for us and you can actually use tools like training view which already has the data and everything built in to test it for this channel typically I'm building databases by doing python all this other stuff and sometimes that's not very accessible to many Traders but this really opens up the door for anyone who wants to be able to create a profitable trading strategy based on back test and in this video I'm going to teach you exactly how to do that so that way you have confidence when going into your future trades now the first thing that we're going to want to do is go over to tradingview.com tradingview.com is the world's most popular online trading platform you can chart pretty much the price of anything but there's also Community tabs there's news feeds there's also custom indicators and even mobile phone alerts but for our intents and purposes we are going to be using the strategy tester and coding in Pine script so you want to go down here and click on the pine editor here you may see a blank strategy if you don't just go to open and then click create new strategy and here will be the boilerplate code but again don't worry we're not really going to be doing the coding chat GPT we'll be doing that coding for us so let's head back over to chat GPT and create our first trading strategy now the biggest challenge any new user of chat GPT or any other NLP model is going to face when creating a trading system is articulating exactly what they want if you want a 50-day simple moving average you have to tell chat GPT that it cannot read your mind if you want chat gbt to give you a trading strategy using a crossover of the 12 and 26 EMAs well fantastic but you have to be explicit about it in our case we want to start off as simple as possible so I'm going to tell chat GPT exactly that right give me an extremely simple long-only trading strategy that uses the 50 SMA in Pine script V5 and now the great thing about chat GPT is it'll actually explain what it's doing and then provide you the code sometimes the explanations at the top sometimes at the bottom and usually it's well commented so we're going to copy this code and then we're going to take it into trading View and run it now all we need to do to get this code to compile is paste it into the pine editor and click save if you don't have your Pine editor open you'll want to click the pine editor down at the bottom of your screen here and then if you don't see any code here click open and create new strategy and this is the boilerplate strategy now we can go ahead and paste all of our code from chat EPT here click save and unfortunately we'll just call this a chat GPT Bitcoin strategy it doesn't work it says try to add this or that so let's undo this I know it doesn't have this strategy code here which we we need for it to run so I'm going to paste the code under here and then click save and we're going to start seeing more errors because we're not using ta now you're going to say wow I thought that chatgpt was going to be the new thing and now I have to like figure out how to code I have to troubleshoot all this well no you don't there's actually a better way to do this now it's essential to understand that chat GPT is good at creating code or content from scratch but it's much much better at taking existing content such as you know natural language or code and improving upon it we use chat EBT to kind of research an idea of what we want and then we can go to the public library of strategies provided by training View and iterate or approve upon it so you can see here I can click on this bar up down strategy and you know it looks like it's losing some money but you know maybe this is something that we're interested in we can go up here click the brackets here for the source code take this copy it go back to chat GPT say please explain this Pine script through me and it will actually tell you what it does so if you have a question on how a strategy works because you don't understand the code yet you can use chat GPT and one crazy thing that happens is after you do this for a while you'll actually be able to read this code now I don't want to use this bar up down strategy let's take a look at some other strategies here's some Bollinger band strategy so I'm going to look for a few or strategy that actually performs well you know you know that's a almost one percent stochastic super Trend okay so it looks like we got a winner the super trend is up 478 percent so we'll start with the super Trend indicator to see if we can get it to over a million so we'll click on indicators go to super Trend and here we have it and now we can go ahead and grab this code I'll say I'm just hitting Ctrl a and Ctrl C or you can select the whole thing cut copy and I'm going to go to open strategy I'm going to then paste this save it and I'm going to call it super trend Bitcoin strategy and click save we need to get an understanding of the super Trend strategies return profile when trading Bitcoin we know that when we went to the indicator library and selected strategies that it was one of the best performing strategies if not the best performing strategy available to us but without actually looking at the returns we don't know how to optimize it we can do that by going to strategy tester we can see an overview here where we can see a pretty nice Equity curve a pretty large drawdown you know we've got 52 average bars in a trade with 79 total closed trades and 44 be profitable if we go to Performance summary we can see a glaring issue that we can potentially fix I'll zoom in to make it a little easier to see but basically we're making a lot of money on the long side and losing a lot of money on the short side now not only are we losing this money but it's not available to us on the long side to compound so what we'll do is we'll change this strategy from a long short strategy to a long only we can do that by going to the Pine editor selecting all of this Ctrl a and control C or you know selecting all of it and clicking copy and then what we're going to do is we're going to go to chat GPT and ask it to close the position whenever the super Trend strategy changes Direction instead of shorting so let's reiterate that to chat GPT we'll say update the following hindscript to close long entries instead of going short then I'll paste the code and henceforth I'm going to just show you what I type into chat GPT and then I'll fast forward to the output so I'm not wasting your time we'll take the code we'll copy it and then we'll paste it back into trading View Press Ctrl a in the pine editor then Ctrl V to paste it we see that our code is updated we then press save to try to compile it we don't see any errors which is fantastic which means we think that chat GPT successfully changed our code simply by us giving it Direction now let's validate that these strategy results are improved we should see that there are no losses on the short side or even no trades on the short side we go to the strategy tester we then can look and see that our strategy did change we now have a 55 percent win percentage and underperformance summary we don't see any short losses now I promised you that we're going to take a strategy from 1 000 to well over 1 million so now what we're going to do do is update the initial Capital to see how far away from that Target we are but we're not going to use chat GPT for this because I don't want to do you a giant disservice recall earlier that I said the most challenging thing a new Trader will encounter when trying to create a trading strategy with an NLP model like chat GPT is articulating exactly what they want and if you're not able to at least get the information out of pinescript that you need you're not going to be able to design the trading system that you want but don't worry all you need are two fingers right it's not difficult you can see these blue keywords remember we're taking existing strategies and indicators out of the library pasting what we want or asking Chachi PT to modify them and then what we can do is find these blue keywords we just press control and click and we'll pull up the pine script reference manual and then you can see all of these various properties and scroll down and get the information that you need so what we need to do is we need to set that initial capital and we also need to be able to set up Margin calls because we can't just leverage without any margin calls and understand how much Equity that we're going to use now I already understand this information so I'm not going to waste your time here but we'll just run through one because I want you to get comfortable with this so we'll go and look at the margin long property here it is and it says margin long is a percentage of the purchase price of a security that must be covered by cash or collateral for long positions must be a non-negative number right that makes sense and it's used to simulate margin calls and explained in The Help Center so you can click on that if you want more information but let's go ahead and now set the initial Capital the Margin Call and the amount of capital used so take initial Capital I'll copy this and this is getting pretty long so I'm going to press comma hit enter tab space paste the initial Capital we want a thousand we also want the default quantity value to be a hundred and then we also want margin long now obviously we've got some exchanges that offer 1 to 100 leverage we'll just do one to ten and then what we'll do is we'll save this and we'll see how this adjusted our strategy we'll open the strategy tester and we'll see that overview looks like we've already taken a thousand dollars in capital to over 2.3 million so if we met our goal I don't want to stop here I don't know about you there's a lot more that I want to talk about so we'll change the 1000 to 1 million dollar trading strategy to the 1 000 to 10 million dollar Bitcoin trading strategy now how can we improve upon this strategy well if I look here when we're looking at this Equity curve it's going up and then we start to see some downward movement here if I click on this we can see here that Bitcoin I'm going to zoom out a little bit we can see that we're in a pretty good uptrend and it looks like we're you know we're also losing money on this this downtrend here so there's two things that I want to resolve the first is we want to not be in Bitcoin when it's over extended and secondly when the trend is down we want to exit right so let's go ahead and use chat sheet PT our friendly research assistant to figure out how we might be able to do that now it seems like chat gbt is experiencing some exceptionally high demand let's hope it gives us the answer we're looking for anyways we will ask for quick answers and we'll say give me a list without descriptions of technical indicators that are excellent or identifying over extended prices hopefully it'll give us a few all right so RSI stochastic oscillator Williams Bollinger Bands perfect we'll use the RSI and our strategy to identify overextended prices so what I'll do is I'm going to go up here and edit this and say give me a list without descriptions of technical indicators that are excellent for identifying when a market is trending and click save and submit and we'll see what happens moving average RSI Bollinger Bands macd parabolic SAR Fibonacci retracement all of these okay we've got the adx so what we'll do is we'll use the RSI to identify over extended prices and we'll also use the adx to determine whether or not we're ranging or trending and fit that into our strategy to see if we can get up to that or maybe even surpass that 10 million dollar mark we'll start by adding the RSI and potentially get us out of overextended Trades we see that the RSI is already charted up here and we can be absolute maniacs and click on the source code here copy all this and paste it into our Pine script or ask Chachi BT to massage this code into our existing strategy but that is way way way too difficult there's a much better method let's open up our previous strategy we'll click open you can use either the recently used or go to my script here I see the super Trend Bitcoin strategy I'm going to click on that and remember I said you can access everything that you need to access by control clicking on any keyword which is highlighted in blue essentially it'll pull up the pine script reference manual if for some reason you don't want to access it that way you can always click this triple Dots here and click the pine script reference pop-up now I want to know about the RSI so I'll just type in RSI we see it as the first result which is already being displayed and it tells you everything that you need to know about the RSI if you have questions you can literally copy and paste this in the chat GPT and explain it to you I'm going to copy this code right here we'll use the close as the source and the length you know we'll use probably a little bit longer because I want to try to capture you know make sure that there's room to run so what we'll do now is we'll scroll down to where we enter now we could ask Chachi PT to do this for us but it is having some bandwidth issues at the moment and you really should get into the habit of being able to read basic Pine script we'll say and right so it has to have this direction change and I'll paste this to TA dot RSI close price and the is the value we're going to calculate this off to close and we'll say you know what 21 is less than 66. so we're saying that you know we don't want to be overbought on a longer term time frame but you know what I also want to make sure that we're getting in to the trade whenever there's a very high RSI on the shorter time frame which will essentially sort of mimic a breakout and some serious buying pressure we'll say close 3 is greater than 80. now what I'm going to do is I'm going to save this then we'll check the results and we'll see if this solved the issue with getting into and you know getting out of I should say overextended trades and then we'll see how we can prove this strategy likely using the adx to determine you know that downtrend and getting out of that so I'm going to save now and check out the results so go to the strategy tester we see our overview and it looks like we've made some progress but I'm starting to get a little nervous right so we're at three million in profits we're not at 10 million plus yet I don't know if I'm going to be able to get get us there but I'm going to try my hardest we can see that the equity curve is you know fantastic and then all of a sudden we have this drop off so click on this again just to analyze it one more time you know it looks like uh you know this downtrend is really eating us up and also this sideways action right so we'll use RSI to try to negate some of this downward pressure and then also use the adx to make sure that we're trending and not uh you know getting chopped up so the way we'll do that is we'll go back to the Pine editor and now the 80 well let's first start off with the RSI that's easy to do what we'll do is we'll just add a longer RSI duration and say that we have to be above you know 49 meaning that there's some buying pressure and we're not constantly having lots of cell pressure so we'll say ta oops and ta dot RSI use the close price we'll say close we'll say 28 you know four weeks is greater than 49 and then what we'll also do is we're going to actually we'll save that you know we'll save that now and we'll check out our results and see what happens here to see if we get rid of some of that downward action and then we'll handle the chop click on the strategy tester and oh man we're so close we went from you know three million and change to 5.3 we're now at a two-thirds win percentage and we've still got a little bit of room for improvement hopefully that'll get us over that 10 million dollar Mark we can go to the Pine editor uh click on control click on any one of these keywords so we can use input if we want and you'll notice it just pulls up input so whatever we're control clicking on it'll pull up and then we're going to type in adx and you'll notice that unlike the RSI we don't see it so what we'll do is we'll go to the indicators metrics and strategy to click on this go to technicals and then we'll search for the adx and you'll see here when we click on average directional index adx it'll come up on our charts we can click on the source code and now what we'll do is we'll copy all of this we don't need indicator we'll just copy this you only need one indicator or strategy and then we'll go back to our original strategy which is the super Trend Bitcoin indicator I'm going to paste it you can paste it pretty much anywhere above you know where we're going to use it here I'm going to paste it in here I don't want to plot it we can ask chat GPT and maybe we will after this if we don't get it the whole way what exactly this code is doing but I know that the Sig is the signal and you know we want it to be relatively trending so we'll say and Sig is greater than 30. and hit save and we'll see if we get it there come on baby oh no we went from millions and millions to 62 000 yeah uh I guess what are we gonna do now all right well I think obviously that adx really messed us up but maybe we should ask Chachi PT how we can make it better right so we'll say chat GPT how can we make the adx more responsive right so clearly it took us out of too many trades now I know that you know and you can ask Chachi PT this come on I know that you're you're you're getting hit with all sorts of requests but this is really important uh give us an answer I know that uh the adx strong trend is above 30 and a weak Trend typically is above 20. so we'll make it more lenient and we'll also do what Chachi BT tells us to we'll shorten the period uh and uh you know make it more responsive and hopefully hopefully that'll get us there so we'll go to the Pine editor we'll go first down to to the signal here will make it 20 to give us you know to get us into more trades and then we'll change this input length how about we just cut it in half and I'll click save and cross our fingers because there's not much more left in this YouTube video come on come on oh we're 6.5 million we're so close all right one one final thing we'll see uh we'll see what happens here let's change this you know percent that we're betting to 120. we'll hit save and I think this is it guys let's see if that last ditch effort worked and yes it did we're in 17.4 million dollars not only did we beat our initial goal of taking 1 000 to over a million dollars we then had a stretch goal of taking a thousand over to 10 million dollars let me crushed that it's 17.4 million dollars this is a fantastic video in what's called over optimization and you can use chat GPT to look that up if you have if you're not sure what that means but this video is about two Super Key takeaways first Chachi PT is here to stay you need to use these tools otherwise you're going to fall behind you can be a no programmer or a novice programmer and actually back test strategies now you don't have to just listen to someone on Twitter and hope and pray that that works right that's what my blog is about analyzing Alpha is about finding these amazing Traders and investors that are somehow kicking the crap out of the markets and determining how they actually did that and now you are empowered to be able to do this yourself so this is fantastic and secondly for experienced Traders it's amazing you have all of this wealth of knowledge at your fingertips so hopefully this video was worthwhile to you I think it was a 17.472 million dollar knowledge bomb everyone should be using chat GPT in some way and both in their personal lives in their trading and I hope to see you in the next one thanks goodbye
Info
Channel: Analyzing Alpha
Views: 593,843
Rating: undefined out of 5
Keywords: trading, investing, data science
Id: ekz6ugJE1h0
Channel Id: undefined
Length: 22min 52sec (1372 seconds)
Published: Sat Jan 21 2023
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.