Using AI for Stock Trading Analysis

12/18/20244 min read

AI is the underpinning technology used behind everything we do at Architects of Alpha. A number of people have asked how and this article is a short basic introduction to the ways in which AI can be leveraged to help day to day traders or long term investors find opportunities in the market. While we won't give all our trade secrets away, we hope this helps you generate some new ideas to help you become a more informed participant in the financial markets.

Introduction:

Irrespective of what AI you actually use, the key to generating useful insight is to learn prompt engineering. That's just a fancy way of describing how to ask your AI the right questions. A clear and well-structured prompt helps AI better understand your request. An easy way to remember how to do this is to learn C-P-R.

To create an effective prompt, use the "C-P-R" Framework:

  1. Context

    • Decide on a persona and provide background information to set the stage.

  2. Prompt/Request

    • Clearly state what you want the AI to do.

  3. Requirements/Constraints

    • Specify any guidelines, limits, or format preferences.

💡Example ChatGPT Template:

  • Context: Please act as a strategic financial stock analyst. I’m looking for insights on a company's recent financial performance.

  • Prompt/Request: Summarise the key takeaways from the latest quarterly earnings report for [Company Name].

  • Requirements/Constraints: Focus on revenue growth, profit margins, and any changes in guidance. Provide the summary in bullet points.


IMPORTANT NOTE: Remember to always always always check and verify everything. AI will make mistakes, so test, check and recheck for 'hallucinations'.

💡Example Prompts for Stock Analysis, Financial Reports & Price Chart Analysis

1️⃣ Stock Analysis: Valuation Insights

Context:
Please act as a strategic financial stock analyst. I want to understand whether [Company Name] is currently overvalued or undervalued compared to its peers.

Prompt/Request:
Provide a comparative valuation analysis for [Company Name] against its competitors, including key metrics like P/E ratio, PEG ratio, and Price-to-Book ratio.

Requirements/Constraints:
Focus on recent data (last 3 months). Explain in simple terms for a beginner. Include any notable trends or anomalies.

2️⃣ Financial Report Breakdown

Context:
Please act as a strategic business analyst. I’m interested in [Company Name]'s latest earnings report and how it might impact future stock performance.

Prompt/Request:
Summarise the most important elements of [Company Name]’s Q3 2024 earnings report, including revenue, net income, and management’s forward guidance.

Requirements/Constraints:
Present the information in a concise summary (under 200 words). Highlight any surprises or deviations from analyst expectations.

3️⃣ Market Sentiment Analysis

Context:
Please act as a professional stock analyst using investing principles of Warren buffet. I want to gauge how investors are reacting to [Company Name]’s latest financial news.

Prompt/Request:
Analyse the market sentiment around [Company Name] following their recent earnings announcement. Summarise opinions from analysts, media, and investor forums.

Requirements/Constraints:
Highlight positive, negative, and neutral sentiments. Provide key quotes or insights that capture the general mood. Keep it under 300 words.

4️⃣ Chart Screenshot Analysis for Price Levels

Context:
Please act as a stock analyst. I have attached a screenshot of a stock chart and want to identify potential buy and sell levels based on price patterns, support, resistance, and technical indicators.

Prompt/Request:
Analyse the attached screenshot of the stock chart and identify potential buy and sell levels. Highlight key support and resistance zones, recent price patterns, and any technical indicators (e.g., moving averages, RSI, trendlines) that can help pinpoint entry and exit points.

Requirements/Constraints:

  1. Clearly mark buy levels (potential support) and sell levels (potential resistance).

  2. Explain the reasoning behind each level identified, referencing patterns like double bottoms, breakouts, or trendline bounces.

  3. If applicable, provide a brief explanation of how indicators (moving averages, RSI, volume) support the identified price levels.

  4. Limit the response to 300 words.

📝 Key Takeaways for Prompt Engineering

  • Be Specific: The more detail you give, the better the output and don't forget to create a persona

  • Set Constraints: Define format, word count, or focus areas.

  • Iterate and Refine: If the output isn’t perfect, tweak your prompt.

For the more advanced user you can also use AI to help you with programming of scripts for charting packages such as Trading view but always check the accuracy with back testing.

📊 Example Prompt for Pine Script Development

Context:
Act as an expert pine script programmer. I want a Pine Script to use on Trading View that identifies buy and sell opportunities based on a combination of moving averages and the Relative Strength Index (RSI).

Prompt/Request:
Create a Pine Script that generates buy and sell signals when the following conditions are met:

  1. Buy Signal: The 20-period simple moving average (SMA) crosses above the 50-period SMA and the RSI is below 70.

  2. Sell Signal: The 20-period SMA crosses below the 50-period SMA and the RSI is above 30.

Requirements/Constraints:

  • The script should visually mark buy signals with a green upward arrow and sell signals with a red downward arrow on the chart.

  • Include comments in the script to explain each part of the code.

  • Ensure the RSI period is set to 14.

  • The script should work on multiple timeframes (e.g., 1-hour, 4-hour, daily).

The possibilities are endless and the above are just a few possible examples. The real power of AI is in your ability to engineer (craft) the perfect prompt and that's only limited by your imagination. Good luck and happy hunting for that edge! 🚀📊