ChatGPT to Create Trading System Codes: Effective or Dangerous? Let's Find Out Together!

Need More Help? Book Your FREE Strategy Session With Our Team Today!

We'll help you map out a plan to fix the problems in your trading and get you to the next level. Answer a few questions on our application and then choose a time that works for you.

BOOK YOUR FREE STRATEGY SESSION NOW >>

ChatGPT is an artificial intelligence chatbot capable of generating texts of various types, including codes in different programming languages.

EasyLanguage, the TradeStation language compatible with the MultiCharts trading platform, is among the languages in its database.

In this video, we put ourselves in the shoes of a novice systematic trader who has not yet learned to program and try to find out if ChatGPT could help learn how to write codes for trading systems.

The first question we asked ourselves was whether the codes written by ChatGPT were valid and would work. So we asked ChatGPT to write a trading system and inserted the code into the MultiCharts editor...

Watch the video now to find out:
-Whether it's possible to create trading system scripts with ChatGPT
-The pitfalls of using this chatbot
-Our advice on how to use it correctly

Enjoy the video! 😉

Transcription

ChatGPT and systematic trading

Hello everyone and welcome to this brand new video.

As you can see from the title of this video, as well as now on my screen, today we are going to be talking about OpenAI's latest creation, ChatGPT.

I'm not going to spend too much time explaining what it is, because the internet is already full of information about it.

Instead, I'd like to tell you why we are talking about it on this channel dedicated to trading systems and, more generally, automated trading.

I'm one of the coaches at Unger Academy.

So, we know that ChatGPT is an artificial intelligence. There are many online, but this one has had the most hype in recent months.

And as an artificial intelligence, it can rework our requests based on what it has at its disposal.

Before we start, though, I just want to emphasize one very important aspect: ChatGPT does not search for information online.

For example, if we ask it what the weather will be like tomorrow, it will tell us that it doesn't have the necessary information and suggest that we look it up online.

Let's do a test now for fun. I'll ask it what the weather is like now in America. So, I'll write… I'll ask what is the weather like now in the USA. Let's see what ChatGPT says… Here we go, it says, "sorry, but I'm an artificial intelligence and I don't have weather information."

Then it suggests that "you can check the weather on a weather website," which means that you can look up the weather information on a weather website or even an app that does the same thing.

ChatGPT to learn how to write trading systems

So, after this little introduction, let's get rid of this chat and start again. What can we do to make use of this artificial intelligence in trading?

I assure you that it is still a very interesting product because it can help us to learn how to write trading systems. How? We said that this artificial intelligence is based on its own database.

And in its database, the programming language that we use, EasyLanguage, is present, which is a very simple language for writing trading system codes. So for those who are just starting out, ChatGPT could be a useful tool if you know what to ask for and how to ask for it.

This premise, "if you know what to ask for and how to ask it," is very important because we'll now go through some examples and see that ChatGPT can give us some very interesting answers, but they are not always complete, and sometimes, well, it even tells us lies.

Testing on MultiCharts with a system written by ChatGPT

So, let's take a step-by-step approach and explore what I've just told you. Let's ask it to give us a code for a trading system of its choice. Let's go ahead and send the message. "Write me an EasyLanguage code of a trading system".

Okay, here's an example code. Let's assume that we don't know EasyLanguage. Now, from this information, we can understand more or less what the structure of a code is. There are inputs, there are variables, there is a body. It says "buy", so it will definitely do something.

We, who know nothing – because right now we're just pretending that we know nothing – we copy the code and will paste it into our Power Language Editor on MultiCharts. Here, I have already opened MultiCharts with my Power Language Editor. Let's delete everything I was doing before and paste what ChatGPT suggested.

I compile the code and save it, and already you can see that it gives me an error. It gives me an error on line 13 because it says "next bar at MA". If I wanted to exit at this level, then I would need to add the word "stop". It also gives us an error after "if market position equals zero then..." and puts an "end". Here, in reality, a word is missing, "begin". The same applies to this "if" structure, so "begin".

We compile it, perfect, it went well. As you can see, ChatGPT has already given us a valid starting point for our code. But it was imprecise, there were some inaccuracies, a word was missing here, and a word was missing here and here.

I assure you that I have done many tests, and EasyLanguage is present in its database, giving us a very good understanding of what a code could look like, but we need to pay close attention to what it writes because what it writes is not always correct, and it doesn't always work.

So after compiling this code, just out of curiosity, let's see what it would have produced on the chart I have available. I put a chart on the US stock index with a daily timeframe. We can quickly see the performance report. We can see that the trading system seems to rise. I mean, it seemed nice at first, but then at a certain point, it started losing. Surely it is not a trading system that we would use for live trading.

The lies of ChatGPT

That is not our ultimate goal, because now we want to learn the language. And now I'll show you that ChatGPT can give us untrue information too. So let's go and take a new chat and write a question very similar to the previous one, namely I'll ask it to write us a trading system in EasyLanguage but in the style of Andrea Unger.

I'm really curious to know the answer... it is starting to write code in EasyLanguage, and according to it, it is in full Andrea Unger's style. Here it's finished. I already tell you that the code is wrong because in a trading system, there cannot be "plot" commands, which are written down below.

So surely, this trading system won't work. To prove it, I'll copy the code from beginning to end and paste it into my Power Language Editor… Control + V… See? There's the part related to the plot with inputs and everything. It compiles... And indeed, it doesn't work.

The platform already says that it doesn't like the "color green," which is not even defined, but even if there weren't any defined words, the plot would surely not be right. Here it is: the keyword "plot" cannot be used. So not only did it give us an answer and told us that this could be a code following Andrea Unger's style,

I assure you that Andrea Unger does not use plots in his trading systems because, in fact, they wouldn't work. Not only that, but we can also go further into the lie that ChatGPT is telling us and simply tell it that Andrea Unger never uses stop loss.

So I'm telling it, "Andrea Unger doesn't use stop loss." Let's see what it says. "If Andrea Unger doesn't use stop loss, then you can modify the code by removing the stop loss." And it gives us a new proposal.

So as you can see... I assure you that Andrea Unger uses the stop loss in his codes. We all use them. And it is certainly foolish to build a trading system without a stop loss.

Warnings and tips when using ChatGPT

As you can see, ChatGPT always provides an answer regardless of what we ask it and regardless of the request's meaning.

Therefore, we must pay close attention to what we ask, because the results depend on what we ask and how we ask it.

If we ask for help in writing code, for example, to understand how we could sketch out a trading system based on a particular indicator, yeah, it would certainly be okay, but I assure you that there must also be some sort of post-processing on our part, a sort of reworking of ChatGPT's response.

I mean, if we only listened to what it tells us and copied and pasted the responses, we would definitely crash somewhere.

Here, of course, it's still adding the plotting part, although it's wrong, but it built me a code that shouldn't have a stop loss anymore.

In fact, in the previous response, you see that there was: if market position equals one... In short, there was the definition of stop loss, stop loss equals entry price, and so on.

This definition of stop loss is no longer there. But I assure you that the code didn't make sense before and doesn't make any sense now.

Lastly, I'd like to make a small analogy. If we wanted to compare the profession of a systematic trader with that of a carpenter, we could say that ChatGPT could be understood as a new machine to add to the ones we already have, which could help us manufacture our furniture.

But you know well that a good machine is not enough to make a good carpenter. And above all, there is no machine that can go beyond the technical skill and manual dexterity of a craftsman.

A systematic trader obviously doesn't make furniture but develops trading systems. So yes, ChatGPT can be a useful tool to help in the creation of trading systems, but it is neither necessary nor sufficient to become a profitable trader. The profession of a trader cannot be improvised, and certainly an artificial intelligence chat cannot entirely replace the work of a systematic trader.

However, if you are curious to understand how to invest in the markets in a systematic way, I leave you a link in the description of this video that will take you to a very useful page where you can find many resources. From there, you can watch a free presentation by Andrea Unger or get our best-selling book "The Unger Method" by covering only the shipping costs, or using that link, you can book a call with a member of our team to get some free strategic advice.

Finally, I remind you to please subscribe to our channel, if you haven't already, so that you will be promptly notified of all our new videos and new content.

And if you've enjoyed what we discussed, please leave us a Like and maybe leave a comment telling us what you think, or asking us what to cover in the next videos.

With that, we will see you soon with some new content. Bye-bye for now!

Need More Help? Book Your FREE Strategy Session With Our Team Today!

We'll help you map out a plan to fix the problems in your trading and get you to the next level. Answer a few questions on our application and then choose a time that works for you.

BOOK YOUR FREE STRATEGY SESSION NOW >>
Andrea Unger

Andrea Unger

Andrea Unger here and I help retail traders to improve their trading, scientifically. I went from being a cog in the machine in a multinational company to the only 4-Time World Trading Champion in a little more than 10 years.

I've been a professional trader since 2001 and in 2008 I became World Champion using just 4 automated trading systems. 

In 2015 I founded Unger Academy, where I teach my method of developing effecting trading strategies: a scientific, replicable and universal method, based on numbers and statistics, not hunches, which led me and my students to become Champions again and again.

Now I'm here to help you learn how to develop your own strategies, autonomously. This channel will help you improve your trading, know the markets better, and apply the scientific method to financial markets.

Becoming a trader is harder than you think, but if you have passion, will, and sufficient capital, you'll learn how to code and develop effective strategies, manage risk, and diversify a portfolio of trading systems to greatly improve your chances of becoming successful.