ChatGPT o1: Alligator Day Trading Strategy in Python Makes 1721% — Transcript
Full transcript
- 0:00hey guys so today I'm going to write the
- 0:02day Turing version of the allegator
- 0:04strategy using the chat gp01 model while
- 0:07I was writing this strategy I happened
- 0:09to learn about two new indicators that I
- 0:11didn't know about that improve the
- 0:12results of this strategy but not only
- 0:14that the result of this strategy
- 0:16happened to beat even my best private
- 0:18strategy yet which is why I was a bit
- 0:20hesitant to even release this video but
- 0:22I did it anyways so it's going to be
- 0:24awesome let's get right into
- 0:26it this is the prompt that I used please
- 0:29explain how the alligator strategy Works
- 0:31assume I want to write it with code so
- 0:33explain to me entry and exit rules for
- 0:35it also tell me which indicators would
- 0:37be nice to use alongside with it
- 0:39especially for avoiding ranging markets
- 0:41now first let me show you the alligator
- 0:43strategy in action it consists of three
- 0:45moving average lines the blue line as
- 0:47explained by Chad GPT is a smooth
- 0:50average with a period of 13 the red line
- 0:53is called the teeth of the alligator and
- 0:55it has a period of eight which is our
- 0:57fastest moving average is called the
- 0:59lips of the alligator and it has a
- 1:01period of five and the basic idea is
- 1:03that when the alligator is waking up for
- 1:05example in here it will start to open
- 1:08its mouth and when it is doing that
- 1:11first we're going to see the lips of the
- 1:12alligator and then its teeth and then
- 1:14its jaw and when these lines are
- 1:17crossing each other it means that the
- 1:18alligator is closing its mouth and the
- 1:21trend is over all right so what are the
- 1:22entry rules we want the value for the
- 1:24lips to be bigger than teeth and both of
- 1:27them to be more than the jaw the other
- 1:29thing is is that we want the current
- 1:30price to be above all the three lines
- 1:33and the opposite is true for a short
- 1:35position right so let's go to Jesse and
- 1:37start by creating a new strategy I'm
- 1:39going to call it
- 1:41alligator AI then I will open my pie
- 1:45charm editor and open the code here
- 1:47first let's define a new property and
- 1:49name it alligator and in it I'm simply
- 1:53going to return ta alligator and then
- 1:56passing the current candles and I'm not
- 1:58even going to change the parameters next
- 2:00I'm going to Define another property and
- 2:02I'm going to call it Trend and in it I'm
- 2:04going to say if the current alligators
- 2:06lips are bigger than the alligator's
- 2:10teeth and if this one is bigger than the
- 2:14alligator's jaw I'm going to return one
- 2:18actually we also supposed to check for
- 2:20the price so we want to also make sure
- 2:22that the current price is above the lips
- 2:26of the alligator if the opposite of this
- 2:28is true I'm going to return minus and if
- 2:30none of these are true I'm going to
- 2:32Simply return zero all right so my in
- 2:34rule is going to be whether or not the
- 2:36current Trend equals one for a short
- 2:38position I will do the opposite all
- 2:41right now that we have our entry rules
- 2:42it's time to set the position sizing all
- 2:44right so my entry price is going to be
- 2:47the current price because I want to open
- 2:49the position using a market order my
- 2:51stop is going to be the current entry
- 2:53minus the ATR with default values
- 2:57multiplied by two now using these two I
- 2:59want to risk only 3% of my capital in
- 3:01each trade so I'm going to say Quantity
- 3:05equals utils risk to quantity for the
- 3:09first one I'm going to pass my available
- 3:11margin next we have the risk which I
- 3:13wanted to be three next I will pass my
- 3:17entry and then the Stop and lastly I
- 3:22will say the furite is the current fee
- 3:24of the exchange that I'm trading this
- 3:26all right now we're ready to submit the
- 3:27order and I'm going to Simply say self
- 3:29bu equals
- 3:32quantity and then pass the price which
- 3:35is
- 3:36inry now for my short condition I will
- 3:39simply do the opposite of this so
- 3:41instead of subtracting the ATR by two
- 3:44I'm adding it all right now the value
- 3:46for shoot cancel entry it needs to be
- 3:48here but it doesn't matter what I said
- 3:50here because I'm using a market order to
- 3:52open my position so we're not going to
- 3:53have any cancellations whatsoever for my
- 3:56exit rule at first I tried what chat gbt
- 3:58suggested which is to close the position
- 4:00when the lips in other words the green
- 4:02line crosses back over the teeth in the
- 4:05opposite direction now let me show you
- 4:07how to write that first we can simply
- 4:09Define the update position method and in
- 4:11it I'm going to say if we are in a long
- 4:15position and the current trend is no
- 4:19longer one that means we have a trend
- 4:22reversal so simply liquidate my position
- 4:25and of course we would do the opposite
- 4:27for short positions all right so let's
- 4:29let's go and execute a back test for
- 4:33this first I will start with the 15
- 4:36minutes time frame and as for the
- 4:37duration of the back test I will start
- 4:39since the beginning of
- 4:412022 and I will back test it up until
- 4:44just a few days ago and the fast mode is
- 4:46on so it's a benchmark so let's run it
- 4:50while this is going I'm going to also
- 4:52back test it on a bigger time frame such
- 4:53as 30 minutes and another one with the
- 4:57hourly and then another one with the 4
- 5:03hours all right so this is the result
- 5:05for the 4 hours this is for 1 hour this
- 5:08is for 30 minutes and this is for 15
- 5:10minutes all right so the lower the time
- 5:12frame the more it actually loses so this
- 5:14means we need some filters so the first
- 5:16thing that I'm going to do is to use
- 5:18what attribut is suggested for avoiding
- 5:20the ranging Market the first is to use
- 5:23the adx indicator so let's go back and
- 5:25Define a new
- 5:27property going to call it adx
- 5:30and simply return whether or not the
- 5:32current
- 5:33adx for the current
- 5:36candles is more than 30 and in my inter
- 5:39rule I will say and self. adx I'll do
- 5:43the same for short positions so let's go
- 5:46back and execute everything one more
- 5:48time because I want to be able to
- 5:51compare the results very easily on The
- 5:52Benchmark page I'm going to remove some
- 5:54of these items such as the start date
- 5:57and the Finish date and the name of the
- 5:58strategy The Exchange symbol and the net
- 6:02profit and sortino and Omega ratios all
- 6:05right so we can see that all the results
- 6:08improved not only that the one with the
- 6:104 hours time frame is actually looking
- 6:12really good and these are the other ones
- 6:14by the way I tried almost everything
- 6:16that CHD suggested but in this video I'm
- 6:18only showing you the ones that actually
- 6:19worked for me so the next thing that I
- 6:21tried and it helped a lot was using a
- 6:24higher time frame so let's go back and
- 6:26Define a new property and I'm going to
- 6:28call this the the long-term candles and
- 6:31in it I will return the G candles first
- 6:34I will pass the current exchange then
- 6:37the current symbol and as the time frame
- 6:41I will pass 4 hours but since we are
- 6:43also trading the 4 hours time frame I
- 6:45need to write this in a dynamic way so
- 6:47that if we are trading it we we should
- 6:49use a bigger time frame so I'm going to
- 6:50change this code to say big TF equals 4
- 6:54hours but if the current time frame
- 6:57equals 4 hours then use the 6 hours and
- 7:01I will replace this with big TF all
- 7:04right next I'm going to copy what I
- 7:06wrote for the trend paste it here and
- 7:09I'm going to call this one big Trend now
- 7:12I'm not going to use this value of the
- 7:13alligator because it is using the
- 7:15current candles so I will also duplicate
- 7:19this one and call it Big and instead of
- 7:22using the current candles I will use the
- 7:24long-term Candles now in here instead of
- 7:28this one I will replace it by big
- 7:33alligator and in my entry rules I will
- 7:35add another condition saying if the
- 7:37current big Trend equals one and I'll do
- 7:40the opposite for my short positions so
- 7:42now let's go back to Jesse and rerun
- 7:44everything one more
- 7:46time so nearly all the results are
- 7:49improved except the one for the 4 hours
- 7:51but it's not looking bad it's just that
- 7:53the 1 hour and 30 minutes look much
- 7:56better now the 15 minutes is still very
- 7:59bad now because the 1 hour is looking
- 8:01good here I did what I usually do with
- 8:03lower time frames which is instead of
- 8:05taking the profit dynamically like we
- 8:07did in here I'm going to take profit at
- 8:09a specific Target so I'm going to remove
- 8:12this and instead I'm going to add a new
- 8:14function called unopen position and in
- 8:17it I'm going to say if the current
- 8:19position is a long position I want you
- 8:21to submit the subplus the quantity of it
- 8:24is going to be the quantity of current
- 8:26position and the price of it as we Des
- 8:29cribed here is going to be the current
- 8:33price minus 2 times of the current ATR
- 8:37and if it is a short position we will do
- 8:40the opposite but I wanted to take profit
- 8:42at a specific point so I will say take
- 8:45profit equals the same but I want my
- 8:48risk reward ratio to be one so I will
- 8:50multiply it by two and I will do the
- 8:53opposite for my short positions all
- 8:56right so let's go back to Jesse actually
- 8:58I'm going to remove the 15 minutes
- 9:00because it's not performing well and it
- 9:01actually takes a lot to execute all
- 9:04right so let's rerun all the other three
- 9:07so while this is going I wanted to
- 9:08quickly remind you guys that we have a
- 9:10Discord Community with more than 3,000
- 9:12cons such as you and I we hang out there
- 9:14share ideas and help each other out and
- 9:16I would love to see you guys there so
- 9:18check this out all the results are
- 9:20improved and in fact the hourly looks
- 9:22really well the sharp ratio is 1.1 the
- 9:25max thron is minus 20 and the net profit
- 9:28is 106% so let's take a look at the
- 9:30equity curve which looks really
- 9:33well and this is for 30 minutes and this
- 9:36one is for 4 hours all right so while we
- 9:38are using the bigger time frame there's
- 9:41also one more trick that I usually use
- 9:43that works really well and that's using
- 9:44the 100 moving average but with the
- 9:47bigger time frame so I'm going to Define
- 9:49another property and call it the
- 9:51long-term Ma and in it I will say E
- 9:56equals T EMA I will pass the long-term
- 10:00candles and for the period I will use
- 10:03100 and I will say if the current price
- 10:06is bigger than e return one otherwise
- 10:12return minus one and in my entry
- 10:15conditions I will also add this one
- 10:17let's go back and rerun all of them here
- 10:20if you notice a sharp ratio number here
- 10:22you'll notice that all of them are
- 10:23slightly improved comparing to what we
- 10:25had before so let's take a look at the
- 10:27equity curve and this is how it looks
- 10:31now I like this one specifically because
- 10:33it seems that it's been going up and up
- 10:35and up and during this ranging Market it
- 10:37didn't do well but the truth is that
- 10:39almost every other Trend following
- 10:41strategy was getting slaughtered during
- 10:42this time all right so at this point I
- 10:44wanted to improve the results even
- 10:46further and I needed more indicators so
- 10:48I went back to chat gbt and I simply
- 10:49said I tried the strategy and indicators
- 10:52that you mentioned but I'm not getting
- 10:54the best results the adx is really
- 10:56helpful but I need more like it to avoid
- 10:58ranging conditions and it gave me a
- 11:00bunch of other ideas and indicators and
- 11:02I tried nearly all of them but none of
- 11:04them was really helpful now I don't know
- 11:06if you guys know about this or not but
- 11:07in the past few weeks I've been working
- 11:09on a custom version of GPT for Jesse
- 11:12which has access to the documentation
- 11:14and a strategy examples that I've wrote
- 11:16myself it's using the open AI API so
- 11:18it's pretty much the same thing as chat
- 11:20GPT except it has a better knowledge
- 11:22about ALG trading now I simply pasted my
- 11:25strategy so far and I just said that you
- 11:28know what the ad was really good but I
- 11:30tried a bunch of others and give me some
- 11:33new ones and it started giving me ideas
- 11:35such as the obv and other volume
- 11:37indicators which almost never work out
- 11:39for me it also suggested the RSI which
- 11:41wasn't helpful macd again not helpful
- 11:44until I came across this one the CMO
- 11:47which is a momentum indicator that
- 11:48escalates betweenus 100 and plus 100 it
- 11:52also gave me the code so this is how to
- 11:53define it inside Jesse and this is how
- 11:56to use it so we can say if the value of
- 11:58CMO is bigger than 50 I want to take
- 12:00long trades and the opposite for short
- 12:02trades so first let me show you how it
- 12:04looks like we have this threshold which
- 12:06is set to zero if the price of the CMO
- 12:09is bigger than that it means we have an
- 12:11uptrend if it's below that it means we
- 12:14have a downtrend but what we really need
- 12:16is for the value of it to be above a
- 12:18certain threshold now the one that
- 12:20really worked well for me was
- 12:2230 and minus 30 for short trades so if
- 12:26this value is above 30 we want to look
- 12:28for long trades if it's below this like
- 12:31in here or here we want to look for
- 12:34short trades so let's go back and Define
- 12:36a new property and I'm going to call it
- 12:39CMO and I'm going to return ta CMO and
- 12:43that's it now in my inry condition I
- 12:45will say and the CMO value is bigger
- 12:49than 30 and I will do the opposite for
- 12:52my short positions so let's go back to
- 12:54Jesse now remember these numbers now
- 12:57let's reexecute them all right so it
- 13:00improved the results for the 4 hours but
- 13:02in hourly it actually didn't help I
- 13:04think it made it slightly worse and this
- 13:07is for 30 minutes so let's go back and
- 13:09try the same thing except with the
- 13:11number
- 13:1320 and reexecute everything all right
- 13:16check this out the sharp is now at 1.4
- 13:19for the hourly and the panl is at
- 13:25147% this looks
- 13:27fantastic and this is for 30 minutes and
- 13:30this is for 4 hours the 4 hours actually
- 13:32didn't get better but the hourly looks
- 13:35really good especially before 2024 all
- 13:38right next I came back to the GPT and I
- 13:41kept asking for other suggestions and I
- 13:42tried nearly all of them until I came
- 13:45across this one the stochastic
- 13:47oscillator now this is how we can Define
- 13:49it in Jesse and this is obviously how we
- 13:51can use it all right so let me show you
- 13:52how it looks
- 13:54like but in my experience the stochastic
- 13:57RSI works much better than the stasic so
- 14:00I will also add this one now I don't
- 14:02know why that is but again this one
- 14:04usually works better in my strategies
- 14:07which is why I actually went with this
- 14:08one in my strategy all right so we have
- 14:10two thresholds at 80 and 20 so basically
- 14:14it's very similar to how the RSI works
- 14:16when the value of it is below 20 it
- 14:18means that the market is oversold and
- 14:20when it is above 80 it means that it is
- 14:22overbought which is good for shorting so
- 14:25let's go back and Define a new property
- 14:27and I'm going to call it the
- 14:30srsi and in it I will return
- 14:33srsi I will pass the current candles and
- 14:36I will leave the default values next in
- 14:38my entry conditions I will say if the
- 14:41RSI is below 20 I will take long
- 14:44positions and if is above 80 I will take
- 14:47short positions so let's go
- 14:50back again take a look at
- 14:52this now let's reexecute all of them
- 14:56seems like we're getting an error oh so
- 14:58basically basically the stochastic RSI
- 15:01it doesn't return one scolar value it
- 15:04returns a name Tuple as you can see here
- 15:07so what I wanted to return is the value
- 15:10K now by the way K is this blue line and
- 15:14D is this orange line which is a moving
- 15:16average of that but we don't really care
- 15:18about that we just want the Blue Line
- 15:20itself all right so let's go back and
- 15:22reun them one more time wow it is much
- 15:25better look at this sharp on the 30
- 15:27minutes is 1.9 99 for hour Le 1.5 on the
- 15:314 hours it came down but at this point I
- 15:34don't think I'm going to trade this one
- 15:35at all so let's just close it this is on
- 15:39the 30 minutes and this is on the hourly
- 15:43now both of these look good but this one
- 15:45looks much better now here's the thing
- 15:47though the Maxon is only minus 6 which
- 15:50is basically nothing because I'm
- 15:52comfortable to take as much as- 30% Max
- 15:54draw down and for the hourly it is- 7%
- 15:57so that means I can simply go back and
- 16:00multiply the size of my positions by
- 16:03let's say five so let's rerun this one
- 16:06more time all right so now when the max
- 16:09Ron is minus 29% the net profit is at
- 16:141,721 per. so let's take a look this is
- 16:17how it looks like now you cannot even
- 16:20see the equity care of Bitcoin anymore
- 16:23let's take a look at the hourly now both
- 16:25of them look fantastic even during this
- 16:28this nasty Market range that we had
- 16:31again this is how the BTC was and this
- 16:34is how our Equity C looks like by the
- 16:37way I also extended the duration of the
- 16:39back test starting from 2022 for this
- 16:42strategy and here's the result and I
- 16:44also made a premium version of the same
- 16:45strategy and this is the result for that
- 16:48so let's compare the two so instead of
- 16:511300% profit now we're making 33% and
- 16:55the Max draw down is even lower the
- 16:57sharp ratio instead of 1.5 5 is now 2
- 17:00and the Calo ratio instead of 2.2 is now
- 17:023.8 the annual return instead of 74% is
- 17:06now
- 17:07107% and the win rate is 72% instead of
- 17:1162 and the average holding hours for
- 17:13both of them are around 9 hours which
- 17:15makes it a day trading strategy you can
- 17:18access the source code for both
- 17:19strategies on our website if you haven't
- 17:21checked out this page yet now is the
- 17:23time to do so there are tons of other
- 17:25strategies in here and you can very
- 17:27quickly see the results of each strategy
- 17:29on various periods and symbols and time
- 17:31frames as always we're going to have a
- 17:33giveaway a random person who likes this
- 17:35video posts a comment and subscribes to
- 17:37this channel is going to receive 1
- 17:39million bnk token all right let's pick
- 17:40the winner for the previous
- 17:43video and the winner is really nice
- 17:45features for back test thank you so much
- 17:47for your comment please reach out to me
- 17:49so that I can send you your bunk tokens
- 17:51thank you for watching and happy Trading
- 17:54[Music]
- 17:58oh
About this transcript
This page contains the full transcript of ChatGPT o1: Alligator Day Trading Strategy in Python Makes 1721% by Algo-trading with Saleh, generated from the public captions YouTube serves with the video. The transcript has 3,381 words across 441 segments, with the original timestamps preserved so you can click any line to jump to that moment in the embedded player.
What you can do with it
Use the transcript to take notes, quote the speaker, build a study guide, generate a summary with ChatGPT or Claude via the YouTube Summary tool, or export it as a timed subtitle file with YouTube to SRT. You can also re-open it in the transcriber to translate the transcript into 100+ languages.
Free YouTube transcript tool
YouTube2Text is a free YouTube transcript generator — no signup, no daily limit. Paste any YouTube link and get the full transcript instantly, with timestamps, click-to-jump, translation to 100+ languages, AI prompts for ChatGPT, Claude, and Gemini, and exports to TXT, SRT, VTT, or Markdown.