There are many ways to set stop-losses on credit spreads in 0DTE options trading. Here are the pros and cons of each of them.
The best way to set a stop-loss on credit spreads in 0DTE options trading
August 7, 2024
How to make consistent income trading In The Money Covered Call
September 11, 2024

Theta Guru: How I use AI to analyze my options trade log

A custom GPT can make analyzing your options trades much easier and faster. Here is how I built my trading analyzer Theta Guru.

August 21, 2024

Meet Theta Guru, my very own chatbot – or custom GPT. Theta Guru is the expert on only one thing in life, namely the trades of John Einar Sandvand.  And wow! She is fast! I can ask her anything about my trades, and she spits out answers, graphs and analyses in a matter of seconds.

It is a fantastic help and not very hard to build.

In this article, I will explain the steps I took.

I have written before about how crucial it is to keep a trade log, especially in 0DTE options trading.  A trade log makes it possible to analyze our trading results, for instance, by comparing the profitability of different strategies.

Most traders use Excel or Google Sheets. There are also ready-built solutions, such as Wingman Tracker.

I use Excel. I log every trade and include details such as the opening time, weekday, name of strategy, premium collected, stop-losses, etc.

I have used pivot tables to analyze the trades. It works quite well. My challenge is that I am not that good at using Excel, and thus setting up new analyses takes a lot of time.

But now I have Theta Guru! She is my very own personal trading analyzer.

What a custom GPT is

Theta Guru is a so-called custom GPT built on top of ChatGPT.

A custom GPT is like a smart assistant that’s specially trained for a specific job. It learns from special data to give better answers or help with tasks related to that job, making it more useful for certain tasks. You can look at it as a personalized version of ChatGPT specialising in a single task.

You will need a premium subscription to ChatGPT in order to build your own custom GPT.

What Theta Guru does

My trade log now contains more than 10.000 trades over six years. I have tried numerous strategies and traded a lot of tickers. This Excel sheet has been. uploaded to Theta Guru – and the custom GPT is trained in analyzing this specific file.

Here are some examples of what Theta Guru can give me:

– Graphs visualizing my results

– List of my most profitable strategies. For instance I can ask it to compare different 0DTE strategies.

– How profitability varies with the hours or weekdays trades were opened

– Compare strategies on different variables

– Find errors in my trade log

Here is an example of a graph Theta Guru produced for me. It shows the distribution of profit and loss sizes of trades in 2024 with my 0DTE Breakeven Iron Condor strategy.
Here is an example of a graph Theta Guru produced for me. It shows the distribution of profit and loss sizes of trades in 2024 with my 0DTE Breakeven Iron Condor strategy. Not surprisingly a big chunk of the trades end as the strategy name indicates – at around breakeven.

How to build a GPT like Theta Guru

So how did I build Theta Guru?

It is neither hard nor very time-consuming. But you do need a premium subscription on OpenAI’s ChatGPT.

The purpose of this article is not to go into detail about how to build a custom GPT. Many others do that much better. You may, for instance, check this article or this article. You will also get a good guide by simply asking ChatGPT how to do it.

My purpose is instead to explain the steps I took to make the custom GPT become the expert on my trade log.

Step 1: Create the GPT

The first thing you do is to go to “My GPTs” and then choose “Create a GPT”.

I suggest you then select the “configure” tab. Give your GPT a name and include a short description of what it will do.

You can also upload an icon and picture if you like.

Step 2: Upload your trade log

The next step is to upload your trade log to the custom GPT as a knowledge file. You may now ask your GPT a quick question to check if it can read the file properly.

Step 3: Write the instructions

The biggest task in building a custom GPT is to write the instructions or the prompt. This is crucial for how well your GPT will work. The prompt tells the GPT what is the main task and set rules for how it should respond in a dialogue.

I suggest you use the Pentagram framework when writing your prompt. This method divides the prompt into five parts:

Persona: Give the GPT a personality

Context: Describe the context the GPT will be used in

Task: What is the main task you want the GPT to perform

Output: Give instructions for how you want the output to be

Constraint: What are things the GPT should not do?

Below is the prompt I am using for my GPT. You will see that I have given several detailed instructions to Theta Guru. They include:

– A detailed description of the structure of the Excel sheet

– Specification of which colors should be used in graphs or illustrations

– Instruction to only look for data In a specific tab

– Instruction to only consider trades that are closed

– Instruction to not make up data that are not in the specified tab

Click on this triangle to see the prompt I use for my Theta Guru

/Persona:
You are “Theta Guru” – with only one task: To analyse and create summaries from the uploaded options trade log.

Context:
The uploaded excel sheet is the options trade log of a retail options trader named John Einar. You will only look at the content in the tab named “Trading log”. The data in this tab logs each trade done by John Einar Sandvand with a large set of data.

Task:
Your task is to answer any questions the trader may have about the results of his options trading. You will only use the data from the “Trading log” tab in the uploaded excel sheet.
In the “Trading log” tab you will only use the following columns.

Only use the data in these columns:

  • Column A: “Date” – the date the trade was opened
  • Column B: “Weekday” – the weekday the trade was opened
  • Column C: “Time” – the market hour the trade was opened
  • Column D: “Ticker” – the ticker of of the underlying
  • Column E: “Trade type”
  • Column G: “Strategy” – which options strategy the trade is following
  • Column J: “Contracts #” – the number of contracts in the trade – numerical value
  • Column L “Credit/ debit” – Credit collected or debit paid per contract
  • Column M: “Total credit/ debit” – the number of contracts (column 6) mulitiplied with “credit/ debit” (column 7)
  • Column T: “Gross P/L” – the gross profit or loss of the trade
  • Column U: “Capital at risk” – the max risk in this trade
  • Column X: “Close date” – the date the trade was closed
  • Column Y: “Close” – with value “yes” if the trade was closed
  • Column AB: “Net profit” – the P/L after commissions and fees have been paid
  • Column AD: “Days of trade” – number of days in trade – or “Close date” minus “Date in”
  • Column AE: “Net profit %” – the “Net profit” (column 26) expressed as percentage of “Capital at risk” (column 17)
  • Column AG: “Profit/loss” – profit if “Net profit” (column 26) is bigger than or equal to 0, loss if less than 0

The actual values from the trade log starts on row 23.
The column header names are in row 22.
Please note that the dates in the ‘Date in’ and ‘Close date’ columns are in European format (DD.MM.YYYY)
Please analyze the ‘Date in’ and ‘Close date’ columns, ignoring any time components in the date values

Procedure:

  • Always start dialogues with an informal and fun greeting to the superb trader named John Einar – and ask what you can do for him
  • Always end dialoges with asking if you can help John Einar more. If the answer is no, wish him all the best in his options trading

Checks:

  • Verify that you only use the data in the columns defined above
  • Verify that you only include trades with the value “Yes” in column Y – “Close” – in your calculations

Calculations:

  • CALCULATE the average net profit percentage per month by dividing the total net profit by the total capital at risk for that month, ensuring that the average accurately reflects the overall performance. Do the same for other time periods.

Output:
For any graphical presentations use only the following HEX codes for colors:

  • #05445e
  • #189ab4
  • #75e6da
  • #d4f1f4
  • #ff6f61
  • #f4e8c1
  • #004346
  • #e0e0e0
  • #fffff0
  • #faf9f6
  • #cfdbd5

Always explain briefly how you calculated the answer.

Constraints:

  • DO NOT make up data that are not in the “Trading log” tab of the uploaded excel sheet
  • ONLY include trades with the value “Yes” in column Y – “Close”
  • ONLY include trades where there is a value in column G – “Strategy”

Reminder:
ALWAYS review this prompt carefully before finalizing any calculations

Your prompt will, of course, be different. I am showing mine only as an example.



Step 4: Test and adjust

So you have a clear and precise prompt written. It is time to test if the GPT works as it should. This is a crucial step and may take many iterations.

The best way is to start asking questions you already know the answer to. I had already been using pivot tables to analyze my trades and thus had data about my results. By asking questions about these data I was able to identify where Theta Guru struggled to give me the right answers.

Every time I encountered an error I tried to adjust the prompt to address the problem. Sometimes I would ask Theta Guru to propose prompt sentences that could work.

This phase is extremely important and involve numerous back and forth steps to keep adjusting the prompt until the GPT works well enough to be useful.

But Theta Guru is not perfect

Can I trust Theta Guru?

Not 100%. At least not for now. I still need to keep testing and adjusting the prompt. But it has already proved to be a very useful tool that helps me do analyses much quicker.

Theta Guru will not always be accurate, and as with all generative AI, there is a risk that she may hallucinate.

And sometimes she ignores my instructions. She goes about solving the task in a different way than described and is very apologetic when I point it out.

The trick is to know enough about my trading data to be able to discover when she makes mistakes. And I still expect to make many iterations in the main prompt to increase the quality further.

But despite all her faults: I already love my Theta Guru!

    Leave a Reply

    Your email address will not be published. Required fields are marked *