in this video I'm going to teach you how to use chat GPT to make your own trading bot based on your own rules we are going to do this step by step it's going to take forever but I'm going to show you how I talk to this AI what rules I have and then hopefully create something that relatively Works welcome back to the channel everybody my name is Artie and this is the moving average a show where we discuss everything day trading to keep you profitable I'm hoping this video is going to be short but it might be long let's just get right into it now what you want to do is have three windows open you want your metatrader account open you want a browser window open with chat gbt and once you open up your metatrader platform you want to click on tools and go to meta quotes language editor that will open up this window right here first thing you're going to want to do is click new select expert advisor click next rename your advisor to whatever you want select on chart events next on tester finish and it will give you this generic script within here I want you to right click select all and delete we don't need that now we go to chat GPT and we be polite to the AI because eventually they might take over so you say good morning are you familiar with the metatrader for coding language then it will tell you yes I know it so you've prompted it to understand what you want to start doing so now that it understands that it'll be programming in a language that's for metatrader 4 we can now begin so I write to it I would like to make an EA trading bot that follows specific rules for entry all of this will happen on a five minute time frame in order for a Buy trade to start there must be this specific series of three five-minute candles since we are trading on the five minute chart because I want this to be a scalping bot first there must be two five-minute bearish candles and then the third candle must be bullish and close above the highest price of both the previous candles you have to be extremely specific when it comes to coating a bot it cannot be subjective it needs to be specific coding is a language of ifs and thens if this happens then do this if this happens and the bullish candle close is above the 10 EMA then enter a Buy trade at market price with a stop loss one tick below the entry candle so we'll have two bearish candles one bullish engulfing engulfing both of those two entry price here and the stop loss one tick below the bottom of that candle I've added lowest price because you need to be hyper specific then in order for a cell trade to start there must be this specific series of three five minute candles two five-minute bullish candles and then the third candle must be bearish and close below the lowest price of the two previous bullish candles highest price sorry lowest price you need to be very very specific with this if this happens and the bearish candle closes below the 10 EMA then enter a cell trade at market price with a stop loss one tick above the entry candle's highest price and the take profit again should be two times what the stop loss is in ticks so it's like a three-line strike that I've taught on this channel but it's a two-line strike then this is a key thing for me I want everything adjustable within the settings of the EA so that when you are optimizing it so say it works and you put it into the strategy tester you want to then optimize it by adjusting the settings and see what works the best over a longer time frame so you'll be able to test the strategy and see what settings are best because your idea may not be the best idea so in the settings I want to be able to adjust the stop loss and ticks adjust the take profit and ticks and be able to adjust the time of day that the bot is active from by default I want it to have trading hours between 8 AM and 1 pm server time so most Bots fail during non-market hours because like especially if it's an EA crossover right because during Tokyo session it just like does this and it doesn't really work that well so I want specific trading hours for this bot the more confluences you can give it and the more settings that you can have within the settings of the EA the better but don't do too many because you won't be able to strategy test it because it's an overload like you'll change all these parameters and have like huge scales between this and this and then try to strategy test that and it'll say it's too many parameters like I can't do anything because it's like trillions of back testing results so just click Send message once it gives you that code you just copy the code and then paste it into the uh metatrader meta editor the language editor for metatrader4 and then you click this green button that says compile and it will compile all of that code and see if there's any errors so as you can see we got nine errors so we just uh copy all of those and then politely let chat GPT know they made some errors and to correct them so I say sorry but I got some errors while compiling please fix the code and then you paste in all of the errors so it's generating all this code and I have no clue whatsoever I don't code at all I've only experienced code with this so you copy that code you select your previous code from The Meta editor delete it and put in the new one and then just click compile better than nine errors but we still have three then you just paste those errors into chat GPT copy that code again select all the old one delete it paste in the new one and compile again now we have zero errors that's insane because I did this for my bot about 578 times so now we go file save as and now when you're in your metatrader platform what you can do is click on view and go to strategy tester then you will get this thing on the bottom of your platform you'll select the expert advisor that you just made and you should theoretically be able to test it on anything because we did all of the parameters in ticks and not Pips or points so let's check it from July 1st to July 31st of this year select opening prices only because we are doing it on candle closures not when a tick happens check the parameters of the expert advisor so you can set the account size to I don't know 100 000 accounts and one issue I'm seeing already is I forgot to tell it what size account or what slot size to be trading so that might be an issue and we tried running it so yeah just as I thought it's not entering any trades so we go back to chat GPT so I say sorry I need to add in the settings the trade size for each trade by default I want it to be 0.01 Lots preemptively we can select all of the previous code and delete it because it doesn't work paste it in here pilot zero errors that's nice save the bot once you do that make sure you reload your metatrader because it's got a new file and you don't want to be testing the old one so now let's run it again I genuinely thought that because my rules of Entry were so simple this would be an easy bot to make but it's not and it's causing a lot of back and forth to and from to figure out what's working what's not working what parameters I need to adjust how much more specific I need to be and to be completely honest it was kind of a foolish hope that I had that I could do it this quickly because the bot that I made it took about six months of coding back and forth and testing and optimizing adding different parameters adding different settings but you get the gist of what I'm trying to do here right so you give it a baseline you have multiple confluences for your entries so if it's above the 10 EMA you want it to take long positions because it's a trend continuation if it is below the 10 EMA it's also a trend continuation a downtrend correct so we were looking for a two-line strike and because I'm amazing at Graphic Design This is what it should have looked like as you can see we had two bearish candles and then one bullish engulfing candle engulfing these two above the 10 EMA and the take profit was two times the risk stop loss down here take profit up there so you need to have a clear and concise idea of what you want your trading bot to do and you need to be hyper specific when talking to chat GPT to get these parameters and it's seriously like the bot that I have it was the name of the bot one the name of the bot 1.1 the name of the bot 1.2 and I did this and I think I have like a good 400 versions of my bot so it is a painstaking process and I spend six five three eight hours a day on this thing whenever I have time I'm putting it towards this but if eventually you'll compile a code that gets no errors and then you'll put it in the strategy tester and it'll work but the results won't be that great and then what you'll do is you will change all of these values and give it a starting parameter an ending parameter and in what increments you want it to move and select all of these things click OK and then right here you'll select this optimization icon when you do that and you click Start in the given time frame that you've given it the use date from and to it will use every single parameter it will back test every single minute variation of your Bot using different settings to give you the best results so for example on my bot it will do all of this and give me all of these are individual back tested results every single one of these dots it's Millions upon millions and then it'll give you optimized results you can sort that by highest profit select that one and then it'll give you new settings for your Bot and you just keep doing this over and over and over and over and over and over and over again until you get comfortable with chat gbt you get comfortable with the coding you get comfortable with wasting your time back testing a million times before you get a successful one this is a very deep rabbit hole and if you fall down it and you actually commit to doing it I'm pretty sure if you're an intelligent person you can problem solve and use critical thinking it's kind of like a puzzle you'll be able to get something that works it might not work great but it might work enough for you to have a little bit of passive income