Your implementation in MQL5 is a feat of engineering, especially given the limitations of the environment. But if speed and scalability are your goals, Python with ML frameworks will give you:
-
Faster training
-
More accurate models
-
Easier testing and visualisation
You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
Check out the new article: Neural network trading EA based on PatchTST.
The revolution began in 2017 with the publication of the article "Attention Is All You Need". Transformers have revolutionized sequence processing in NLP, but their application to financial time series has encountered significant hurdles.
The main problem is computational complexity. The attention mechanism requires computing correlations between each pair of elements in the sequence. For a sequence of length N, this gives O(N²) operations. When N = 1000 bars (which is the minimum for serious analysis), the number of operations reaches a million. Each operation involves a high-dimensional matrix multiplication, making the computation extremely resource-intensive.
Moreover, traditional transformers were designed for discrete tokens — words in a text. Financial data are continuous time series with a complex internal structure. Simply applying transformers to price data ignores this specificity. Tokenization by individual bars loses important information about local patterns within short time windows.
Attempts to adapt vanilla transformers for finance have encountered the problem of overfitting. The model easily memorized specific sequences from training data, but could not generalize knowledge to new market situations. This was especially evident during periods of high volatility or structural market changes.
This is where PatchTST comes in — an architecture that revolutionizes how neural networks should analyze financial time series. It is not merely another transformer, but a specially adapted system that understands the nature of market data and works with it like a true professional trader.
Author: Yevgeniy Koshtenko