Shorting meme coin strategy in Python makes 86% — Transcript
Full transcript
- 0:00Hey guys, it's so today we're going to
- 0:01write a Python strategy to trade the
- 0:04Trump memecoin. Now, I may not be a
- 0:06political person, but when it comes to
- 0:07trading, Mr. Trump's coin is a great
- 0:10opportunity for shorting. And that's
- 0:12exactly what we're going to do today.
- 0:13Now, first I will show you the entry and
- 0:15exit rules of the strategy on Trading
- 0:16View and then we will use GPT to convert
- 0:19those rules into Python code so we can
- 0:21run some actual back test on them. Now,
- 0:23before I continue, I got to say I am not
- 0:25a financial adviser and this video is a
- 0:27tutorial and you should always do your
- 0:29own research before trading. Now, with
- 0:30all that out of the way, let's get right
- 0:32into the video.
- 0:35And the first indicator that we're going
- 0:37to use is a simple EMA crossover. So,
- 0:40let's add two moving average exponential
- 0:42and then change the time frame from 9
- 0:44into 12. And let's do it one more time.
- 0:47And this time, let's change it into 26.
- 0:50And I'm also going to change the size of
- 0:52it to be slightly thicker and in another
- 0:55color. All right. So the first entry
- 0:56rule is very simple. We want this blue
- 0:59line here which is our fast EMA to be
- 1:01below the purple one. So this would have
- 1:03been a valid entry point for us. The
- 1:05next indicator is going to be the RSI
- 1:07which is the most famous oscillator and
- 1:09I'm sure you already know it. But let's
- 1:11add it to our chart. All right. So I'm
- 1:13going to define a threshold at the value
- 1:16of 55. So that would be approximately
- 1:19here. And I want the value of the RSI,
- 1:22which is this purple line here. It
- 1:24should be above this threshold. So let's
- 1:26just edit this so you guys can see it
- 1:28better. Let's remove this moving
- 1:29average. And also, let's see if I can
- 1:33change the threshold. I should get
- 1:35exactly what I wanted. Let's also remove
- 1:37this and this. Great. All right. So I
- 1:40can also remove my own line and just use
- 1:42this. All right. So the second inter
- 1:44rule is that the RSI value must be above
- 1:47this threshold value which is here. So
- 1:50all these areas would have been a valid
- 1:52choice except that if you notice the EMA
- 1:56crossover wasn't happening here because
- 1:57of that we would not have gone short
- 1:59here. Now the next indicator is
- 2:01something that I always use in order to
- 2:04filter out the ranging markets because
- 2:06this is supposed to be a trend following
- 2:07strategy. So we don't want to take any
- 2:09trades if we are in a range and that is
- 2:11the ADX. So let's add it.
- 2:15And the threshold for it is going to be
- 2:1720. So let's add this here. So basically
- 2:19anywhere where the ADX value is above
- 2:21this threshold would be valid for us. So
- 2:24for example in here where the crossover
- 2:26was happening would have been valid.
- 2:27Although in this case it wasn't because
- 2:29the RSI was actually below the number
- 2:3255. And believe it or not that's it.
- 2:34That's all the entry rule that is the
- 2:36strategy. It is very very simple. Now I
- 2:39looked up and I found one point in time
- 2:41where the all the entry rules would have
- 2:43been true and that is here. So you see
- 2:45not only the blue line or our fast EMA
- 2:48line is below the purple line or the
- 2:50slow moving average but also the RSI
- 2:52value is above our threshold and the
- 2:55value of the ADX is also above the
- 2:57threshold. So this would have been one
- 2:59area where we went short. You see and it
- 3:02would have been a perfect short. But
- 3:04this is our entry rule. What about the
- 3:06exit rule? For exiting the trade, I
- 3:08would have simply used something like
- 3:10the ATR. So, let's add it to our chart.
- 3:12Average true range. Now, this indicator
- 3:14is not like an oscillator or a line on
- 3:17the chart. It gives us a value, right?
- 3:20So, you can see the value of it is
- 3:21changing. And at this point, it would
- 3:23have been 0.069.
- 3:25And we can simply add that to our chart.
- 3:27So for instance, what I want here is
- 3:30this plus 1.5 of that value for our stop
- 3:33loss, which would have been
- 3:34approximately here. And then for the
- 3:36takerit, we use 2.5 times of that. So
- 3:39that would have been approximately here.
- 3:42So if this was our entry, the stop loss
- 3:45would have been here and the take profit
- 3:47would have been here. And as you can
- 3:48see, it was truly hit. And as for
- 3:51position sizing, I want to risk 1.5% of
- 3:54my capital per each single trade. And
- 3:56that means if this stop loss was hit, I
- 3:59would have lost only 1.5% of my total
- 4:01capital. For example, if I was trading
- 4:03with $10,000, I would have lost $150.
- 4:07And that's it. Now that we have both the
- 4:08entry and exit rules of the strategy, we
- 4:11can go to GPTs to convert these rules
- 4:13into Python code. Now to use GPT for
- 4:15this purpose, I have made my own
- 4:17specific instructions for algo trading
- 4:19with Python. And to use it, you have two
- 4:21options. One is to use the cloud version
- 4:22that I made. It is called JSGPT and it's
- 4:25free to get started or you can self-host
- 4:27your own version which I described how
- 4:29to do in this video. So if that's what
- 4:32you want to do, for example, if you want
- 4:33to use your own API keys to don't pay me
- 4:36anything or if you have some privacy
- 4:38concerns, then go with this video and
- 4:40self-hosted yourself. Now for this
- 4:41video, I'm going to use Jess GPT because
- 4:43it's just easy for me to get started.
- 4:44Now in Jess GPT, we have options to
- 4:46choose whichever LL model that we want.
- 4:49I'm going to go with GPT5 mini because
- 4:51it's extremely cheap and I find its
- 4:53results to be reliable enough. So, let's
- 4:55choose that. And as for the prompt, I
- 4:57wrote this. Write a strategy that only
- 4:59shorts when the fast EMA 12 is below the
- 5:02slow EMA 26 and the RSI is above 55.
- 5:06Also, make sure ADX is above 20. Enter
- 5:08short positions at market price. Risk
- 5:101.5% of the account per trade. Set a
- 5:13stop loss at entry price plus 1.5 * ATR.
- 5:16Take profit at entry price minus 2.5
- 5:19times the ATR. Don't do any long
- 5:21positions, just short. Let's hit enter.
- 5:25All right. So, it brought it and it
- 5:26named it short EMA RSI ADX. Now, I don't
- 5:30love this name. Right. Inside Jess's
- 5:31dashboard, let's generate a new
- 5:33strategy. And I'm going to call it Trump
- 5:38short. And then inside my cursor editor,
- 5:40or you can use VS Code, which is
- 5:41completely free. It doesn't really
- 5:43matter. So, let's look it up. And there
- 5:45we go. This is the generated code for
- 5:48us. But let's go back to Jess GPT and
- 5:50copy this whole thing and paste it here.
- 5:52Now it should also change the name of
- 5:54this to also be Trump short. Now let's
- 5:58read it. So when it comes to shoot long,
- 6:00it is returning false. So it because
- 6:02this is short only, we don't want it
- 6:03long at all. And then it defined a new
- 6:05property for the MA fast inside it. It
- 6:08defined the period as 12. So this is
- 6:10perfectly correct. And it is simply
- 6:11returning TA. EMA, which is the correct
- 6:13syntax for Jesse to use a moving average
- 6:16exponential. And then it did the same
- 6:18for the EMA slope except with a period
- 6:20of 26. And then for the RSI, we simply
- 6:23said return TA. RSI and then the current
- 6:26candles. And we didn't even specify any
- 6:28period for it. But if we would have like
- 6:30it would have been 14, which is the
- 6:32default value as you can see here. Now
- 6:35for the ADX, we did the same and then
- 6:38the ATR. All right. So perfect. Now,
- 6:40when it comes to shoot short, which is
- 6:42where we define the entry rules of the
- 6:44strategy, we're saying the EMA fast
- 6:47should be below EMA slow. So, in other
- 6:49words, a crossover should happen and the
- 6:51RSI value must be above 55 and the ADX
- 6:54must be above 20. So, this is perfectly
- 6:57correct. And then once all the inter
- 6:59rules are met, we want to do the
- 7:00position sizing, right? We want to take
- 7:02the actual trade and that's where we use
- 7:03the go short function of Jesse. So, we
- 7:05say the entry is the current price sell
- 7:08price, which would be a market order.
- 7:09Now, by the way, Jesse is smart enough
- 7:11to detect the type of order that you
- 7:14want to use. So, when you say I want to
- 7:15use the current price, it knows what you
- 7:17want is a market order. And then you
- 7:19define the suborder. So, the entry plus
- 7:231.5 times of the current ATR which we
- 7:26defined above here, right? So, this is
- 7:29also correct. And then we're saying the
- 7:31quantity is utilisk the quantity utility
- 7:35function of Jesse which basically takes
- 7:37an percentage number that you want to
- 7:39risk per each trade and also your
- 7:41capital. So for the capital we're using
- 7:42the available margin. I could have also
- 7:45used something like the balance but the
- 7:47available margin is actually better. And
- 7:49then the percentage we want to risk is
- 7:511.5. And then it is passing the entry
- 7:54the stop price and then the fee of the
- 7:56current exchange that we're trading. And
- 7:58then it is saying if the quantity is
- 8:00above zero. Now in some strategies this
- 8:03is helpful to do this because sometimes
- 8:06your quantity is going to be zero and
- 8:08that's not a good thing. But I wouldn't
- 8:11do this personally because if that's the
- 8:12case there is something wrong in my
- 8:14calculations and I want to know about
- 8:16that is and I want to actually see an
- 8:18error. So I'm going to remove that. Now
- 8:21everything else is fine. Now to submit
- 8:22the actual sell order we simply say
- 8:25selfell equals quantity and then the
- 8:28entry price. So very simple and then
- 8:30once the position is open that's when we
- 8:32want to submit the takerit and a stop
- 8:34loss right so for that we use the unopen
- 8:37position method of Jesse and in it we're
- 8:39saying if is a short position now
- 8:40because this strategy is short only this
- 8:42will always be true right so let's just
- 8:44remove it to make it simpler and we're
- 8:46saying the SL or the stops price is
- 8:49going to be the entry price of the
- 8:50current position which we can easily
- 8:52take by saying position entry price plus
- 8:561.5 times of the current ATR So this is
- 8:59basically the same thing that we did
- 9:00here. And then we're saying the TP or
- 9:02the takerit equals self.position
- 9:05enterprise minus 2.5 times of the
- 9:08current ATR. So you see if we win we win
- 9:10bigger than when we lose. So in other
- 9:12words, even if we get a win rate of 50%,
- 9:15we're going to be in a profit and then
- 9:17we submit the actual subl. So we're
- 9:19saying the quantity is going to be the
- 9:20quantity of the current position and
- 9:22then the price is going to be the SL
- 9:25which we defined here. And we do the
- 9:26same for the take profit. And it also
- 9:28said the should cancel entry should
- 9:30return true. That this function isn't
- 9:32really needed. It's only needed if you
- 9:34were using a limit or a stop order in
- 9:36order to enter the position. But we're
- 9:38using a market order, so we don't need
- 9:40this. I can even delete it. And it also
- 9:42defined the watch list, which is helpful
- 9:44if you are live trading this strategy.
- 9:46So I could just delete it for now or
- 9:48leave it here. It doesn't really matter.
- 9:49Let's just comment it. And let's go back
- 9:51to Jess's dashboard and go to the back
- 9:53testing page. Let's find the strategy.
- 9:56So, Trump short and set the time frame
- 9:59to hourly and the route to Trump UCT.
- 10:03The exchange is minus perial futures.
- 10:05The duration is the third month of 2025
- 10:08which is basically when the Trump coin
- 10:09came out or a little bit after that
- 10:11until this month which is September and
- 10:14then I enabled fast mode and the
- 10:17benchmark feature. So, let's go and give
- 10:19this a run. Now, it's saying that the
- 10:22strategy is not valid. All right. So you
- 10:24see this is happening because we have
- 10:26the shoot long method but we don't have
- 10:28the golong method. So let's say go long
- 10:32and even though we don't want to do
- 10:35anything we still need to define it. So
- 10:37let's just write the word pass in it and
- 10:39I believe it should work. Now I want to
- 10:42quickly remind you guys about Apex which
- 10:44is my favorite deck allowing you to
- 10:46trade perpetuals without providing any
- 10:48KYC while keeping the custody of your
- 10:50funds. If you sign up via my link, you
- 10:52will get 25% trading fee discounts and
- 10:55you will also be supporting my work. All
- 10:56right, so it is and we made 22%. The
- 11:00draw down is minus 4% which is extremely
- 11:02low. The mirror is 51%. So this is
- 11:05pretty cool. The sharp is 2.55. This is
- 11:07really good. But because the max draw
- 11:09value is very low, it allows me to
- 11:11easily add to the size of my position.
- 11:13So what if I go here and add to the size
- 11:17of the position to be like four times of
- 11:20this and run it again. Now you see I'm
- 11:23making more money but now the max is
- 11:25-6%.
- 11:26But I made 107% instead of like 22%.
- 11:30Which is significantly higher. The mur
- 11:33is of course the same number and the
- 11:34sharp should also be the same which it
- 11:36is and the cam ratio is also really
- 11:38good. It's 19 which is amazing. The
- 11:41average holding time is 16 hours. It's a
- 11:43bit too high, but it's okay. Oh, but I
- 11:46made one mistake. We're not paying
- 11:47trading fees. I guess I have disabled it
- 11:50by mistake. So, let's bring this back to
- 11:53what it is on Binance. It's actually a
- 11:56bit lower on Binance. I believe this is
- 11:58the number, but I'm going to leave it at
- 11:59this to also consider the slippage. So,
- 12:03let's run it one more time. And now,
- 12:05this is the value that we're getting.
- 12:06So, the P&L is slightly lower. The max
- 12:09is minus 70%. So this is still good
- 12:11enough for me and I'm going to accept
- 12:14that. The sharp is still above two which
- 12:15is amazing. Now let me show you one cool
- 12:17feature of Jesse. If I enable the
- 12:19generate interactive charts option and
- 12:22run this one more time
- 12:25and now we have this view charts option
- 12:27here which we can see all the trades
- 12:30that it took. So for instance in here it
- 12:32took the short trade and then it closed
- 12:34it here. Again, it shorted here, but it
- 12:37closed here at the stop- loss. So, this
- 12:39was a losing one. We can also see the
- 12:41list of them here. And if I click here,
- 12:43it will show me the trade that I took.
- 12:45So, it opened it here and closed it
- 12:47here. Again, this was a winning one.
- 12:49Now, let's take a look at the losing
- 12:51one. So, in here, you see it opened it,
- 12:54but it closed it at the stops in here.
- 12:58So, this is pretty cool. And if I open
- 13:00it, I can also see the actual orders
- 13:02that it took. And here I can see the
- 13:05details of it like the actual entry and
- 13:07exit price, the quantity, the P&L that
- 13:10we made or lost and the trading fees
- 13:11that we paid and everything really. So
- 13:14that's really cool. Next, we can do
- 13:16something really cool. We can go and
- 13:17copy the code of the strategy. Go to
- 13:19JGPT and say, hey, this is my code.
- 13:24Add charts to it. All right. Now, let's
- 13:28copy the whole thing. Now we define an
- 13:30after method and inside it it said add
- 13:32line to candle chart which is the
- 13:34correct syntax in JC to add the
- 13:37indicator values into the chart. So we
- 13:40added the values of the moving average.
- 13:42We also gave it a color and a name and
- 13:45it did the same thing for the RSI but we
- 13:48don't need these. So let's also remove
- 13:50those. Now by the way I believe cloth
- 13:52set was doing a better job than the GPT5
- 13:54mini for this because this wrote some
- 13:57extra stuff that I'm not happy with. It
- 13:59also define the ADX and the ATR which we
- 14:02don't need. We also don't need these. So
- 14:06let's remove them. And now if I go back
- 14:08and rerun this one more time and go to
- 14:11the chart, you see now we have some
- 14:14helpful lines. So for example, let's
- 14:16find this trade. You see where it took
- 14:18this. We went short here. The EMA 12,
- 14:22which in here is the orange line, is
- 14:24indeed below the blue line, which is the
- 14:26EMA 26. and the value of the RSI was
- 14:30indeed above the threshold and the value
- 14:32of the ADX was also above the threshold.
- 14:35So this way we can validate the entry
- 14:37rules of the strategy or let's say
- 14:39there's something fishy going on. Let's
- 14:41say you are really suspicious of this
- 14:43loss for whatever reason and you want to
- 14:46see like what was the values right like
- 14:49was the value of the RSI indeed
- 14:51something that it should have taken the
- 14:53trade or not. So, this is really helpful
- 14:56in order to add some more filters to the
- 14:58strategy or to fine-tune it. But be
- 15:00careful when you're doing this to not
- 15:02overfeit the strategy. Now, next, before
- 15:04I leave you guys, you probably know that
- 15:06in one of my previous videos, I released
- 15:09a script to run Monte Carlo simulations.
- 15:11So, let's also run that for this
- 15:14strategy. So, let's go to that script
- 15:16and let's give it the name of the
- 15:19strategy. So, Trump short and the time
- 15:21frame is hourly and the symbol is Trump
- 15:24uses T and it has no data out. And for
- 15:27the simulation config, let's use the
- 15:30number 200. And this is the start and
- 15:33ending date of the back test. And I'm
- 15:35also going to leave all these three
- 15:37true. And now, if I open my terminal, I
- 15:39simply say Python test Monte Carlo.
- 15:44Now I'm getting some errors but it
- 15:46doesn't matter because at the end of the
- 15:48day it executed 136 of them successfully
- 15:52and that is enough for me and there we
- 15:54go. So we are getting some interesting
- 15:56values. So let's begin with this one
- 15:58which shows me the equity curve path
- 16:00that the strategy took not just for the
- 16:03original back test which is this green
- 16:04line here but also for the simulations
- 16:07which are these blue lines here. As you
- 16:09can see, there were many cases where the
- 16:12max rodon could have been worse than
- 16:14what we actually took. So what this is
- 16:16telling me is that even though the max
- 16:18rodon of the original back test is -7%
- 16:21in let's say the median of the data it
- 16:24is - 33%.
- 16:26So basically if let's say I was just
- 16:30okay with minus 17% maxon I probably
- 16:33wouldn't want to go live with this. I
- 16:35want to reduce the size of my position.
- 16:37So remember when we did this we
- 16:40multiplied our quantity by four. So if I
- 16:43was only okay with let's say minus 15 or
- 16:4517%. I should have come here and
- 16:48multiplied it by two instead of four. So
- 16:50but in reality I am okay with minus 30%.
- 16:53So I'm going to leave it at this. Now we
- 16:55also have another type of Monte Carlo
- 16:57Jesse and that is to shuffle the
- 16:59candles. So we add some noise or things
- 17:02like that. In other words, you can say
- 17:03we want to stress test the result of
- 17:05this strategy so that we don't just rely
- 17:08on the back test. So if I do that, I get
- 17:10this table here and you see the sharp of
- 17:13the original back test is 2.21, but on
- 17:16the median it is 0.61, which isn't
- 17:18really great, but it's still positive.
- 17:20So yeah, I could take this strategy
- 17:22live. But also the sharp of the original
- 17:25is less than the best 5%. So in the best
- 17:285% it was 2.92, but this one is giving
- 17:31me 2.21. 21 which is lower than this. So
- 17:34that is another sign that it is good
- 17:36enough for me to go live. Now of course
- 17:38this is all just my opinion like how you
- 17:40read the Monteol simulations is a bit
- 17:43personal. So I know a lot of you will
- 17:46disagree with me and I'm going to leave
- 17:47it with you. But to me I consider this
- 17:50good enough to go live. And now let's
- 17:52take a look at the chart. So you see
- 17:54this is the original back test. These
- 17:56are the values that would have been even
- 17:58better. So you would have made more
- 18:00money. And these are the values that we
- 18:02would have done worse. Now before I
- 18:04leave you, I want to show you one thing.
- 18:06Now you see this orange line here. It is
- 18:08the result of the Trump coin itself. So
- 18:10what if we just bought and hold it,
- 18:12right? So this is that and except in
- 18:15here it was almost always going down. So
- 18:17what I want to say is this that this
- 18:19strategy is clearly working. But that
- 18:22may be just because the coin's price
- 18:25have been going down, right? I mean sure
- 18:27in here when the price had a surge we
- 18:30didn't lose that much right so the
- 18:32strategy was considering this scenario
- 18:34and that is good but if let's say
- 18:36tomorrow there's going to be huge
- 18:38uptrend for this coin you don't want to
- 18:40keep trading it but on the other hand
- 18:42what I believe would happen is that
- 18:44after this bull market which we are in
- 18:46right now is over we're going to have a
- 18:48bearish market and a ranging market and
- 18:50what I believe will happen for a meme
- 18:52coin like this one which is completely
- 18:54worthless is that the price of it should
- 18:56continue to go down. But because this is
- 18:58Mr. Trump's coin and many people want to
- 19:01suck up to him or whatever, this coin
- 19:03was added to all the major exchanges. So
- 19:06that means if you want to trade this,
- 19:08there's going to be liquidity for it.
- 19:09And that's all that we care about,
- 19:11right? If there's enough liquidity and
- 19:13there's a pattern we can take advantage
- 19:14of, we're going to trade it. And it
- 19:16doesn't necessarily have to be a long
- 19:18position, it could be shorting
- 19:19positions. And that's exactly what we're
- 19:21doing here. Now I am going to add the
- 19:23result of the strategy to our strategy
- 19:25index where you can see the result of it
- 19:27for other symbols, time frames or time
- 19:29periods. But in this case it doesn't
- 19:32really matter because this was supposed
- 19:34to short memecoin. So the result of it
- 19:36for BTC or ETH definitely won't matter
- 19:38and it won't be good for sure. And our
- 19:41strategy index page doesn't support meme
- 19:43coins yet. But still I am going to add
- 19:46it here. So if you guys want to just
- 19:48copy the code, you can do that very
- 19:50easily here. And if you want to check
- 19:51out my other strategies, make sure to do
- 19:54so and use them as you like. And the
- 19:56giveaways are back. So, a random
- 19:58subscriber who likes the video and post
- 20:00a comment is going to win 1 million bunk
- 20:02token. The last video that I did was a
- 20:04release video and it wasn't supposed to
- 20:05have a giveaway. But the guys who did
- 20:07comment are the ones who always support
- 20:09me no matter what. And I really
- 20:11appreciate you guys. So, I'm going to
- 20:12pick a winner anyways.
- 20:14And the winner is this user. and I'm
- 20:16really glad that it's him because he's
- 20:18been one of the most supportive members
- 20:20of our community. Thank you so much for
- 20:22your comment. Please reach out to me so
- 20:23I can send you your tokens. Thank you so
- 20:25much for watching. I'll see you in the
- 20:27next one.
- 20:28[Music]
- 20:31[Applause]
- 20:32[Music]
About this transcript
This page contains the full transcript of Shorting meme coin strategy in Python makes 86% by Algo-trading with Saleh, generated from the public captions YouTube serves with the video. The transcript has 4,138 words across 543 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.