Discussing the article: "Neural Networks in Trading: LSTM Optimization for Multivariate Time Series Forecasting (Final Part)" - page 2

 
Vladimir Sanin #:

So, do I actually need to plot it on the graph and run the test with optimisation? We’re not talking about the online version here, are we? I’m not sure which date range to use for the Study – any will do? I’ve run the test with visualisation; I can see the data changing in the top-left corner, but the graph isn’t updating. The percentages in the data are increasing gradually, simultaneously and uniformly, but the graph itself isn’t updating.


That’s correct. That’s how it’s supposed to be.

 

I’d like to ask the author: is that how Research is supposed to work?



 
Andrey Yankin #:

I’d like to ask the author: is this how Research is supposed to work?



I’m not the author, but I’ll answer. That’s exactly how it’s supposed to work. But there’s no point in running it on a schedule. It needs to be run in the tester with full optimisation of the agent parameter. This generates a trajectory file, which will then be used for training.

 
Andrey Yankin #:

That’s right. That’s how it should be.

But how exactly? Should I just study the chart? Or should I run it on the chart and in the backtester at the same time? And in the backtester, should I use optimisation or run a single test? And if I use optimisation, which parameter should I optimise?

 
Andrey Yankin #:

Simply place Study on the chart. Once installed, it reads the data files and then begins optimisation. Progress and results are displayed in the top-left corner of the chart.

On a 15-minute timeframe, 3,000 trades in half a year... This works out as a trade being opened on almost every second candle, and all of them are Sell trades. You can verify this either by running a single backtest with visualisation or by installing it on a demo account. Trades are opened and closed on the very next candle.

But shouldn’t it be like that? How should trades be opened? Only as ‘Sell’ trades, or should there be ‘Buy’ trades as well? Do the indicator settings have any influence on this?

 
Regarding the MinProfit input parameter (default = 10) in Research. Does it filter out unprofitable sessions? Am I correct in understanding that it can be set to a negative value, and that this won’t make things any worse?
 

I’ve noticed that when performing parallel optimisation (using several local agents), the size of the DACGLSTM.bd file fluctuates: one pass writes ~250 MB, the next ~200 MB, and then 250 MB again. It turns out that in `SaveTotalBase()`, the file is opened as follows:

int handle = FileOpen(FileName + ".bd",
FILE_WRITE | FILE_BIN | FILE_COMMON); // overwrites!

The last agent to finish deletes everything saved by the previous ones.
To ensure the trajectories are accumulated, I suggest replacing this with:

int handle = FileOpen(FileName + ".bd", FILE_READ | FILE_WRITE | FILE_BIN | FILE_COMMON);
FileSeek(handle, 0, SEEK_END); // append to the end

The limit is still set via MaxReplayBuffer, so any excess data will be trimmed off when saved anyway.

Questions:

  1. Are there any pitfalls to this ‘append mode’ in MT5?

  2. Perhaps it would be better to keep a separate .bd file for each agent and then merge them?

 
Vladimir Sanin #:

Questions:

  1. Are there any pitfalls to this ‘append mode’ in MT5?

  2. Perhaps it would be better to keep a separate .bd file for each agent and then merge them?

Option 2 is possible, but the standard solution is to send data from the agents to the terminal in frames and have the terminal save it to a single shared file.

Option 1 could ‘crash’ at any moment if several agents attempt to write simultaneously – one might write successfully, whilst the others would fail with errors.

 

|
I ran a 5-minute run in Research for one month, which resulted in a 300MB DACGLSTM.bd file. I launched Study. The error rates are alarming. Or is this normal for the very first run?
 
Does anyone else know their way around this neural network? TG:@vigit