Discussing the article: "Quick Integration of a Large Language Model into MetaTrader 5 (Part I): Building the Model"

 

Check out the new article: Quick Integration of a Large Language Model into MetaTrader 5 (Part I): Building the Model.

The article explores the revolutionary integration of large language models (LLMs) with the MetaTrader 5 trading platform, where AI does not simply predict prices but makes autonomous trading decisions by analyzing market context much like an experienced trader. The author highlights a fundamental difference between LLMs and classical machine learning models such as CatBoost — the ability to engage in metacognition and self-reflection, which allows the system to learn from its own mistakes and improve its strategy.

You have created a trading bot. The backtest is perfect: the equity curve is rising, and the win rate is 70%. But on the live account, there are losses. The algorithm buys when RSI is oversold ahead of a Fed decision, opens trades on Friday evening, and ignores news that could reverse the market. It sees the pattern, but not the context.

Even machine learning cannot help. CatBoost can predict the direction of a candle with 73% accuracy, but it does not realize that liquidity is low today and the spread has doubled. The model knows which way, but not when.

We need a system that thinks — one that takes into account charts, time, the day of the week, news, and volatility. One that is capable of saying, "There is a signal, but the risk is not worth it — I will skip it."

Large language models (LLMs) provide this flexibility. Their strength lies in emergence: complex behavior arises from a multitude of simple interactions. It is like the brain: each neuron is simple, but together they form consciousness. LLMs work on the same principle.


Author: Yevgeniy Koshtenko

 
And how do you filter out the false positives? Even Googlebot often swaps ‘yes’ for ‘no’ in its replies (as if it overlooks the negative in source documents in phrases such as ‘this feature is not supported’ and constructs its reply based on the logic that ‘this feature is supported’), takes specifications from the wrong object to the one you’re asking about, and so on. You have to cross-check every word in the answer against the original sources – thankfully, they’re provided there.
 
Stanislav Korotky #:
And how do you filter out the false positives? Even Googlebot often swaps ‘yes’ for ‘no’ in its replies (as if it overlooks the negative in source documents in phrases such as ‘this feature is not supported’ and constructs its reply based on the logic that ‘this feature is supported’), or takes characteristics from the wrong object that you’re asking about, and so on. You have to cross-check every word in the response against the original sources – thankfully, they’re provided there.

I started working on this topic not so long ago. I’m writing the OpenAI API in pure MQL5. And the server for the model is llama.cpp.

You need to give the model instructions that are as mathematically precise as possible and demand clear, to-the-point answers. Reduce the temperature to the minimum (0–0.2) to prevent it from making things up. Select the largest local models that the system can handle (on my 12 Gb VRAM – up to 15B, and with a slight slowdown – up to 30B). Test them and select the best one (and there are plenty to choose from). Whilst you’re doing this, model development continues, and small, smart models are emerging. You can then fine-tune the model (LoRA). If, God forbid, there’s any suggestion that the project might be profitable, you can switch to large, paid online models. Or at least upgrade your computer to two GPUs with 24 Gb and plenty of RAM.

There’s work galore. We’ll see. We’ll try working with the models, taking their charming quirks into account.

 

I’m reading a study on the applicability of various types of LLMs and their training/fine-tuning for time series forecasting:

Summary from the text (apologies for the English – click the button to translate):

"Pretraining + Finetune" method performed the best 3 times, while "Random Initialization + Finetune" achieved this 8 times. This indicates that language knowledge offers very limited help for forecasting. However, "Pretrain + No Finetuning" and the baseline "Random Initialization + No Finetuning" performed the best 5 times and 0 times, respectively, suggesting that Language knowledge does not contribute meaningfully during the finetuning process.

In Russian: it makes no sense to use a ready-made language model for time series forecasting; it’s better to start with a blank template with a cloud of connections (the more, the better, obviously) and train it on your own time series, without fine-tuning. Judging by the publications, the embedding type has a significant impact on quality – I’m not sure whether you can select it in Llama.

The question remains as to whether this approach is feasible on affordable local hardware.

 
MetaQuotes:
Yevgeniy Koshtenko
An excellent article.
I’m also exploring the potential of LLMs for trading on the markets.
Working via an API like OpenAI quickly becomes expensive: thousands of requests a day — hundreds of dollars a month. Plus, there are limits, downtime and the risk of data leaks: your strategies end up on someone else’s servers.

For medium-term trading, the API isn’t actually that expensive. Take the one-hour timeframe, for example. Analysing the trading situation after a candlestick closes = 24 requests. For me, that works out at 0.20–0.50 cents per day (depending on the prompt size). The model is OpenAI’s GPT-5-mini.

 

What are the minimum hardware requirements for running the configuration described in the article?

I can’t seem to find any information on the ollama.com website...