- GuruFinance Insights
- Posts
- ChatGPT Trading Strategies (How To Use AI To A Strategy)
ChatGPT Trading Strategies (How To Use AI To A Strategy)
ChatGPT, an AI developed by OpenAI, functions as a versatile tool for tasks such as responding to queries, supplying information, and participating in conversations. It is constructed on the GPT (Generative Pre-training Transformer) architecture and undergoes training using a vast dataset of responses generated by humans.
This model excels in producing text that closely mirrors human language in reaction to prompts and can be fine-tuned for specific purposes like language translation, answering questions, and summarizing text. The primary objective is to provide assistance and furnish accurate information to users.
By employing an “attention mechanism,” the model focuses on particular input elements during the output generation process. Additionally, it utilizes beam search, a technique that generates multiple hypotheses and selects the most likely one as the final output.
Although currently in an open beta phase, continuously learning and updating its knowledge, ChatGPT has earned acclaim for its ability to generate human-like responses and produce nearly flawless code based on input. Nonetheless, it might exhibit inaccuracies and occasionally demonstrate overconfidence when delivering incorrect information.
Step-by-step: Using ChatGPT to Write Scripts and Trading Algorithms
To use ChatGPT to write options trading scripts, you will first need to access the model through an API or by using OpenAI’s GPT-3 Playground. Find that link here. You’ll also want to get comfortable with a brokerage that allows direct plug-ins of a script into their interface, so that you can fully automate your trading process and get the most out of the trading algorithm. Three solid brokerages that allow this and still allot for excellent order execution are IBKR, Thinkorswim, and Tradier. We have no affiliation with any of them. Additionally, Thinkorswim in particular offers a solid paper trading platform that you can use to test these strategies in a risk-free manner, with real market data..
Once you have access to the model and have become familiar with your brokerage of choice, you can input your desired trading strategy and parameters, and ChatGPT will generate code based on your inputs. Then, you can test the script using historical market data and make any necessary adjustments before using it in live trading. Let’s look at a few example scripts and trading algorithms that we’ve built to shine some light on the process.
QQQ Strategy: Bullish When the RSI is Oversold
For a simple starter script, let’s look at the RSI rule.
For the uninitiated, RSI — or the relative strength indicator — attempts to depict when a security is oversold or overbought, and by how much. A simple rule of thumb for reading RSI is that when the RSI is below 30, a security is oversold, and prone to bounce. Likewise, when the RSI is over 70, the security is overbought, and prone to take a pause.
With that in mind, let’s make a rudimentary script that does just that, using QQQ as the target, and at-the-money options as the tool.
Simple — a python script you could plug directly into a brokerage for auto-execution of trades when the RSI fits the parameters described. When this strategy was back tested on SPY using the 15 minute timeframe it carried a win rate of 66% according to TrendSpider.
But how about a more complex strategy?
Reply