script (⏱,💰)

script (⏱,💰)

Is it reliable to use LLM for technical analysis?

This article is aimed at readers who have a basic understanding of cryptocurrency trading and want to use AI for technical analysis.

1. Background#

There has been an increase in discussions about contract trading in the community recently, indicating potential market demand. Considering that large language models (LLMs) have surpassed average programmers in the field of programming, I have developed an AI trading assistant robot called CoinGlass on the MyShell platform to verify the capabilities of LLM in the trading field.

CleanShot 2024-08-05 at 10.54.03@2x

The name "CoinGlass" is derived from the data platform coinglass.com, which provides comprehensive contract trading indicators. When using CoinGlass, you need to upload a screenshot of CoinGlass for analysis by the robot. In addition, the robot also supports the analysis of other technical indicator charts, such as Tradingview or exchange charts.

MyShell is a Web3 AI platform that allows users to create, share, and profit from AI applications. Creators can develop and publish AI applications quickly using powerful LLM without the need for coding.

The robot is designed as an "expert in cryptocurrency derivatives trading". After extensive backtesting and iterative optimization, it performs well in most cases. Here is a short position recommendation for SOL when it was still above 150 on August 4th: https://app.myshell.ai/share/AjMbEj

Note: Financial market trends are unpredictable. Although the recommendations are provided by AI, users should always be cautious of risks.

2. Design Concept#

The effectiveness of technical indicators varies depending on the situation. You need to have a deep understanding of the indicators and choose them based on different trading strategies.

Top traders usually focus on controllable factors and risk management in the present, rather than predicting the uncertain future market trends.

When designing prompts, I referred to the experiences of multiple traders and selected several commonly used cryptocurrency trading indicators. The parameter settings of the indicators are consistent with the default interface of the largest cryptocurrency exchange, Binance.

The main problems encountered during development were:

  • Minor differences in the same chart leading to inconsistent output results
  • Different output results when using different languages
  • Difficulties in accurately identifying specific values of indicators, especially the relationship between moving averages and prices
  • Inability to accurately interpret the meaning of abnormal indicators

After multiple iterations, the latest version uses CoT (Chain of Thought) technology to analyze the charts in the following steps: 1. Read the chart 2. Identify indicator features 3. Analyze the direction 4. Find resistance and support levels 5. Calculate the risk-reward ratio 6. Assess the feasibility of the trade 7. Quantify the indicator scores 8. Calculate the total score 9. Provide trading recommendations.

All subsequent analysis is based on the indicator data obtained in the first step to ensure the consistency and traceability of the results.

The robot uses the Claude Sonnet 3.5 model with a temperature parameter set to 0 to ensure consistent output results for the same input.

3. Pros and Cons of LLM in Technical Analysis#

During development, I found the following pros and cons worth noting when using LLM for technical analysis:

Pros#

  • Image pattern recognition: LLM has encountered a large amount of image data during training, so it performs well in pattern recognition of trading charts such as candlestick charts.
  • Understanding of technical indicators: LLM can explain common technical indicators and provide insights.
  • Generalization ability: LLM can interpret various charts and indicators, answer diverse questions, and support multi-language output.
  • Ease of use: It is as simple to use and build as chatting.

Cons#

  • Need for guidance: For some technical indicators, you must explicitly provide specific hidden information to LLM. For example, when there is a divergence between CVD and price, there are different interpretations, but LLM often fails to discover potential signals.
  • Illusion: Without using the CoT method for step-by-step analysis, inconsistent or incorrect results may be produced. When using different language outputs, it sometimes leads to inconsistent trading recommendations.
  • Automated trading: Unless customized development is done locally, it is not possible to connect to live trading for automated trading.
  • Difficulties in backtesting: Evaluating the effectiveness of models and prompts is more complex compared to traditional quantitative trading and usually requires a large amount of manual testing.

4. User Guide#

how to use

The diagram above shows the basic operation process: open CoinGlass, take a screenshot, input the image and text to the robot, and then send it. However, there are many details to pay attention to in actual use.

First, open CoinGlass at https://www.coinglass.com/tv/Binance_BTCUSDT and register (registration is required to save layouts).

4.1 Set up the chart#

live layout

It is recommended to add additional indicators besides important contract data. Here are my choices for indicators (click "CoinGlass - Indicator" and "Indicators" in the top menu to select other indicators):

  • Primary Price: Basic category. Choose 1D, 4H, 1H.
  • Moving Averages (MA): Trend category. Choose 7/25/99, consistent with Binance's default settings.
  • Volume: Basic category. Default Binance SMA 9.
  • Aggregated Spot Cumulative Volume Delta (CVD): Volume category. CVD is usually led by spot trading and affects futures market. Therefore, choose the CVD of spot trading. Different currencies require different exchanges. For example, for the rebound of BTC on July 26-27, 2024, the CVD of CoinBase has been decreasing, while the CVD of Karken has been increasing, indicating that the spot buying on Karken has led to the price increase. Click ⚙️ on the chart to modify, and I usually select Binance + CoinBase.

CVD setting

  • Funding Rates: Contract category.
  • Long/Short Ratio (Accounts): Contract category. You can also choose Top Trader Ratio (Accounts).
  • Open Interest (Candles): Contract category.
  • Stochastic RSI: Oscillator category. Default settings: 14 14 3 3, consistent with Binance.
  • Aggregated Liquidations: Contract category.
  • ATR: Trend strength category, default 14.
  • Aggregated Spot Orderbook Liquidity Delta (±1%): Order flow category. Reference for depth when opening positions.

The above indicators cover basic indicators, important contract indicators, one moving average category, one volume category, one oscillator category, one trend strength category, and one order flow category, allowing the AI to have a comprehensive judgment of the market.

It is also recommended to make the following settings by clicking the ⚙️ in the lower right corner:

  • Open Symbol last price label to avoid not being able to read the latest value.
  • Close Indicator value labels to reduce text in the screenshot and allow the AI to focus more on changes rather than numerical values.

setting 1

  • Open High and low price labels and Price line to display high and low points, which are important resistance and support levels.
  • Close Count down to bar close to reduce unnecessary distracting information.

setting 2

After setting up, click "Save" in the menu bar to save the layout.

4.2 Take a screenshot#

When taking a screenshot, make sure the time span is not too small or too large. Right-click and select "Reset chart view" if needed.

Reset chart view

Then use the screenshot function of the webpage or a screenshot tool to manually take a screenshot. I usually use the "Take better screenshots and GIFs" software on MacOS to manually take screenshots.

Copy image

Ensure that the text and lines in the screenshot are clear and legible. If the indicator numbers read by the robot in the first step are incorrect, consider whether the screenshot is clear and concise enough. Different language interfaces can also cause recognition errors.

Here is a reference for a complete screenshot.

screenshot ref

4.3 Interact with LLM#

Access the CoinGlass MyShell robot at https://app.myshell.ai/bot/rYbENf/1713925324, click "+" to add a screenshot, or press Ctrl+V to paste the screenshot, and then send it.

CleanShot 2024-08-05 at 11.22.37@2x

When interacting with the robot:

  • Minimize irrelevant information: Provide the chart directly to avoid adding unnecessary text that may affect the robot's judgment.
  • Use English: To maintain consistency in judgment, it is recommended to directly use English to interact with the robot.
  • Clear memory: Before analyzing different currencies, it is recommended to click the "Clear memory" button to clear the previous conversation history to avoid the robot misunderstanding it as a multi-timeframe analysis.

Clear memory

  • Multiple timeframe analysis: Have a continuous conversation and provide charts from different timeframes to obtain a comprehensive view.
  • Respond to market changes: When significant changes occur in the market, provide the latest charts and current position information to request updated recommendations from the robot.

add text

4.4 Establishing Positions#

To optimize the risk-reward ratio, I use the following strategy:

  1. Analyze the charts of the 1-day and 4-hour timeframes. When the trends are consistent, determine the long or short direction.
  2. Observe the Stochastic RSI indicator on the 1-hour chart:
    • Long condition: Oversold (both lines above 80)
    • Short condition: Overbought (both lines below 20)
    • More reliable entry signals:
      a) Fast line crossing over slow line
      b) Divergence between Stochastic RSI and price
      Observe the chart below. After adding daily cycle lines, this strategy can almost daily find overbought or oversold trading opportunities.
      Stoch RSI
  3. When the Stochastic RSI reaches the target, send the 1-hour chart to the robot with the text "find entry to LONG/SHORT". It will tell you the entry point. You can also send the chart directly without additional text.
  4. Place orders manually and set stop-loss and take-profit levels.

Things to note:

  • Adjust the strategy based on personal trading habits.
  • Be patient and wait for the best entry opportunities.
  • Optimize entry points to increase profit potential under the premise of confirming the correct major trend.
  • In a one-sided volatile market, the stop-loss and take-profit levels given by the 1-hour chart are relatively conservative. You can use the 4-hour or 1-day chart for reference.

4.5 How to Backtest#

If you need to backtest, there should be no latest values on the chart. There are two methods:

Method 1#

  1. Close "Values in status line" for all indicators.
    CleanShot 2024-08-05 at 11.48.28@2x

  2. Open "Indicators value labels".
    CleanShot 2024-08-05 at 11.49.55@2x

  3. Save the layout.

  4. Drag the chart to the desired time, the last candle for backtesting. Take a screenshot.

Method 2#

  1. Drag the chart to the desired time, the last candle for backtesting.
  2. Move the mouse to any indicator position on the last candle. When a vertical dashed line appears, the displayed indicator values are historical values.
  3. Take a screenshot using a third-party tool.

CleanShot 2024-08-05 at 12.06.57@2x

Notes for backtesting with multiple timeframes#

When conducting backtesting with multiple timeframes, it is important to pay attention to the corresponding time relationship between different period candles. Here are the specific correspondences:

  • The daily candle corresponds to 20:00 of the next day's 4-hour candle and 23:00 of the 1-hour candle. If it is Beijing time (UTC+8), it corresponds to 04:00 and 07:00 of the next day.
  • The 4-hour candle at 04:00 corresponds to the 1-hour candle at 07:00.
  • The 1-hour candle at 09:00 corresponds to the 15-minute candle at 09:45.

This correspondence ensures the correct synchronization of data from different timeframes during the backtesting process and helps obtain more accurate backtesting results.

5. Conclusion#

LLM has the potential to enhance trading strategies and profitability by providing in-depth insights and trend recognition capabilities. Its user-friendly features make it easy for ordinary traders to use.

In the future, I will continue to improve the design of prompts and explore other use cases to further improve the effectiveness of AI in trading. The use of emerging models such as Claude Opus 3.5 is expected to bring better results.

Loading...
Ownership of this post data is guaranteed by blockchain and smart contracts to the creator alone.