Line Your Own Pockets

We discuss:
  • Python is a great general-purpose language, but that's what makes it a bad choice for backtesting
  • Iterating on your strategies is the critical piece - anything that makes that more complex will make things more difficult
  • In a world of LLMs, the argument for using Python for everything makes less sense
  • Choose your tools based on profit potential, not because "I like Python and am good at it."
Much more...

---

Before you go!

The next time you find yourself in a drawdown, I want you to stop what you're doing and head on over to betterbacktesting.com to sign up for my free backtesting email course.

I hope to see you there!

Creators and Guests

Host
Dave Mabe
Host
Michael Nauss

What is Line Your Own Pockets?

A weekly show for systematic traders who want to make more money from their trading strategies.

Michael:

Alright, everyone. Welcome to another episode of Line Your Own Pockets. I've been clogging up a lot of these airways with my Amni broker journey already. So this one, we've got one that's going be a little bit Dave's, a little more up Dave's alley when we're talking about, you know, why Amibroker versus Python and all of these different things that Dave will do a much better job explaining than I ever could. So I'll pass it off over to you right away.

Dave:

Yeah. I think I might make the title of this podcast, Friends Don't Let Friends Backtest with Python. There's a little bit more nuance to it. Let me just tell you what I see traders doing. Systematic traders, a lot of them are developers by trade.

Dave:

They've got experience developing. And if you're a developer these days, it's hard to not have run into Python. You're probably very familiar with Python. You probably use it in your work. So, a lot of developers are very comfortable with Python and it's a great language.

Dave:

It's very good for what it does. So, I see a lot of traders or a lot of developers make the jump to trading and they want to use Python because it's what they're familiar with. They already have a lot of experience with it. They're very comfortable with it. Can probably I grew up using a lot of Perl before Python sort of overtook the whole landscape.

Dave:

And I could pretty much think in Perl. I could write Perl code without even thinking about it. It was so natural that if you could use backtesting with Pearl back then, I would have done it. So I see a lot of traders or would be traders, would be systematic traders making this default decision without much thought about it. And I think for a lot of different reasons that we'll go into, I think Python is not the best choice in most cases for backtesting.

Dave:

Even as difficult as it seems like your journey has been with Amibroker, Like you you wouldn't not even have been able to make it as far not even close to as far as you have if you just chose Python. See, Like not even close.

Michael:

That's fascinating to me because I instantly thought the opposite. The way I immediately thought, not just because Python, there's way more education out there on Python for me, but that also means there's way more education out there on Python for like LMs and things like this. So I would have instantly thought that if there was like a ranking scale of difficulty, right, that it would be, you know, probably like a trade ideas, you know, way on the easy side of things, and then maybe, you know, a Python after that, and then you'd put real test amibroker kind of further down. So that that's interesting. And this is from the non coder side.

Michael:

So I would imagine even more so than that, from the coder side, they're probably thinking, well, Python's the way to go because I already know, you know, it's already my wheelhouse. It's it's kind of where that where I play. But, yeah, that's I I would not have guessed that at all.

Dave:

So think about it this way. Python is a it's like I said, it's a great language. It's easy to learn. But the thing about Python is it's a general use language. You can use it for anything.

Dave:

It can handle lots of tasks. That's the beauty of Python. That's why it's so popular. But that doesn't mean it's the best tool for backtesting. Just because you can backtest with Python doesn't mean that's the best tool to backtest.

Michael:

Well, you know, just speaking of tools, right, to go back to, I'm going to be the cave guy in this, the caveman in this one just commenting. But, you know, I'm thinking the same as, like, I've got one of those multi tools, right, that can do a little bit of everything. But it's worse at everything than just getting, know, it's a, it can do a screwdriver, but it's a worse screwdriver than a screwdriver and it can do pliers, but it's worth, right? So it's, so you're saying it's basically the same thing where it can do a lot of things, but it's going to be slightly shittier and all those things, which means it's a great, you know, I always carry one of those around with me in the car. But if I have to do a job, I'm going to the tool kit getting the the thing that I actually need.

Dave:

Yeah. And and that multi that's a great analogy. That multi tool is you should stop carrying that thing around. Should be using that for exactly the things that it's useful for. It's very convenient for doing one off things.

Michael:

I think

Dave:

it's a great analogy. This one's probably a worse one that I was thinking about before. Imagine Excel exists, but let's say that you didn't want to use Excel, you wanted to use Notepad to process all your spreadsheets and datas. Wouldn't make any sense, right? Yeah.

Dave:

You could. You could use Notepad for it. You could use a text editor for that. You could totally do that. But turns out there's a lot of reason to use Excel.

Dave:

It's a lot more convenient. It's not perfect, of course, but that doesn't mean you should try to recreate Excel using Python or create your own text editor or a processor to process your spreadsheets. Doesn't make sense. So but I see a lot of people essentially doing making that decision because they're comfortable with notepad, for example.

Michael:

So what are the actual like, you know, into the nitty gritty? What are like the main things that this use a an amni broker? You could place real test or whatever you want with it. But what are what are like the main things that you're saying that this is just so much better than than Python? Just right off the bat, try to talk to me with this one, but like, you know, just right off the bat, what are the biggest those biggest differences that you're you're kind of seeing?

Dave:

So I've worked with a lot of traders that have started using Python. And I to be honest, I wanted to like Python. I wanted to be able to use it. And I probably would have if I hadn't already started with Amabroker, I totally would have made this choice and it would have totally backfired. So the reason is Amabroker just makes things so much more convenient.

Dave:

And it is made for trading and backtesting. That's what it does. It doesn't do anything else. That's kind of the beauty of it. It doesn't try to be We've talked about how I have such respect for Tomas, the creator of Amber Broker, because he has said no so many times to features that people ask for.

Dave:

He's like, Nope, I'm not doing that. This is what this tool's for. Because So of that, it's very lame. It hasn't changed in thirty years almost. The interface shows that.

Dave:

That's a good thing. And it just does that job very, very, very well. So I've had several traders that have made this tried to use Python and ended up using Amibroker, and they are way, way happier for doing so. There hasn't been a single trader I've worked with for this transition that is unhappy with that choice. Their back testing is literally 80% faster, 80% plus.

Dave:

And this is from somebody who was probably the deepest Python programmer I've worked with. He just was like had this really sweet setup of a multithreaded backtest that would just really efficiently use all the cores in his machine. But he switched to Ambroker and he made lots of money last year as a result of doing so. He credits that change in the work we did to transition his business from Python to Ambroker for those results. He's much happier.

Dave:

A lot of the coding that you have to do is just way more convenient. I've seen this time and time again. Like I said, yes, you can do some of this stuff in Python. You think, okay, there's probably a library out for this. It, there's just so, it's just so much more convenient with Ambroker.

Michael:

So, you know, just to talk to that Python programmer, and I'm not, again, as someone who doesn't code, how much different is it? Like what, how big of a step is it? Cause for me, it's like for me, it's going from I know absolutely nothing to I'm trying to learn, you know, that this particular language in in Amnibroker, but that that cross as opposed to, you know, working your way up to move across like that, is it as big of a deal? It's gonna be is it is it the language or the the syntax even remotely close? Like, how big of a journey is it from one to the other as opposed to me starting kind of from the ground up?

Dave:

You're not gonna snap your fingers and be there. There's gonna be some learning curve, of course. That's true for any tool. But this it's just so much easier once you get there. He's creating strategies now way faster than he was before.

Dave:

When we started working together, he had basically one strategy, maybe two strategies. Now he's got five or six that he's trading live with. So, his business is just so much more robust. His drawdowns are a lot shallower. He just feels better about his trading and how robust his trading is now.

Dave:

And that's largely because of the pace at which he can come up with strategies now. It's it's like night and day.

Michael:

And so internally, what's happening? Is it just that the the processing of trades is better with a dedicated? Is it, you know, like, again, speaking completely layman, you point at, you know, I'm thinking about cars. I'm looking at my little Ring camera, I got my cars on it, right? So you look at it and you're like, those two cars are the same thing, like, but there's definitely something that's under the hood that is going to be different from one to the other.

Michael:

Is it is it the way it utilizes computer resources? Or is it just more of the the way it's processing each individual trade in in the back end?

Dave:

Yeah. I think it it's both. The so the the database back end that Amibroker uses is just extremely efficient and made for bar data. You can tell this is created by a really hardcore software developer that knows hardware and knows Windows in and out. So it is literally the most efficient way to store and access the data when you're doing a backtest.

Dave:

That's what you end up doing, just you're going to be churning through bars and millions of bars of data when you do a back test. And to be able to do that efficiently is super important. Even minor inefficiencies there get magnified over and over and over again when you're doing it across enough data. So the efficiency of the backtest and accessing that data is second to none. Then accessing For the example, accessing higher timeframes and accessing bars, like using one minute bars for your periodicity for your back test, but then accessing like the ten minute bars to see what's create variables on a different time period.

Dave:

That's very easy and efficient to do in Amabroker.

Michael:

Well, and that was actually even coming from real test, I was very impressed with that ability in Amity Broker. So, you know, with RealTest, obviously it uses daily bars, but you can go weekly and monthly. Then for some of my strategies, I do that where I'm looking at weekly for longer periods of time, and then, you know, doing some testing in the daily timeframe. And it was more complicated and a little bit harder to do in real tests than it was in Amibroker. So that was the first thing that like really makes sense to my dumbass because it makes perfect sense that this, it's the ability, it's basically you have to build two datasets at that point.

Michael:

You've got your intraday, maybe your one minute bars, then you're building another to pull in enough information for that. And I was just thinking of how to program that would probably be incredibly difficult in something like Python or some sort of free form programming language.

Dave:

Yeah. And it's not that you can't do it, but you can trust that it's done in Amabroker in probably the most efficient way. If it's not the most efficient way, Tomas is going to find and tweak in a future build to have it be the most efficient way. You can trust that. That's just one thing that you have to do when you're coding to do a backtest.

Dave:

There's a slew of all sorts of things that are just handled by default that if you chose to do it with Python, you would have to go down this whole rabbit hole of a custom solution to do this one little thing that it seems like, Oh, well, that's not bad. Could just have ChatGPT do this. But you just avoid so many rabbit holes that are going to take way more time than you think they will by using a standardized solution essentially like Ambroker.

Michael:

Well, and that's what, you know, as you were describing it, that's kind of thought I had in my head of of starting like a a small project around your home and you're like, oh, you know, I can I can pull the cabinets off and put new ones back on? Then you open it up and there's like, you know, plumbing there and you're like, well, in theory, could learn, you know, how to redirect this plumbing and then do and then eventually this whole cabinet job that if you just paid some guy a couple bucks to come and do ends up being this just huge task that has taken up a ton of your time. That And was kind of my experience too, when we talked about my thing with Amnibroker going from Polygon data versus IQ, it was like, yeah, I was saving a few bucks, but on top of that, the amount of time and energy I was doing, and I was seeing that I was gonna fall down this rabbit hole of okay, now I know I've a bolt on real time data, now I've got a bolt on. Do you think that's the main reason that people don't do an Ami broker or something like that?

Michael:

Is it costs at all? Because Ami brokers really not very much, or is it just the comfort of my home base?

Dave:

I think it's a combination of two things. One is the home base. Hey, I'm familiar with Python. I know that really well. I'm gonna use that, obviously.

Dave:

The the other thing is the lost my thought here.

Michael:

Is it Mac PC? Is that that's the other thing you were gonna talk about, I remember, because Ami Broker, that's part of my problem is I've got this massive MacBook and Dave's getting me this close to selling it and buying buying a PC because with RealTest, it was okay, but RealTest is a little bit lighter, heavier on the RAM, but just a little bit lighter overall as as a platform. And I could see a lot of people doing that as, know, maybe they're they're coding in Linux or they're coding in macOS or whatever it is, and they're able to do that fine. You're saying, okay, well now you have to not just because right off the bat, you say, oh, just do a virtual machine. Spin up virtual machine on my Linux computer, and then I'm good to go.

Michael:

But then you realize how resource intensive it is, and you're like, okay, well dual booting or running a virtual machine inside is just not practical anymore. Yeah. Because now you're using so much resources, you need a dedicated work unit just to do that one thing. So I could see that being another thing, to drag people off their chosen operating system that they've sunk. Not just, you know, it's not just like identity or something, it's crap ton of money I spent on this laptop that I now sell and buy something else with.

Dave:

Yeah. So the second thing is, I want to come back to that point because I see a lot of people making that decision too. So I think people get scared because Amber Broker has its own language. You're not gonna be able to use that language for anything else. You're only gonna be able to use that for Amber Broker.

Dave:

So you're like, gosh, do I really need to learn a new language just to do a backtest? So that's the thought process. And that's very reasonable for that to cross your mind. But I mean, I've worked with several traders who have never programmed in their life, and they're using Amibroker really well now. Like you're one of them.

Dave:

Michael.

Michael:

Well, that's what for me, this this conversation, like you're you're kind of using it as people coming over from Python to Amibroker. But for me, was I'm sitting here at this fork in the road, right? And I don't know anything. So do I learn this one thing that's good at this one thing? Or do I learn Python that's good at everything?

Michael:

So that's what was pulling me over to Python is exactly what you're saying, the time commitment of learning. You know, do I spend a hundred hours learning Python and I could do this, that and the other thing, or do I spend, you know, that same amount of time really diving in? And you're right, I only kind of gain knowledge in that one code and I don't really gain too much knowledge that I could use outside of it, right?

Dave:

Yeah, I think another reason people glom onto Python is they, chat GPT and other LLMs are just so confidently spitting out Python. They believe, okay, this is gonna be an easier path and to, okay, ChatGPT, create some Python code for me to do a backtest. It's gonna very confidently give you some code that seems like it's gonna work. But then when you dive in, it's like, okay, well, there's a lot more involved here than I thought there was going to be. So I think that's another reason.

Dave:

So you mentioned the Mac and the PC. It does remind me of that sort of debate where it's almost a religion for some people. Used to be in this book. There was a time where I was really into Linux. I tried to get it running on my laptop with a GUI interface, a desktop interface with Linux.

Dave:

Can do that. It's possible to do that, but that doesn't mean it's the right choice. You're going to spend a lot of time working on becoming an OS expert when that's not really what you want to do. And I felt like it was cool. It was fun to do.

Dave:

But gosh, the whole reason One good example is I am a cyclist. A lot of my cycling friends do their own work on their bikes. Basically become mechanics. That is something I do not want to be good at. I do not want to be good at bike mechanics.

Dave:

That is not what I'm here for. I don't want to be good at that. That's only going to be a time suck for me. It's a little bit dangerous because I know I'd probably enjoy it. I just know that it's a rabbit hole that I want to avoid.

Dave:

What I'm trying to do is be the absolute best trader I can be and the best coach I can be. So that's what I want to focus on. Anything that pulls me from that is not good, even though it would be totally fun. So that's kind of the way I think about it. I think a lot of developers find themselves in the same boat or have some of the same tendencies that draw them into situations like this.

Michael:

Well, and not to say that there's anything necessarily wrong with that, but you just need to understand that what you're doing is trying to become a hobbyist in one thing, and you know, you're spreading yourself out. And that was really the crux of of why I ended up going first with RealTest and now with Amibroker as opposed to learning Python was was simply that was, well, what am I trying to do here? Right? Never going to sit down and like code a calendar app for for something. Right?

Michael:

I want to really, really focus. And then I'm going to that's what's kind of pushing me to the to the PC realm. It's like, I still hate Windows. I still dislike, I dislike that when I bring up the start menu or whatever, and I start typing in my program, it wants to send me to like their store. It's like, there's a whole bunch I hate about it, but I just look at it the same as we were talking about with Amibrokers that it's it's it's ugly and it's boring and you know, there's nothing flashy about it, but that's okay.

Michael:

That should just be your dedicated this PC does nothing but this particular work or part of my life or whatever. And then so, you know, that's going to be my plan. And then I'm going to buy a little MacBook Air and that will be for my email and and, know, doing all the other things that that it can do. So that's how I would look at it for these people as well as do your Linux stuff if you want to do your Linux stuff, right? And then maybe, you know, I know there's like all these privacy concerns and everyone, you know, Microsoft shoving AI down your throat every time they get a chance, and that's fine.

Michael:

So just make it, right, that computer, that PC does nothing but back tests and runs and does whatever. It's probably better that way anyway, that you're not gumming it up with your personal stuff. And then when it comes to, you know, emails or video games or whatever you'd other do for your computing, you've got a separate device that, you know, goes over there. And that's kind of the way I'm looking at it as well, because I wasn't really religious about it. I just hate Windows.

Michael:

And I've just been using Mac for so long. That's kind of the way I look at it is, okay, dedicated PC that even you could remote into sits in another room or whatever, and it just does that one thing. And then you have your your other computer for your other stuff. And that that's the, I think the easiest way around that for a lot of people who are kind of stuck in there.

Dave:

Yeah. I I think that's true. So I did I I did recently talk to trader that's been trading for, I think, since 2017 or '18. I won't mention his name. But he's done really well, and he recently paid a lot of money to somebody to create a Python backtesting system for him.

Dave:

And actually, far as backtesting systems go, it wasn't too bad. But he has so much money sunk into the system and he can't really change it that much. It's almost like a black box at this point. So he has to have this developer to work on it. He was trying to get me to help him with this, but I was like, Gosh, that sounds like a rabbit hole.

Dave:

You need to be working with something more standardized and you need to be able to modify what you're doing. It was just clear to me that he had already sunk a lot into us, so he's unwilling to change because of that. Man, he's in a sticky situation because of that, so he stuck with this suboptimal situation that, Man, I wish if he did approach me several months ago before he did that, he'd be in a much better situation now.

Michael:

Yeah. Well, and it almost seems like you'd be better off buying the program and then almost buying a person to to code into it if you were, you know, kind of really unwilling to do that yourself. Right? Or, you know, and I'm interested to hear, and this is kind of on topic, but why you think LMs are so crap at Amity Broker? Because like this, this whole conversation, the real test versus Amity Broker, like all of these conversations in my mind just dissolve entirely.

Michael:

If you can ever get LMs to be really, really good at not only building like an initial script, but like all the other stuff when it comes to Amibroker. Because like for that person, for example, who spent all that money on building a Python code, well, that they just buy Amnibroker and they, if they could just type into an LM what they want and be able to go from there, that whole thing in my mind just dissolves. And I'm approaching this from my point of view as well, that, you know, whether or not I use platform A or platform B doesn't matter anymore, right? I'll use RealTest for some things and it ain't broke for others, if I could have a centralized LM that does it. And because, so I have an LLM that's amazing at RealTest.

Michael:

It like, I'd say 80% of the time it does exactly what I want to do and it does it perfectly. Like, why is it so hard on on Amity Brokers side? What's so different?

Dave:

I think so the language is set up for speed and because it's set up for speed, it's operating on arrays, and that is what confuses the LLMs and a lot of users who start using it for the first time and are accustomed to another environment. So by default, you're operating on arrays instead of scalars. And that may not make a ton of sense to you non developers, but just think of it like operating on entire columns of a spreadsheet versus just a cell at a time.

Michael:

Okay.

Dave:

It could be so much faster to do that. Because of that, the syntax is by default operating on the entire column versus the cell, which people are used to when they program stuff, they're used to thinking about it in terms of scalars, just like the cells or the stuff in the cells. So it's because of that, I think that there's this layer there that they don't understand. Let me back up. They can be made to understand, but by default they don't quite get that.

Dave:

So I've created a really good AFL generator in MADE Kit. It works really well. It's because behind the scenes, I've given it, okay, here's how you exactly do that in AFL. It has so much context about how to create the right kind of backtest with the custom columns in there and the things to avoid that

Michael:

So,

Dave:

it's just way more efficient when you give it a lot of context. And then if you ask it to do something without that, it's not going to be very good at that. And as it's very clear and pretty obvious, LLMs have never made a trade before. They've never had to feed their family by making trades and profiting from them. So the incentive's just not there.

Michael:

Yeah. And I find that and I don't know. This maybe this is just me using them more and more. But I find more and more I have to, like, remind it not to be lazy. Like, I'm like, you know, check these news articles, like and then it comes back with, like, half of what I asked for.

Michael:

I'm like, no.

Dave:

Go do

Michael:

it. So I don't know if it's just like it's learning from humans and it's just getting lazier over time or what it is. But yeah, because that that always interests me because for me, you know, talk about this all the time. These LMs were what I needed to get into this thing that I was always interested in, but because I had absolutely no programming background and full time jobs and all that was so much harder for me. And it was one of the reasons that I went because I tried Ambroker first and it was just far beyond anything that I could do.

Michael:

So then I went to real tests and I found that I could muddle along and I could muddle along with the help of these LMs. And then I just, I'm waiting kind of for the same thing, which I do have some feedback, remind me, for when we go offline of your of your thing, as soon as that is there, then yeah, it's a 100% of we are going to be, I think, more tool agnostic, which I think is kind of the crux of all of this, right? You shouldn't be using Python because you know how to use Python, you should be agnostic to what it is that you're pro, you know, you're putting your idea into. Because at the end of the day, that's the goal is you have an idea about trading, you've seen something in the market that you think may have some validity to it. The tool that you should use to get the data out, whether or not that's a good idea or not, it shouldn't matter, you should just pick whichever is the best one to do it.

Michael:

And kind of what we're saying is that, you know, a purpose built tool is always going to be better than a generalized tool if you're trying to do a purpose built activity. So I think as soon as we get that bridge down where that Python developer could say, you know, just type this is the thing that I want, blah blah, and then get that code out and inspect it and do all the right, to make sure we're not being slaves to the AI things that we need, I think that additional leap will be so big that it again, hopefully it will it will help with this problem entirely.

Dave:

Yeah. Yeah. I think I think that's a great way to put it there. I mean, another way to think about it is you shouldn't care about the tool you're using. That should be completely irrelevant almost.

Dave:

Your main goal is making money. That's the main goal for trading, figuring out strategies. To make money, you need to come up with a strategy. To come up with a strategy, like the the whole goal, the the the way you're gonna be more robust as a trader, the way you're gonna be in this game for longer is to come up with strategies faster. And if there's a like, I don't care how much you like Python or even Amber Broker.

Dave:

If there's a tool that came out tomorrow that allowed you to create strategies faster, you should use it like that's that the goal is not to to make a lot of money using a particular tool like that should be irrelevant. Like the whole point is making money.

Michael:

Yeah, and this is it's funny because, you know, I I'm building these crypto strategies and I'm writing emails about them and part of my email list. And one goes, how are you trading such crap? Because it was like it actually one of the recommendations was Farcoin And it ended up making like a 52% return in Farcoins like how are you trading such crap? And then that was exactly my response. I'm like, the bank will take the money regardless of whether or not I made the money in a blue chip company via dividend or whether I bought something called FarCoin and sold it, a little bit longer, and I can turn that money into food that my children can eat, regardless of of where that came from.

Michael:

So yeah. So, you know, getting yourself out of the, oh, I'm good at this, therefore, I'm gonna kind of spoon, you know, shovel that in and just I don't care. These are all just numbers on the screen. I'm just trying to make the numbers work for me as opposed to work for someone else out there.

Dave:

Yeah. I see so it reminds me, there's a I see some traders get stuck in making their strategies statistically perfect. Like, you know, they're trying to eliminate every single bit of curve fitting or worrying about curve fitting too much. What I tell them is when you go to deposit all your money that you've made with your profits, there's not a checkbox that says, Hey, I didn't use any curve fitting with the strategy that made all this money. Right?

Michael:

So it is crazy how much us as humans try to get in the way of that. And, you know, we know people who, you know, may have been good traders and then fell into like political traps. You know, they I won't buy this stock because my team doesn't like it. I won't end just all of these biases that pull us in in different directions where, yeah, at the end of the day, the goal is to put money into the market and to have more money come out than you put in. And whatever you use to do that, good for you, as long as it's legal, right?

Michael:

Have at it.

Dave:

Yeah. Another thing I like to say is do you want to be statistically perfect, or do you want to make money? Think that's sometimes that's the choice for some people.

Michael:

Yeah. And I think that's a perfect way to put it. So yeah, so I another good one. I didn't think I'd have as much to add as I did, but I guess I can find a reason to waffle on about about anything. But I appreciate it too, because it was still getting to the point with me a little bit where this ammy broker journey has been difficult.

Michael:

So, you know, there's some times where I'm a consumer of content. So I watch a YouTube video and I see a guy do a back test with Python. I'm like, that's interesting. So it's kind of good to keep me in this box I've chosen to live in until I figure it out.

Dave:

Yeah, think I'm always eager to get the updates from you and see where you are with Amber broker. And yeah, I could tell you're progressing really well.

Michael:

Well, maybe another one soon. But Yeah. Until next time. I'm Michael Noss.

Dave:

And I'm Dave May. Talk to you next week on line your own pockets.