Algo programming with ChatGPT

ChatGPT has been out there for a couple of weeks, but it seems everybody is obsessed with its capabilities in the various fields of computer programming. We gave it a try and tested its competencies on trading algo programming.

ChatGPT

ChatGPT is a state-of-the-art chatbot based on the powerful GPT-3 language model developed by OpenAI. It can carry out natural and engaging conversations with users on a wide range of topics.

One of the standout features of ChatGPT is its ability to understand and generate human-like language. This allows it to have more natural and engaging conversations with users, making it a valuable tool for customer service, virtual assistants, and even social media.

In terms of performance, ChatGPT has been shown to be highly effective in carrying out its tasks. In tests, it has demonstrated an impressive ability to understand and respond to user input, even in complex and nuanced situations. This makes it a valuable tool for businesses looking to improve their customer service and reduce the workload on their human employees.

While ChatGPT is not specifically designed for programming, its capabilities make it a potentially valuable tool for assisting with various aspects of the software development process. It could provide real-time analysis, automate certain tasks, and improve the overall efficiency of the programming process.

Let’s give it a try

As it was promised, we started communicating with the chatbot with simple English sentences. Our requests were straightforward, and we gave different tasks regarding trading strategy development.

As the main scope of this blog is EasyLange-based algo development our first command was:

Write a trend following EasyLanguage strategy for ES

ChatGPT got it absolutely right. It understood the context: we want a trading strategy written on EasyLanguage. This strategy should follow trend-following principles. In other words, it should be based on price breakout entries. Finally, this strategy should work on the SP500 market.

The generated strategy code looks like a fine EasyLanguage code. After a quick validation, we found that this code can be compiled by Tradestation and Multicharts.

The generated code comes with 3 input parameters: EntryLength and Exitlength are typical trend-following system properties. And here comes the first flaw of this generated system. The StopLoss variable name indicates that this variable is implementing an exit rule, but it is just an optimizable offset for calculating the entry stop price. An experienced strategy developer with human intelligence would probably never choose a variable name like this.

Anyways, we wanted to see what this piece of algo is capable of? What is the big picture and how robust is this strategy?

Results

We used Tradesq to optimize the strategy for all supported future markets and sectors. Scheduling optimization is easy in Tradesq. Check this article for an example.

The filtered results table indicates good results for the Currency, Index, and Meat markets. These results are fine enough and typical for trend-following.

Finally, let’s look at the best equity curve provided by this research. According to the performance metrics that are the 30 minutes XBI (S&P biotech sector ETF):

Beautiful equity curve indeed. Is this a robust system or just an over-optimized equity curve? Time will tell. One thing is sure: Tradesq’s Forward Testing module will pick this system up and follow its performance in the coming months and years. Read our article about how hundreds of trading algos are forward-tested in Tradesq. We will follow up on the performance results of this system in 6 months’ time.

Leave a Reply