How to Make a Trading Bot Part 2

How to Make a Trading Bot Part 2


How to Make a Trading Bot Part 2

part 2. In this video, I use artificial intelligence and ChatGPT to write a bot in the meta-trader trading platform coding language. This will be a process of how you would take your rules based strategy and turn it into an automated system the trades for you to generate yourself some passive income.

Get your $200,000 funded account here (25% discount)
https://funderpro.com/get-funded-with

if you want in depth day trading education as well as a community and custom buy sell indicators join the trading floor today
https://www.trdfloor.com/

my twitter https://twitter.com/artybryja

For charts Use Trading View
https://www.tradingview.com/?aff_id=1

New Official Telegram Group
TMA OFFICIAL®
https://t.me/TMAbyArty

Looking for a forex broker?
I use Osprey
https://ospreyfx.com/tradewithtma

regulated broker i recommend is Blueberry markets
https://bit.ly/blueberrytma

Try a $100,000 funded account from OspreyFX
https://ospreyfx.com/tradewithtma
Use coupon code
movingaverage50
To get $50 off

Get a free audio book from audible
https://tmafocus.com/2WyXSqa

Links to the indicators

TMA Overlay
https://www.tradingview.com/script/zX

TMA Divergence indicator
https://tmafocus.com/3nfcEfd

TMA shop
https://shop.spreadshirt.com/themovin

Get some free stocks from WEBULL
https://tmafocus.com/3p0vatP
also
Get some free stocks from Public
https://tmafocus.com/3GUUojh

NOT FINANCIAL ADVICE DISCLAIMER

The information contained here and the resources available for download through this website is not intended as, and shall not be understood or construed as, financial advice. I am not an attorney, accountant or financial advisor, nor am I holding myself out to be, and the information contained on this Website is not a substitute for financial advice from a professional who is aware of the facts and circumstances of your individual situation.

We have done our best to ensure that the information provided here and the resources available for download are accurate and provide valuable information. Regardless of anything to the contrary, nothing available on or through this Website should be understood as a recommendation that you should not consult with a financial professional to address your particular information. The Company expressly recommends that you seek advice from a professional.

*None of this is meant to be construed as investment advice, it’s for entertainment purposes only. Links above include affiliate commission or referrals. I’m part of an affiliate network and I receive compensation from partnering websites. The video is accurate as of the posting date but may not be accurate in the future.


Content

0 -> okay welcome to part two of making your
3.06 -> own bot for day trading this is going to
6.54 -> be just me rambling on problem solving
9.66 -> going back and forth between the
11.76 -> strategy tester The Meta editor the
14.519 -> language coding editor for metatrader4
17.64 -> as well as chat GPT so I'm gonna go in
20.82 -> and start working on this I'm going to
23.279 -> start fresh all new and I will discuss
26.939 -> everything that I've typed into chat gbt
29.46 -> and this video is just going to be sped
31.14 -> up in between times when I am not
34.14 -> talking so first you want to prompt your
35.88 -> chat GPT and ask if you are familiar
38.46 -> with metatrader4 and the coding language
40.079 -> to make an EA trading bot it's basically
42.6 -> priming chat GPT to know where to start
45.96 -> when you're asking it questions okay so
48.239 -> I told chat GPT I would like to make a
50.94 -> trading bot here are the rules for entry
54 -> of a trade the bot will automatically
56.46 -> calculate the account balance and enter
58.32 -> in trades based on the account balance
59.94 -> and risk one percent of account balance
62.219 -> per trade in the settings of the bot I
64.26 -> want to have the ability to change the
66 -> hours in which the bot is trading by
67.92 -> default I wanted to trade from 8 AM to
70.32 -> 1400 server time so 8 AM to 2 PM this
73.619 -> will all be on the five minute time
75.479 -> frame chart for a Buy trade if a bullish
77.76 -> engulfing candle prints that engulfs the
79.68 -> previous two candles then the bot will
81.18 -> enter buy order at the current market
82.799 -> price the trade will only happen once
85.56 -> the 5-minute candle is closed for a sell
87.72 -> trade if a bearish engulfing candle
89.7 -> prints that engulfs the previous two
91.32 -> candles the bot will enter a sell trade
93.54 -> at the current market price the trade
95.46 -> will only happen once the five minute
97.259 -> candle is closed the stop loss for a buy
99.659 -> will be the lowest price of the entry
101.52 -> candle the stop loss for a cell will be
103.56 -> the highest price of the entry candle
105.24 -> the take profit will be two times the
106.979 -> stop loss for both buy and sell trades
109.02 -> so now I just click Send message copy
112.079 -> the code and we're going to create a new
114.54 -> thing expert advisor rename it to
118.32 -> YouTube tests on char our event on
120.899 -> tester select all of that paste that in
123.36 -> and compile so we got three errors and
126.6 -> two warnings copy that all and give it
129.36 -> to chat GPT to fix and say please fix
133.879 -> these errors and warnings so delete the
138.36 -> old code paste in the new one compile it
141.239 -> again still getting three errors but no
143.7 -> more warnings copy all of that paste it
146.64 -> into chat GPT compile again still three
150.9 -> errors and you just got to keep doing
152.94 -> this back and forth constantly kind of a
155.64 -> pain we got zero errors that is very
158.879 -> nice uh when you save as you have to do
161.04 -> it in the mql4 folder and then in the
165.06 -> experts once you refresh your metatrader
167.459 -> it'll be here in your strategy tester
169.56 -> alright so the bot did not enter in any
172.019 -> trades so we'd ask chat GPT why so I
175.62 -> just wrote in the bot is not entering
177.12 -> any trades can you please figure out why
178.68 -> also I'd like this bot to trade on NAS
180.84 -> 100 on the five minute time frame I
182.819 -> didn't clarify that before but maybe it
184.8 -> might help so copy that code no errors
187.26 -> when I was compiling still not entering
189.239 -> trades so I need to talk to chat GPT and
192.72 -> maybe help it Define what an engulfing
195.36 -> candle is so I told chat GPT I'm going
198.06 -> to Define what I mean by engulfing
200.04 -> candles and you can add it to the code
201.599 -> the total calculations are for three
203.459 -> candles and based on the high open low
205.56 -> close of the candles bullish engulfing
207.54 -> candle the first five minute candle is
209.04 -> bearish second candle is also bearish
211.62 -> and the third candle's closing price is
213.959 -> higher than the highest price of the
216 -> first candle in the series of three
217.62 -> candles opposite for bearish engulfing
220.44 -> we got six warnings so I will copy these
223.319 -> errors and give it back to chat GPT okay
226.019 -> it's still not working so back to the
228.18 -> drawing board with chat GPT I will let
230.519 -> you know what I tell it to do okay so
232.62 -> I've started completely over I asked it
234.48 -> if it knows what metatrader 4 is primed
237.18 -> it for its current task and told it I
239.64 -> would like to make bot this is on NAS
242.28 -> 100 on the five minute chart the rules
244.14 -> for buy entry if a bullish engulfing
246.239 -> five minute candle closes enter a Buy
248.28 -> trade at the current ask price lot size
250.62 -> for the trade will be zero one rules for
253.08 -> sell entry are the exact opposite stop
255.18 -> loss for either buy or sell trades will
257.04 -> be a thousand ticks take profit for both
259.199 -> buy or sell will be 2 000 ticks stop
261.959 -> loss take profit and lot size will be
264.3 -> adjustable in settings again keep giving
266.34 -> chat GPT all of the errors to fix
268.44 -> sometimes it'll only give you the
269.82 -> correction so you have to ask it for the
271.139 -> entire code because I don't know how to
272.58 -> adjust it or edit it or where to put it
274.38 -> all right so after 20 times back and
276.36 -> forth with all the errors we finally
278.46 -> have something that functions so let's
280.44 -> test it out I'm going to rename it
281.88 -> because it's a completely different bot
283.8 -> okay so after a gajillion back and
286.38 -> forths uh we finally have a bot that
289.02 -> enters trades and actually does
291.06 -> something it's absolutely horrible for
293.759 -> right now we started with an initial
295.68 -> deposit of a hundred thousand dollars
297.18 -> and it is down 53 649 dollars overall it
301.86 -> has had 74 consecutive losses it has won
305.22 -> 27 percent of the short positions and 30
307.8 -> percent of the long position so now what
310.139 -> we can do is go into the settings in the
312.6 -> expert properties of the EA and adjust
315.479 -> the stop loss take profit as well as the
318 -> law actually let's leave the lot size
319.62 -> let's not adjust that let's do just do
322.139 -> the stop loss and take profit so we're
324.6 -> going to start with a stop loss because
326.759 -> uh 1000 ticks is essentially 10 points
330.66 -> on NAS so let's start with 500 do steps
333.96 -> of 100 so every increment is one point
337.56 -> so one dollar movement in Nas and stop
340.38 -> loss maybe we can go up to 15 points I
342.78 -> don't want to do anything more than that
344.22 -> take profit we can start at 10 points
347.1 -> steps 100 so one point and let's do 5
350.639 -> 000 ticks which is 50 points now just
352.74 -> click OK click the optimization icon
355.919 -> right here and then make sure this model
358.02 -> is set at opening prices only we don't
361.08 -> need to do every tick because our bot
363.72 -> trades on the closing prices so it
366 -> doesn't need every tick and then you
367.44 -> just click Start so a bunch of passes
369.3 -> were done during optimization and
370.979 -> they've been discarded as insignificant
372.9 -> which means there's no benefit in
375.479 -> adjusting the stop loss and the take
376.979 -> profit of the bot but we have something
379.32 -> that works now so all we have to do is
382.199 -> add code using chat GPT to give it more
385.8 -> parameters for trading for example the
388.56 -> trading hours whether it's 8 AM to 11
390.9 -> A.M or whether price is above or below a
394.02 -> specific moving average so because I've
396.06 -> been doing this for an hour and a half
397.5 -> what I'm going to do is end this episode
399.6 -> here and do episode three on Monday I'm
402.9 -> gonna add some extra parameters over the
404.58 -> weekend and I'm going to let you know
405.78 -> how the bot worked out

Source: https://www.youtube.com/watch?v=hr-ejTXEFPE