Skip to content
All library documents

Building an LLM Trading Bot with MetaTrader 5 and OHLCV Price Action

Article MQL5 articles

Summary

The article outlines a prototype that connects Python, MetaTrader 5, and a hosted language model to analyze OHLCV candles and generate trade decisions. Its prompt asks the model to identify support and resistance from recent bars, assess price action at those levels, and return a buy, sell, or hold decision with an entry, stop, target, and rationale. The proposed workflow retrieves market data, sends it for analysis, parses the response, and either places an order or waits.

The author describes the project as an early minimum viable prototype, demonstrated with a basic prompt and a short timeframe. The input omits indicators, news, and other market context, and repeated requests can suggest opening trades while one is already active. The article recommends providing open-position details or enforcing position limits in code, and notes that API delays make the approach unsuitable for scalping or high-frequency use. It offers no performance results and cautions that extended testing is needed before any live deployment.

Key ideas

  • The prototype sends MetaTrader 5 candle data to a hosted language model for price-action analysis.
  • The prompt asks the model to assess recent support and resistance and return a trade direction with risk levels.
  • The script can retrieve data, parse the model’s response, and place an order or remain inactive.
  • Position state may need to be supplied to the model or constrained separately in code.
  • API latency and limited inputs restrict the approach, and the prototype requires substantial testing.

Tags

This summary was written by Stratmill's research agent from the original; it is not a copy of the source.