LongCut logo

Using Math to Design AI Trading Strategy from $0 to $10k/Month (Advanced Guide)

By Trade Tactics

Summary

## Key takeaways - **Overnight Claude Optimization**: Claude Opus created and optimized a momentum squeeze strategy overnight while I slept, starting from 38% net drawdown and reaching 27% in-sample with 0.86 Sharpe out-of-sample. [00:23], [00:44] - **Local VectorBT Backtesting**: Custom local vectorbt engine runs thousands of backtests per second, unlike slow TradingView servers, enabling rapid strategy optimization. [04:47], [05:03] - **Prioritize Sharpe Over Profit**: Don't maximize net profit alone; focus on minimizing net drawdown and achieving high Sharpe ratio like 0.86, as profit follows good risk-adjusted returns. [05:30], [05:46] - **In-Sample Out-of-Sample Split**: Use 60% data for training and 40% reserved for out-of-sample verification to avoid bias and ensure performance on unseen data. [04:02], [04:18] - **Monte Carlo Stress Tests**: Monte Carlo simulations randomize data repeatedly; strategy must consistently pass majority of thousands of bootstrap runs, even worst 5%. [03:20], [08:42] - **Five-Phase Iteration Process**: Claude follows five phases: backbone momentum squeeze, verify directional filters, add chop filters, create exit rules, iterating unattended to improve risk management. [01:32], [01:43]

Topics Covered

  • AI Optimizes Trading Strategy Overnight
  • Monte Carlo Survives Worst Simulations
  • Prioritize Out-of-Sample Testing
  • Target Sharpe Ratio Near 1 Minimizes Drawdown
  • Live Signals via SignalSwap Marketplace

Full Transcript

This is the dashboard that I had Claude Opus create me to show you guys the strategy that I made overnight. I went

to bed and it worked straight for eight hours and it did not use that many tokens because the engine that it's using is local. So, it launches it goes Claude goes to sleep and then it starts

its work and it creates and optimized this strategy. Here is the parameter

this strategy. Here is the parameter set. It's a momentum squeeze indicator

set. It's a momentum squeeze indicator with several layers including trade exit rules and it to get to this point we started way back. We started with 38%

net draw down and we got down all the way to 27% in sample and in out of sample is able to achieve around 14% net draw down with 0.86

sharp ratio which is almost a sharp ratio of one which is ideally my target and it did that only in one evening. So,

if you're not subscribed to the Trade Tactics YouTube channel yet, then what are you doing? Hit the subscribe button and the like button. And if you comment down below, I will respond to your comments. If you comment in the first

comments. If you comment in the first couple days of posting the video, I'll respond to any question that you have about my systems, how to set this up for yourself, where to find my strategies,

or anything else like that. So, if I go over to my Claude Opus, what I have here, this is my my setup. So I have four different dashboards and I can show

you how they they look here. It went

through these one by one overnight and I have a fivephase approach overnight. So

this is kind of my system prompt here.

So I have a backbone that it starts with. So it started with that momentum

with. So it started with that momentum squeeze. It moved on to fa phase two and

squeeze. It moved on to fa phase two and it wanted to verify the directional filters and then phase three it can create new flat filters like chop indexes, things like that rule out bad

trades. Then it looks for the exit rules

trades. Then it looks for the exit rules and it keeps going. It'll scrap them and create new ones. I have on my machine now probably 50 or 60 different totally

custom indicators that it built overnight entirely unattended. So yes, I it it's telling me here what's in the prompt, but I literally go to sleep and wake up with a fully optimized strategy.

I'm not kidding here. So how I built this trade engine that I have running locally, it's using a custom version of vectorbt. Now vectorbt you can just ask

vectorbt. Now vectorbt you can just ask claude. So if you haven't installed

claude. So if you haven't installed claude, you would just download Visual Studio Code, which is just at code.vvisisualstudio.com.

code.vvisisualstudio.com.

Just hit the download button for your machine. And then if you go to the

machine. And then if you go to the Claude Code documentation, all you need to do is use the install commands right here. So super easy to follow. It really

here. So super easy to follow. It really

is just just installing Claude and then when you run it runs right in your command line. So instead of having to

command line. So instead of having to act like a hacker and type all these super hard to remember commands, you can just talk to Claude in your natur in just natural language. So if you haven't

experimented with it, I highly recommend trying it. It's extremely powerful. I

trying it. It's extremely powerful. I

mean it was able easily to build me this dashboard here where I can show you all of the trades and the different simulations here. These are the meat and

simulations here. These are the meat and potatoes of the stress test. So the the original training data here, this is the full data frame for Solano, the 1 hour chart here in the top right or the top

left corner. You can see Solana, you can

left corner. You can see Solana, you can see the parameters here. You can see some of the results there, but it's better displayed in my table here. And

what you have on the right hand side, this is just a demonstration of the Monte Carlos simulation. So for example, it will take this this sample of data and it'll make similar data and then

it'll randomize it again and again and again. And if your strategy can

again. And if your strategy can consistently perform in these simulations, the machine counts it as a pass. Now Claude doesn't know any of

pass. Now Claude doesn't know any of this, right? I have my own engine. You

this, right? I have my own engine. You

have to use a system just like VectorBT.

You have to ask your claude to design you a a vector BT strategy or an engine that downloads price data. What I'm

doing here number one is acquire the data. You have to reach out through an

data. You have to reach out through an API to the exchange. It's free to do.

Download the price data and then you start splicing it up. So you can do 60% of the data you reserve for training your system. And then 40% is

your system. And then 40% is verification or you could do 70 30 different splits like that. And then you start once once you ac once you find good parameters that work on the training data then you can verify with

the testing data. Does it still perform on the testing data or not? And you only want to show the out of sample testing data. you know, once you're happy with a

data. you know, once you're happy with a configuration because there's no cheating or peaking involved that would invoke bias. Now, with a normal trader,

invoke bias. Now, with a normal trader, let's say you open your trading view and you have a strategy and you do not want to be the kind of person who opens up

their their strategy and starts doing deep back tests like let's say the entire history. We optimize our report.

entire history. We optimize our report.

Notice how Trading View takes painfully long here and on our local system it does thousands of back tests per second.

So you don't have to wait for Trading View servers to so basically you know you can you can convert your strategy into Pinecript and run your signals through their servers which is reliable.

That's what I do. But here if I were just to optimize on the entire data set here you see how it took 10 seconds where as you know my back testing engine here will do thousands of back tests per

second. uh just as a as kind of another

second. uh just as a as kind of another pro. Uh even though Training View has

pro. Uh even though Training View has some cons, it does have its pros, too.

Like it will send web hooks 24/7 no matter what cuz they have servers for it. The thing is this is cheating if you

it. The thing is this is cheating if you just train on all the data at once or try to maximize the net profit. Don't be

the person who just tries to maximize net profit only. You want to minimize net draw down on it. So this is an example of exactly what not to do because if that net profit looks really high, what's the sharp ratio at? Right?

Scroll down here. So let's let's look at some of the other metrics, right? Don't

get ahead of yourself and compare to the buy and hold and then yeah, your net profit as a result of having a sharp ratio of, for example, like 0.86, your net profit will be good just as a

result. But if you're putting real money

result. But if you're putting real money on the line, you want your net uh your max draw down to be really low because that's your risk, right? And Sharp does take into risk uh risk as well. And

Certino as well. Certino ratio is really good, too. So these numbers here match

good, too. So these numbers here match Trading View's math, but I have other strategies here. So I'm just flipping

strategies here. So I'm just flipping back and forth just to show you kind of 40 4% win rate. This one has 48% win rate. So different vari Let's just flip

rate. So different vari Let's just flip back here for one second. This was on the wrong one. So we're going on the the training data. We have a 43% win rate.

training data. We have a 43% win rate.

This one is 48% win rate. So you know that's one of the metrics to compare in the in sample data. 0 59 sharp ratio.56.

Of course, sharp is such a good metric, right, to maximize for and 27% draw down. 27% draw down. You can see here

down. 27% draw down. You can see here the parameters are changing. It has

different rules because Claude used the engine and it modified what it was putting the math that it was putting into it and it found that this configuration on net was better with these parameters. So, it has different

these parameters. So, it has different thresholds for the exits, the exit rules as well. This one doesn't have as many.

as well. This one doesn't have as many.

And then if I go back further, we have even more variations. Now, all of these were in one night. I was sleeping while this was happening. I'm not lying to you. I was asleep and it generated all

you. I was asleep and it generated all of these. So, we started out with this

of these. So, we started out with this really terrible version. 418 net profit with 38% net draw down. Sharp ratio is only43. And we came up to sharp ratio

only43. And we came up to sharp ratio 0.59 with net profit is 619. So far

better on every single metric. Net draw

down came down. And it's because I told it to. I told it to iterate this way

it to. I told it to iterate this way progressively overnight with no input from me cuz I was asleep. And again,

this didn't blow out my claw tokens because yes, it has to develop the trading rules. It has to develop the

trading rules. It has to develop the actual trading math, the computation, the algorithm that it's trading with, right? It's not just a simple EMA. This

right? It's not just a simple EMA. This

is far more complicated momentum squeeze and then we're having all the different filters in it. And we're we're not contaminating our data. All of these are separate tests for separate validation.

So as it progressed, it found that there was certain ones that would add benefits and then there was drawbacks to some of them. So it wants to find the best of

them. So it wants to find the best of all worlds. And that's how that's how I

all worlds. And that's how that's how I prompted it. So the the again the key

prompted it. So the the again the key takeaway is that each layer that it adds to the system has to improve the the risk management. It can't we're not just

risk management. It can't we're not just adding all of these for nothing. every

single parameter is configured to be the safest and more broad and generalized.

It's not hyperfixed or hyper tuned or curve fitted for any specific data set.

Again, we have all of our different data sets here, the different bootstrap data frames. And I didn't just make six

frames. And I didn't just make six bootstrap data frames. There was

thousands and it runs them all and it has to pass in a certain majority of them. Now, in the worst simulations, for

them. Now, in the worst simulations, for example, if I scroll down to the detailed metrics, the here's the bootstrap training metrics. the worst

performers like the worst 5%. We can see that, right? So, we can see the the pass

that, right? So, we can see the the pass rate, we can see the fail rate, we can see the runup in involved as well. And

all of these metrics, it's it's choosing its parameters. The way that it got to

its parameters. The way that it got to these final parameters is not just so straightforward as picking the best the best one for one metric. It has to be balanced across the board and perform well in all different versions of

history, all of these different variations. And then I have the final

variations. And then I have the final out of sample data here that it also has to perform in. If it doesn't perform in here, it throws in the garbage. Now any

of these the the way we got to sharp 0.86, which again, if I kept going with this, I could probably get over sharp one, right? This was just one evening

one, right? This was just one evening that I iterated. So if I kept if I just focused on net profit alone, you know, if I didn't focus on how much divergence is there between the the insample data,

which is this here, and if I scroll down to the out of sample data, how much divergence is here, right? If I didn't focus on that, most people don't even care because in real time that also

counts as out of sample data. And here's

the out of sample data. And you want it to per perform well in data that you specifically withheld that you didn't show your algorithm until later because

you're showing it new unseen stress that it has to re uh respondse to. And in

real time when when data goes forward in real time, if you hook this up to real real money, real signals on a real exchange, which by the way you can do by going to signal swap.io, you can connect

your signals for free as well. You can

connect Bybit, AEX Pro, Pinex as well.

All three of these work and we are currently in alpha testing. So you can just come to the website. A lot of people were trying to uh register for the alpha testing. So I opened up the website. There's no password to access

website. There's no password to access the website. just come create an

the website. just come create an account, go to the dashboard here, and you'll be able to see all of your the bots that you create. It's really easy to set up bots, and it's really easy to

manage them live. So, you can just click on a bot once you've created it here.

You can see the live data feed here, and you can see, you know, all of your back testing results and the trade history as well. So, if there's any errors or

well. So, if there's any errors or anything like that, let me know in the Discord, come through the Discord link is down in the description. And you can publish it to the marketplace if it meets certain criteria. And we only show on the marketplace spots that are

performing in real time. There's no um fake fake way to back test it. We do

have stress tests like we have a back testing machine just like I'm showing you in this video. And you can just drop drag and drop and it will optimize it for you. It'll pick the best parameters

for you. It'll pick the best parameters and it'll tell you if it passes the stress test. For example, you could show

stress test. For example, you could show your full history here whether it's robust or not. And if it is robust, you can take it onto your bot on the marketplace that we have. So really cool system. All of the data is live

system. All of the data is live performance data. So the graph you see

performance data. So the graph you see here is the the signals that we received and there's encryption. So your keys are safe and there will be there's a back testing tab here. You can attach any

back test and you can publish and keep the vast majority of your trading uh revenue that comes through the website for subscriptions to your trading bot.

So you have a really good trading bot.

You can upload it to the marketplace.

You do not have to attach back testing as well, but it does go a long way to have a little badge there that shows that you stress test it to proves that the parameters actually do what they say that they're doing. And you know, the live the live trading is good, but with

stress test, it's even better for building trust. And it's really easy to

building trust. And it's really easy to just create your bot here. I'll go over to the bot tab. You just hit a bot name, select your exchange from the drop-own menu, Apex, Pinex, or Bybit. Choose your

trading pair from the drop down. And

then you can optionally upload back test results there from the other screen I was just on. And once you select uh once you select it, let's just fill this in really quick. Once you pick your pair,

really quick. Once you pick your pair, you can just fill in the amount that you want to trade, flat order size, percent of equity, you can set leverage, uh the type of leverage, market or limit order, stop loss or take profit as well. And

once you do all of that, you can connect it really easy to the uh your Trading View integration. So web hook URL alert

View integration. So web hook URL alert message. So basically these are just

message. So basically these are just generated for yourself. Keep these

private for yourself. Just copy that web hook URL and copy the alert message.

Once you're in Trading View, just create that alert. Really easy to do. You can

that alert. Really easy to do. You can

select your strategy once you configure it and and paste the alert message into this box here. Give it a nice name. And

then for the notifications, just paste the web hook URL into this box here and click create. And it will be live once

click create. And it will be live once you click the confirm button and deploying the bot. It will show up for you in the dashboard right here, centralized. So, you can just scroll

centralized. So, you can just scroll through all of your bots. Click it and manage it right there. You can hit pause. You can publish it to the

pause. You can publish it to the marketplace if it's performing. You can

keep an eye on the signals and how it's doing with the graphs as well in the metrics tab right here in this test bot.

So, really, it's free to join, free to use. And yes, back testing is paid, but

use. And yes, back testing is paid, but it obviously uses servers. So, that will be up in the following week. just

figuring out the finalizing the servers for it. But the system is technically

for it. But the system is technically working just has to be uh finalized for you guys. So it is an alpha testing just

you guys. So it is an alpha testing just a note but yeah signal swap.io and that's going to be the video I will do more in-depth instructional showing

you live how to install vectorbt and how to get vectorbt running so it can build stress test systems just like this one.

I'm probably going to convert over to Pine Script and then hook up to my own uh Signal Swap signal. So, I will I will probably be publishing this on a single

swap marketplace. I have my Wolfpack

swap marketplace. I have my Wolfpack Elitebot 2, which my bot uh you can find my bots down in the description of the video as well. But, hit the subscribe button, like the video pushes it further

in the algorithm. I really appreciate it. And I'll be responding to comments.

it. And I'll be responding to comments.

Any comment you have down below for the next little while, I will be responding.

if you're uh new to the channel.

Loading...

Loading video analysis...