Handling a Trading Mistake

Michael:

Alright, everyone. Welcome to another episode of Line Your Own Pockets. We got an interesting one today. As always, these are some of my favorite episodes when something comes up on the fly, we're talking to a listener, a client of ours, something. And, this was one this week in our our Slack that Dave was like, I already know what we're gonna talk about.

Michael:

I think this is gonna be great. I'm excited for this topic, and it just kinda came up this week. So on the fly episode, absolutely love it. Dave, why don't you tell us what, what your client was talking about?

Dave:

Yeah. So one of the traders that, been coaching for some time, had an issue this week, and I talked it through with him. And I was like, man, this is such a good thing that happened that I know a lot of people can learn from it. So I asked him, is it is it okay if I share it on the podcast? He's like, totally.

Dave:

Mhmm. So his name is Fineth. I've been coaching him for some time. I I love Fyneth because he is so driven to succeed at trading

Michael:

Good.

Dave:

That it's it's just so much fun for me. I always have to think of, you know, a couple steps ahead, like, where he's gonna be in a month or so to kinda plan ahead because he's just I love working with people like that that, you know, maybe they're not trading for a living or maybe they are. Mhmm. But whatever the reason, they have to trade, and they have to trade well. So they're obsessed with it.

Dave:

And Good. It's really fun working with people like that.

Michael:

Oh, that's my favorite too. Right? The the the worst is the, you know, hand it to me, make, you know, make me a bunch of money, and the best is the, right, I've I've got this drive. I wanna learn. I wanna, you know, asking questions all the time.

Michael:

Right? Very, very excited to get going. Because you know those people are gonna be around for a while for sure.

Dave:

Yeah. And, you know, they have an expectation about how difficult it's gonna be. So they have reasonable expectations, and, they're ready to dive in. And and, they're gonna be successful no matter what. So here's the situation that came up with him.

Dave:

So he's gone through my entire process where I've, you know, he knows how to do the optimizations. He knows how to come up with strategies quickly. He can go from an idea to a back test to optimizing it really fast now. So, you know, probably a couple months ago, he had one strategy. Now he's got 3.

Dave:

And the other day, he came up with another one. So over the weekend, a 4th strategy he's got. So things are going great for him. You know, he's making money. He's super excited.

Dave:

Right? So he's got this other strategy. He he works on it over the weekend. He gets it live. It was just this past Monday.

Dave:

Monday morning comes, this is the first time this new strategy is in place in addition to his other three strategies.

Michael:

And that's almost like Christmas, isn't it, sometimes? When you're about to launch a new, you you they just had this brilliant idea. You sat down. You've done all the work. It it's actually because most times you have the idea, you do the work, it doesn't test out, but everything's kinda gone through all the thought process, and and you're pumped and ready to go at that point.

Dave:

Yeah. So here's what happened, shortly after the open for this strategy. For turns out it's a coding bug, but in this one strategy, it took position sizes 5 times what he had designed it for.

Michael:

K.

Dave:

So I think this is something that no matter if you're a discretionary trader or an automated trader, you've been in this situation.

Michael:

Mhmm.

Dave:

You've act for whatever reason, you accidentally have a position size that's way bigger than you planned.

Michael:

Yep.

Dave:

So, Michael, I'm sure you've been in this situation. Absolutely. What what would you what happens? What do you think what do you think you did?

Michael:

Well, I I've I've done it a lot. So I'll first go new trader me, and then I'll go the trader that learned. Because I actually have a Story about this and actually happened at the prop firm and I think the worst possible thing happened to me in which it worked out really well And I think that's super dangerous so for me was just punching an extra 0 this is back I was, you know, using the keyboard to enter and exit, right, bringing up your level 2 and and and all this. And I just I punched an extra 0. So I was looking to buy a $1,000 of the stock, and I bought, $10,000 of the stock and maxed out all my buying power, and then just complete deer in the headlights.

Michael:

And by the time I figured out what was happening, and this is, again, trading very, very fast before the computerization of the market, it did great. Right? I punched it, and the thing went up, like, 50ยข just right away, and it was amazing. I think that was the worst thing because it just cements that bad habit of, a, I was just like, well, I'm not a 1,000 share trader anymore. I'm 10,000 trader.

Michael:

Right? And then you start trading like that. And then the other thing is it just teaches you the the bad habit. Now I have a rule. Now after I've done that a couple times and it didn't work out so well, which is, you know, you never trade a mistake.

Michael:

The mistake pops up. You you kill it. You move. You just completely wipe it out, and then you try to figure out what happened. Maybe you still like the stock and you want to buy with the original side or something, but I I just hit the flatten button now, but the that first couple times, right, you just go, ah, let's see what happens.

Michael:

Maybe it'll be great. Yeah.

Dave:

So that's exactly what he did. Right? Yeah. And and you can understand the mindset. Right?

Dave:

Yeah. So it's funny because I just had a conversation with him the previous week. He's like, Dave, I'm ready I'm ready to trade this. The system is working well. I'm making money.

Dave:

Like, just imagine how much I could make if I bumped up my size a lot now. Mhmm. And I'm like, well, you wanna do that slowly. We could do we're gonna do a whole episode on the the psychology of that. Mhmm.

Dave:

But it's important to do it slowly. So I'd already talked him down a bit. And it's so so he he let it ride. And because he knows he has an edge. Right?

Dave:

Yeah. You know you have an edge. So it's not the worst mistake in the world, but

Michael:

It wasn't a gamble. He didn't just

Dave:

It wasn't a gamble. Right.

Michael:

Right.

Dave:

Yeah. That's a good way to put it. Right. But what happens was, of course, he took a loss on those trades. Right?

Dave:

A perfectly normally sized or, you know, normal losses if the sizes were normal. Yeah. So what's so dangerous about this? And you you you you hit the nail right on the head. The most dangerous thing would have been for this to work out and for this to have been profitable for him.

Michael:

Yep.

Dave:

Totally, absolutely the worst possible thing that can happen. Right? Because it puts you in a position where you're overconfident. Next time it happens, you're like, hey. Well, I remember what happened last time.

Dave:

I for all the reasons you said Mhmm. That's a very dangerous situation that you may not understand until you've experienced it, and then you know.

Michael:

Well and it's like, like, anytime that you do something dumb and ends up working out for yourself. There's just something happens and your brain goes, oh, it it's it's fantastic. Like, the biggest thing that I can think of is when people start averaging down, without a plan into shitty positions. Right? They bought a stock at 10.

Michael:

News came out and it drops to, like, 8 instantly. They go, I'll just buy more. Right? And then all of a sudden, at the end of the day, it's 5, and you've kinda completely wiped out. The problem with that is because most of the time doing that will work.

Michael:

Right? A lot of the times, you buy, you know, you buy the thing at 10, it drops to 8. You buy a little bit more, it it comes back up to 9. You scratch the trade. You go, okay.

Michael:

And that's the same kind of thing. It just installs that bad habit, a little bit. And then the more you do it, the deeper it will install that bad habit until all of a sudden you think that that's the way to trade, and you're just completely gone from what your original strategy plan whatever is. So, it's almost you know, I I hate to say it because I know he's gonna be listening, but it's good that you lost money, I think, for the when this happened the first time.

Dave:

Totally. And he he gets that totally, you know, after we went over it. And and so there's a couple different ways to think about this. One is if you know that if you make money in this situation, that's the worst outcome Mhmm. There's really no other choice but to flatten these positions and wait until next time.

Dave:

Fix the bug. Wait until next time. Now there's really no value in even if these things even if these things, turn out very profitable, that's still in the grand scheme of things, it's not gonna be very helpful. Like, you you want these to have happened because of the system that you have designed. And if you do if you if there's an accident or an error and you make money from it, that's not the way it was designed, and that's not ultimately good.

Dave:

Not gonna be very valuable.

Michael:

Now and this is just kind of a question to you. So for me, it's it's what you just said. It's pure liquidations. You hit the flat button. You go, okay.

Michael:

You take it take a breath. You go, okay. What happened? Now there is and there's probably gonna be some questions, and I just want your take on this. What about reducing that size to what it should be?

Michael:

So you said 5 times bigger. So let let's say the math was simple. Let's say buy bought 5,000 shares, should have bought a, it should have bought, a 1,000. Does it make sense to go, I'm just gonna correct the position sizes and move on, or do you think it's just mentally better just to wipe the deck, kinda come back tomorrow?

Dave:

It's it's so tempting to do exactly what you just said. You I'm I'm glad you brought that up because that was my next point. It's so tempting to do that. But oftentimes, correcting those positions, oftentimes, you will make it worse. Think about the mindset you're in.

Dave:

You're kind of you're really frustrated with yourself. You made this mistake. Whether you added a 0, whether you had this coding error, whatever it was, you have made a mistake. So and you're already like, oh my gosh. This position is moving way more than I've ever seen before.

Dave:

Yep. That's a whole different mindset. So you're already primed to make an even worse mistake. And I've you know, it's so easy to make this bad position even way worse. So that's why the only real way to improve and the real professional way to respond to the situation, flatten the position.

Dave:

Yep. Take as many notes as you can about why this happened, and think about this after hours to figure out how you can improve your process so that this doesn't happen again.

Michael:

And I think that's huge because that's, it's the difference between mathematics and and psychological and and making sure that you're kind of squaring those 2 because mathematically you reduce position size and then everything's fine, but you're right you're already, you know, if you haven't had your coffee that's that morning. If a bunch of positions come in 5 times bigger than you thought, you're you're up. So your your your nervous system is just firing. Your your adrenaline's through the roof. You're you're now trying you're in that mode that we're all trying as systematic traders to avoid, which is, right, that animalistic.

Michael:

Right? I'm I'm no longer thinking clearly. I'm no longer a intelligent rational human being. I'm just right back to a monkey or a lizard hidden button. So, that's why, again, that's why my rule has always been that.

Michael:

It's just get me out. Right? Shut it down. Take a deep breath. Figure out what happened.

Michael:

And then and then kinda move on the next day after I've had a walk around and, right, resetting that. And I think that's huge for for people, and it's probably, you know, what we're gonna talk when we talk about scaling up position sizes. The second that that kind of mode flips in your brain where you can call it on tilt, you can call it whatever you want, but you're just super amped up, then there's no there's no getting through to you. There's no rational kind of thought. So I I agree with you that it's just best just to to clear it.

Michael:

Right? Bring the adrenaline back down. You know, rational minds prevail and then kinda go from there.

Dave:

Yeah. And, also, you're really primed in that situation to, really, truly understand what the problem is. Mhmm. So we'll we'll go over it in, so I wanna go into detail detail more about that in a second, but I I wanna mention one more thing about the mindset. Even before any of this happened, and it was another good takeaway that I've I've, talked to him about and I've shared with the other traders, our coach, When you are very enthusiastic about your trading, you're very excited about it, that should be a red flag.

Dave:

Mhmm. You should be thinking, okay, what am I missing? What am I not thinking about? Why am I this enthusiastic? You're just primed to make mistakes when you're that enthusiastic.

Dave:

Or and you're also primed to be disappointed when things don't work out up

Michael:

to

Dave:

your expectations. So when you have this, you know, when you see that awesome equity curve, you think there's there's so much room there. Even if you make some mistakes, you're still gonna make money just because of the equity curve. I mean, there's lots of things that go through your mind. It's still good to take a step back and figure out, can I can I ease it?

Dave:

Can I put my toe in the water here? I don't need to be the elephant jumping in the pool here. Well and, yeah, I think a lot

Michael:

of people control for the that negative emotion, and a lot of people focus on that. And they say, oh, you know, I don't get, too down. You know, what do I do when I'm in a drawdown? What do I do when, you know, things aren't going my way? And kinda like you touched on, I think the opposite is as important, if not more important, where it is, what do I do when everything's going great?

Michael:

Right? What do I do when I I feel amazing? And I think for my kind of trading and for my group of traders, it's even more important. And just we've just been talking about this, this recently where, you know, the market was just going up every day. We're hitting new all time highs.

Michael:

Everything was fantastic. And and just to date the episode a little bit, we had this FOMC meeting. The whole market tanks 2%. And every everybody's already all of a sudden very, very upset. And it was the same thing.

Michael:

They were they were weren't checking their emotions as things were going. And all of a sudden, they thought, right, oh, I figured it out. I'm a genius. And then you get kinda slapped there. Whereas if the whole time I'm writing, in these messages, I'm saying, hey.

Michael:

Everything's great right now. It's not gonna be like this forever. Right? And I think that's just the difference between experiences. You try not to get too high, and you try not to get too low, and you try to keep yourself in kind of a a middle band of emotions that are that are more even.

Michael:

And it makes us kinda feel robotic, but you still pat yourself in the back a little bit when things are going well. But you know the other shoe's coming.

Dave:

Yeah. For sure. So, let me talk about what's happened since then and the ramifications of this. So, I think Tuesday, Wednesday, he had, like, normal losing days for the system. Mhmm.

Dave:

So totally normal. VASA's corrected. The whole thing was corrected. But he has, a couple days that were down. So he's still well above I mean, he's still making money.

Dave:

Right?

Michael:

Mhmm.

Dave:

But he's got this dip in his equity curve.

Michael:

Those always suck.

Dave:

And it seems like these days kinda come in batches, right, where just the timing works out in the worst possible way.

Michael:

Mhmm.

Dave:

And that sort of snowballs the psychology of, of the situation. So it's it's funny how, yeah, this was a a one thing that happened, you know, in probably a 5 minute period that has these ramifications, for the later days because of it. So and that stuff will that sit in your memory. You'll stew over it. So it's Yeah.

Dave:

It's good to think about these and, you know, come up with a plan for handling them.

Michael:

And that that equity curve dip, especially the sharp ones, they suck. But, I always just try to remind myself, you zoom that equity curve out enough, and hopefully, it it doesn't look like a dip. Right? So load up, the S and P 500 on a log kinda chart, and then you look at all the crashes way back in, like, 1987 that looked like the end of the world, and they're just little blips. And it's the same thing that you're hoping for your equity curve that, you know, you're gonna zoom out

Dave:

a a

Michael:

couple years from now, and then hopefully, you won't even see that little blip. But, yeah, in the moment, it just absolutely sucks. And those are the moments I think that separate bad traders from good traders. I think those those exact moments of the the people who go, I have to get it back. Right?

Michael:

And they're they they do something even more dumb or or size up or something to get that position back. And then there's the people go, I just gotta continue. I gotta fix the bug. I gotta follow my plan. And and just understand it's going to take some time to get that equity curve to new highs.

Michael:

But, again, hopefully, you zoom out couple years, and you're not even you're not even seeing the the the dip anymore.

Dave:

For sure. Yep. So let's go into some details now about exactly what the bug was Sure. Because I think that's pretty interesting too, certainly for the developers and the and the listener base here. So he he has a setup where he trades with Amabroker.

Dave:

So if you know anything about Amabroker, it's, you know, it's a local database. You feed that through IQFeed or some of the real time data feed.

Michael:

Mhmm.

Dave:

And you can write code to, process VARs, send trades to interactive brokers. He also has trade ideas, which is so there's a really novel way that I use trade ideas and Amibroker in this situation. Trade ideas is perfect for filtering the entire market down to a small list.

Michael:

Mhmm.

Dave:

And Amibroker's great for taking that list and doing whatever you want with it, whatever strategy you you wanna do with it. And those that that combination works really well because Amibroker, if if you're trading it with a if you're trading a strategy that's, real time enough, you're not gonna be able to churn through all the data required every time to be able to trade it with in a real time enough fashion that makes sense. So the combination of both of these works really well.

Michael:

So just just to tap on that for the audience. So you use use something like, trade ideas because it has very good filtering qualities. And then you say, okay, instead of 6,000 stocks, these are the 20, 30, 100 or whatever I want you to look at. And then that allows Amnabroker to be able to crunch those numbers much quicker because as opposed to crunching everything, it's only crunching a small list. Right?

Dave:

Right. So, and with trade ideas, you can and there's a little bit of tinkering there to get the universe of symbols that you ultimately Amitybroker is gonna process. Mhmm. And, you know, the I'm talking about Amitybroker here, but you a lot of people use Python in the exact same way. So if you were to if you whatever software you're using and you're processing it locally, it's gonna take a long time just to crunch through all those numbers, certainly if you're using intraday data.

Dave:

So the combination of trade ideas with Python or Amibroker is really, really great and makes a very, very efficient workflow. So the problem here, in Amibroker, you can set up explorations for each strategy. And that's how you would set it up to, and, ultimately, in that code, you would be sending it to Interactive Brokers. So that so he has a full automated system using this. Okay.

Dave:

As part of each one of those explorations, each one of those strategies, there are parameters that you can use. And if you design your code thoughtfully, you have parameters in there so you don't have to like, when you size up or, you know, change your position size Mhmm. You're not changing the code. You're just changing a parameter. Yep.

Dave:

And when you design it that way, it makes it a a much cleaner process. It turns out, and I've discovered this several years ago, and he just ran into the same issues, where if you have your parameters with the same name across strategies, so let's say, you know, position size, you name it position size, those will collide if you're not careful when you have multiple strategies running. So that's what happened. He had one of his original strategies was had position size x. That was specified in the parameter.

Dave:

His new strategy, which should be trading you know, he was just getting it off the ground. It should be trading much smaller. It was using the exact same parameter name. Got it. He didn't realize those were gonna be colliding.

Dave:

Mhmm. So it's not something that's intuitively obvious from a developer perspective when you're doing this. It's only when the you you combine the combination of the two strategies together that they you realize they collide. So that's, first of all, I hope and I'm I'm hoping and I'm guessing that there's some listener out there where that there's gonna be a light bulb there, and they realize that that's what can happen, and I hope Or

Michael:

something yeah. Something they're about to do, and go, oh, oh, you know, I should call I should just change the name of this one or something. Yeah. Oh, hopefully you save someone there. That'd be great.

Dave:

Right. So the solution that I came up with is, for each strategy, just put a prefix. So maybe your strategy you know, strategy a would be, you know

Michael:

Yeah. A underscore that that parameter. Yeah.

Dave:

And then you don't have to worry about it. They're all distinct, and they, they won't collide at that point. So that's

Michael:

But the funny thing about that is that instantly in my brain, I'm like, that's that's not gonna be the only time. And that that's why it's good we're having this conversation because that's something that you could probably have given to a very experienced trader who does this and could have just overlooked that. Like, it just seems like a very, you know, benign, not something that people would think about, not something that a new person would ever come across, and then even something an experienced person could just, you know, if if they're going through the code, go over. So I think that's why it's so important that we talked about what to do when because, right, that situation those kind of bugs just seem like they could come up all the time for for any number of reason.

Dave:

Yeah. And even if you have a really tight testing process for each strategy

Michael:

Mhmm.

Dave:

You would still run into this if you weren't testing with all the strategies together. So it's a really kind of, nasty bug that can crop up that could cause some problems.

Michael:

Now is that a process that you would suggest traders add to their you know, every time I add a new strategy, I take the bulk of strategies and paper trade them for a day or or something like that? Or or do you just think just being there and able to hit the button to override it is is is enough in that case?

Dave:

I think it's important to paper trade a strategy even for just a day Yeah. Just to see how it interacts. But the important thing to think about is here is, and, you know, and I have talked about, what happened here? How can you set up your workflow to prevent this in the future? That's really what you're after.

Dave:

And talk with a lot of developers. I've done development for many years. And it's really important to have a very good workflow for your code in a way that is you know, has tight version control, has a process for going from testing into production Mhmm. Even when it's just you working on this code. The problem is when you you know, we're designing strategies that are robust.

Dave:

They're gonna work for a long time. The more successful you are at doing that, the more out of the zone you are when there's a problem with the strategy, and you have to go back and look and see what the problem is. So, you know, imagine you find a bug in a strategy you've been trading, and you haven't modified the code in 6 months, maybe 2 years. It's almost like you're looking at somebody else's code when you go back and look at it. Yeah.

Dave:

So in the moment, it's it's really easy to cut corners. It's really easy to imagine that, oh, I understand I understand this now, so I'm gonna understand it tomorrow. Or I'm gonna I mean, I wrote the code. Mhmm. I wrote every bit of this code.

Dave:

Like, I completely understand it. But I can assure you that in 6 months, it's gonna look like somebody completely different wrote it.

Michael:

And in

Dave:

fact, it it should look like that because you should be getting better and better over time at coding.

Michael:

Well, and it's funny. If it's

Dave:

not the case, then it's it should be.

Michael:

And I I've learned as someone with no coding background at all, I've been coming through the same thing in little things just talking to the other non coders out there, like, Realtest. So I know AME broke and everything. Just have the ability to write notes inside the inside the and it's just something that, again, I know you as a coders, like, yeah, of course, you you write notes for every and I I wasn't doing that. So I would have this big piece of of, the system and, you know, maybe I was halfway through working on it and I I got distracted or I end up doing something else and I come back to it. I got no idea what any of this stuff is trying to say anymore.

Michael:

And it took me hours to kinda parse through it where if I just do what I do now where you just write little notes for each each kind of block of of what, you know, this is looking for this, this is what this does, all that kind of stuff. It really, really speeds that up. And and you're right. It's one of those, in the moment, it feels like you're taking longer to do a thing. You know, maybe it would take you 2 hours to do it, but it's gonna take you 3 or 4 because you're you're heavily documenting things.

Michael:

And even myself as a visual person, I'm applying charts to the setup. So, you know, I can link to a chart and say, this is what I'm looking for, and this is where the area is and all that kind of stuff. So feels like you're going slower, but you're right. It's one of those in the long run, you'll be like, oh, man. I'm glad I did that.

Dave:

Totally. And that's it it is you know, there's a couple of things that I for developers that I wanna point out here. One thing is to really in the code you write, make sure you're writing standardized code that has good style. There's always for for each language, there's a style guide that is, you can go and see what coding standards, like a style guide for for how you should be writing code. There's lots of different ways you can write code, but it's important to do it kind of in the standard way.

Dave:

That's gonna help you in 6 months when you have to go back and look at your code. The other thing is you should have your code in version control. And if you don't, that's a big, big problem. So you should be using a GitHub repo. You should be committing your code to the repo.

Dave:

You should have a standardized way in your workflow for doing that. You should be not committing your code to the main branch. You should be creating a new branch. You should be committing to that new branch and then doing what's called a pull request to get that code into the main branch. All these things are, easy, simple to overlook when you're trading one strategy

Michael:

Mhmm.

Dave:

Or when you're just getting started. But as soon as you start adding more strategies or as soon as you have to go back and look at your old code where you come up with a bug you find this bug, and you're like, oh, what what change did I make when? You have to have a solid process for tracking changes, doing little releases. And and I know this I know it sounds like busywork for somebody who's you know, they're they're a one person shop. They're creating code.

Dave:

They're they're writing everybody the code. It's just so important to have that process in place. You will you will thank me one day because it will be it'll become crystal clear that that foundation you laid is well worth it.

Michael:

Well, yeah. And I I think you hit the nail on the head there with the multiple strategies. Right? If all you're doing is one simple strategy and and, you know, you're that's it. It's your focus.

Michael:

Then that makes life a little bit easier, right, because you you were looking at the same thing every day and you're tweaking the same thing but, yeah, as you mentioned you should generally be running multiple strategies and then you should always be working on new strategies so what you have is working then your brain is somewhere completely else because you're looking for the next thing. And then you're right, you come you kinda come back. And I think I'm seeing this even more than most as someone who's a non coder. If I go back even in real test 6 months, and I look at what I wrote, I have no idea. And, you know, you kinda laugh at yourself.

Michael:

It's like if I go back on my YouTube channel and I see a video from 10 years ago, I think it's the cringiest thing on the planet, but it's the same. When you're in when you're in the rapid growth stage, then you end up, everything you do and everything you learn and everything you kinda coop from others pushes everything so far ahead that, yeah, you're going back. And and even for me a couple months ago, I'm like, why why would I do this like this? This doesn't make any sense or just right? So just having that documented, yeah, I think absolutely makes perfect sense.

Michael:

And more importantly, I think, I like your idea of it just take a day and and just paper trade every anytime you make a trade or a change, package the whole thing. Right? Trade it just in case, those events happen because thankfully, in this situation, it was only 5 times the size. Right? Could have been depending on the buying power you have in your account.

Michael:

Could have been 10 times the size, could have been a 100 times the size. Right? If you were, to the point where, you know, maybe it executes and it just executes so big. And in the same, I know we're talking about stocks, but I've had a lot of the same things when it comes to foreign currencies and and metals and different assets like this where tick sizes are different and all this kind of weird stuff. So you think you're putting something in as one, you know, it comes out 10 times the size and you're taking 10 times the risk.

Michael:

Yeah. So I think it makes absolutely perfect sense to go, okay. Just take a day and just track it through, you know, make it work exactly like it's going to in live, and understand that even then, right, there still might be something that comes up in the transition.

Dave:

Yeah. Yeah. So there's a couple other things I'll say. One other suggestion, like I alluded to earlier, you should be parameterizing a lot of the variables in your code so that you when you make a small change to your process, for example, increasing your position sigh your positions your position size

Michael:

Mhmm.

Dave:

You shouldn't be modifying your main code to do that. You should be modifying a config file or a parameter. You shouldn't be modifying your main code base to do that. And there's it's not just position size. There's probably lots of things you could parameterize like that.

Dave:

That's just good style, and it's gonna, it's gonna make your workflow a lot better. The second thing is getting code into production is something you need to think about and have a plan for. And, you know, I work with some, traders, who are at prop firms, and they have a very tight process for getting code from test into production, and that's the way it should be. You should have when you do that, it should you should be you should have a process for looking over it closely Mhmm. Taking it seriously, you know, trying to understand how, you know, you might be missing something.

Dave:

When it gets into production, all of a sudden, you know, your money is at risk. Yep. And there's ways that, especially if you're writing code to to make trades, there's ways that you can liquidate your account very quickly if you don't, think about this very carefully.

Michael:

Yeah.

Dave:

Back the other day, so I'm I'm creating a software that, trades through DOS, and there was a bug in my code. I I I looked down. Trade came through. I looked down, and it had loc it was in a locate loop. So it was locating Short shares.

Michael:

It was trying to find shares to short.

Dave:

Just trying to find shares to short, just part of what it's doing. But I I just didn't anticipate this could get into a loop like it did. Luckily, I was right there, but I was you know, all of a sudden, I had had located and taken a 10 times, as large a position as I should. Luckily, I was right there.

Michael:

But And for

Dave:

ideally

Michael:

for new traders, right, you have to pay for those. You're basically going to a broker, and you're saying, I'm willing to pay a dollar a share for the ability to short this thing. And and, yeah, those things can get crazy where you could spend a whole lot of money on if it if it kept going to borrow these shares, and they probably get more and more expensive the more you borrow. So, yeah, that's something that could have probably just and and you're just it's just it's not even a trade that hopefully could go your way. You're just spending that you're just spending that money.

Dave:

Yeah. And there's there's lots of you know, when you write code and you you've got an event based system, there's lots of loops that you can get into that you don't anticipate. So it's really and, I mean, if I wasn't there, it would've just continued, and it would just liquidated the account. I mean, there's just no two ways about it. So it's super important to have a tight process around these things because those things can happen.

Dave:

And and I know the traders that have, lost a lot of money because of bugs like that, and it's just you good advice is just be somebody gave this me this advice to me a few years ago. Just be paranoid. Mhmm. Be paranoid when you're when you're writing writing code. Try to anticipate what could happen that you might not be thinking about.

Dave:

And that you get better at that with experience, but super important when you're talking about making trades.

Michael:

Well and I think a good, final thought too is, you know, we've a couple times already, you stress the importance of being there. Right? When at least until you're absolutely certain that, you know, the the things run for months and you think every possible scenario is out of the way. But, it's very, very important, which, again, a lot of people think systematic trading. I just dump the code, and I I go to the beach and and have a drink.

Michael:

But, yeah, until you are just very confident that that thing is gonna run and you have all these fail safes, in place in case something happens, yeah. Just make sure you were there. Right? And and just watching. And and, you know, it's not like it's really hard work because you should just watching a system go.

Michael:

But for those little scenarios, especially when you're in the building phase, just being there watching could save you so much money.

Dave:

100%. You're totally right.

Michael:

Alright. Well, I think this was a great one. I I because you're right. Everybody doesn't matter if you're discretionary trader. It doesn't matter if you're an investor.

Michael:

It doesn't matter if you're day trader. Everyone's done this. Right? So, I think this was a fantastic one. As always, we love the feedback, and let us know, you know, tell us your war stories.

Michael:

I think that'd be great in in the comments. We'll read through them because, you know, it's one of those if you haven't done it, you're either lying to yourself or you haven't been trading long enough, I think, is probably the way to do it. Right?

Dave:

Yeah. So, again, thanks to finance for allowing this, lesson to be, you know, transmitted to the listeners. I'm sure that some listeners learned a thing or 2 from his mistake. I sent I sent Fynet the line your own pockets t shirt.

Michael:

Oh, sweet.

Dave:

Just appreciate, for him doing this. So Cool. Yeah. It's great to you know, we got a whole bunch of topics coming up that I'm really excited about. But as always, feel free to email us with topics that you want us to touch on.

Dave:

We we hear from from listeners, with topics of 4, and those are really good. So any feedback you have would be great.

Michael:

Quite often. Sometimes you guys are better in coming up with topics than than we are, and and I love it because, especially on the fly. Before I hit record, I really didn't know what we're gonna talk about, but I think this was a great time. I think it was a good lesson for everybody, and I am Michael Noss.

Dave:

And I'm Dave Mabe. We'll see you next week on Line Your Own Pockets.

Handling a Trading Mistake
Broadcast by