Errors, bugs, questions - page 2586

 
Slava:

Start by reading the article https://www.mql5.com/ru/articles/239

Read it. But I didn't see any answer, why CopyTime(_Symbol,PERIOD_M15,D'2015.01.01',100000,time); it reads 30k bars instead of 100k bars in the tester. At the same time in the terminal it reads everything correctly.
 
elibrarius:
Read. However, I have not received an answer, why the tester of CopyTime has calculated 30 bars instead of 100 000 bars. At the same time in the terminal, it reads everything correctly.

The history for the used instruments is downloaded by the tester from the client terminal (not from the trading server!) automatically when first accessing this instrument.

The testing agent downloads only the missing history with a small margin, in order to provide the necessary data on the history to calculate the indicators at the time of testing. The minimum amount of history to be downloaded from the trade server for timeframes D1 and less is one year. So, if you start testing on the interval 2010.11.01-2010.12.01 (testing on the interval of one month) with the period M15 (each bar is 15 minutes), the terminal will request the history for the whole year 2010. For the Weekly timeframe, we will request the history of 100 bars, which is about two years (there are 52 weeks in a year). For testing on Monthly timeframe the agent will request the history for 8 years (12 months * 8 years = 96 months).


Summary

In the testing settings set the monthly timeframe

 
Slava:

The history for the used symbols is downloaded by the tester automatically from the client terminal (not from the trade server!) the first time it accesses this symbol.

The testing agent downloads only the missing history with a small margin, in order to provide the necessary data on the history to calculate the indicators at the time of testing. The minimum amount of history to be downloaded from the trade server for timeframes D1 and less is one year. So, if you start testing on the interval 2010.11.01-2010.12.01 (testing on the interval of one month) with the period M15 (each bar is 15 minutes), the terminal will request the history for the tool for the whole year 2010. For the Weekly timeframe, we will request the history of 100 bars, which is about two years (there are 52 weeks in a year). For testing on Monthly timeframe the agent will request the history for 8 years (12 months * 8 years = 96 months).


Summary

In the testing settings set the monthly timeframe

It's clear - it saves resources.

What if I want to test on M15, but need several years of data (to train a neural network)? Should we store the bars in our own files?

 
Roman:

memcpy used as shown inRenate's examplearticle.
Using other copy functions causes the same problems.
The behaviour with these functions is described in this post and in this
All possible copy functions have been tried.

What do you know about sharing data from multiple threads?

 
Ilyas:

What do you know about multi-threaded data sharing?

The code uses lock_guard
But if it is commented out, there is no change
.

recursive_mutex mtx;
const wchar_t* data;
bool success ;
                
while (condition)
{
        
   if (DataAvailable())
   {
      lock_guard<recursive_mutex> locker(mtx);
      success = ReadData();
   }
        
   if (success)
   {
      lock_guard<recursive_mutex> locker(mtx);
      data = getData();
                
      memcpy(out, data, wcslen(data) * (sizeof(char)*3));
   }
        
   Sleep(1);
}
Still started to leak, but it's understandable why, because the sizeof isn't right
Files:
222.PNG  13 kb
 
elibrarius:

I see - saving resources.

But what if you need to test on M15, but need several years' worth of data (to train a neural network)? Do you need to store the bars in your files?

We just need to wait:

input int InpBars = 100000;

void OnTick()
{  int bars = Bars(_Symbol, _Period);
   if(bars < InpBars) return;

}
 
elibrarius:

I see - saving resources.

But what to do if I need to test on M15, but I need data for several years (to train a neural network)? Should we store the bars in our own files?

What is the problem? You can access data from any timeframe.
 
Slava:
What's the problem? You can access data from any timeframe.

If I run the test on M15, because the trade in the tester will be on M15, I will not be able to count 100000 bars from the history. But we need to test the trading on M15.

If I run it on Мonthew to have a history for 8 years, I will not be able to trade more than once a month.

 
elibrarius:

If I run the test on M15, because the trade in the tester will be on M15, I will not be able to count 100,000 bars from the history. And I need to test trading on M15.

If I run it on Мonthew to have a history for 8 years, then I will not be able to trade more than once a month.

Why not?

 
Alexey Viktorov:

Why?

The opening prices are being tested. The tick will come once a month.
If you run on all real ticks, you can with strong redesign and complication of code. It will also waste resources. I think it would be easier to read bars from files.