Single array calculation during optimisation - page 4

 

Guys, how do I write the data on one line, separated by commas?)

I get it every time from a new line.

int Qnt=FileWrite(Handle,Time[0]);
if(Qnt<0)Alert("не получилась запись=");
   return(0);

In principle, it should work faster if I put all the data into an array at once, as advised:

double arr[100500]={1,2,3....} 
 
forexman77:

Guys, how do I write the data on one line, separated by commas?)

I get it every time from a new line.

In principle, it should work faster if all the data at once in the array, as advised:

I've read the article on string functions, I think I've done it:

string str1,str2;
   for (int y=stroki-1;y>=0;y--)
   {
   str1=T[y];
   str2=str2+","+str1;
   }
   Print("str2=",str2);
2016.09.15 21:42:58.649 запись данных GBPUSD,H4: str2=,1452038400,1454022360,1454104980,1456788420,1457130840,1459205760,1459463580,1459814040,1461621600,1461710760
 
forexman77:

Guys, how do I write the data on one line, separated by commas?)

I get it every time from a new line.

In principle, it should work faster if I put all the data into an array at once, as you advised:

Why would you want to do that? Dmitry gave links to documentation on reading and writing an array to a file.

As in "The Diamond Arm"... "With a wave of the hand, the trousers turn into..." Only in this case there are no technical malfunctions. After all, I didn't ask for nothing how writing and reading of the array is organized.
 
Does anyone have instructions on how to convert a normal file with digits to Bin? I can't figure out what the separator for the digits should be?
 
-Aleks-:
Does anyone have instructions on how to convert a normal file with digits to Bin? I can't figure out what separator the digits should have?
Read the digits into an array and then write the array to the file in binary mode.
 
Dmitry Fedoseev:
By reading the digits, we can stuff them into the array and then write the array to the file in binary mode.

I see, i.e. you can read the ready file with digits into an array (my case), then write it into a binary file, and then use it.

Well, if you need to read data of 10 arrays from the file, then you need to make a sorter, which will understand the end of the array by special digit and fill the next array... For it is not convenient to write the array size every time.

 
-Aleks-:

I see, i.e. you can read the ready file with digits into an array (my case), then write it into a binary file, and then use it.

Well, if you need to read data of 10 arrays from the file, then you need to make a sorter, which will understand the end of the array by special digit and fill the next array... because it would be inconvenient to write the array size every time by hand.

What a mess.

Writing an array to a file is necessary to save this array for the time of EA reloading. It should be written before exit and read on entry.

If there are 10 arrays in the Expert Advisor, there will be 10 files. But before it (an array) can be read, it should be created and written...

 
Alexey Viktorov:

A mess in the head.

Writing an array to a file is necessary to save that array for when the EA is rebooted. Writing before exiting and reading on entry.

If there are 10 arrays in the EA, there will be 10 files. But before it (the array) can be read, it must be created and written...

You're so stuck up, I'm talking about solutions and you're praising the problem. My post is not about solving the top starter's problem.

Inattentiveness and aggressiveness - apparently apathy, autumn...

 
Alexey Viktorov:

Why do I need to do it? Dmitry gave links to documentation reading and writing an array to a file.

It's like in the movie "The Diamond Arm"... "With one move of the hand, the trousers are transformed..." Only in this case there is no technical malfunction. After all, I didn't ask for nothing how writing and reading an array is organised.

It's quite possible that it would be faster with a bin file.

Yesterday I tried to declare the array at once. After all, I know the array beforehand, before optimization.

For example, like this (I deleted a part of strings):

datetime T[411]=
   {
   1262731020,1262735700,1262821920,1262903400,1262989740,1263247200,1263339060,1263420000,1263507480,1263595500,
   1265324700,1265407200,1265752980,1265926500,1265930820,1267657200,1267740300,1267826460,1268175840,1268346360,
   1270504920,1270684140,1270768500,1272924180,1273011720,1273097100,1273272240,1273528800,1273617180,1275344100,
   1275516000,1275602400,1275689160,1276034400,1276124580,1276208700,1276211640,1278027960,1278369780,1278373920,
   1278456660,1278540000,1278626400,1278712800,1280447880,1280527200,1280789220,1280959200,1281045720,1283292000,
   1283378400,1283812200,1285626300,1285887060,1286229600,1286316000,1286404740,1288133220,1288216860,1288305120,
   1288392420,1288648860,1288735200,1288741980,1288822080,1288994400,1290722460,1290809040,1291069320,1291329540,
   1293228420,1293577020,1293666300,1293746400,1295992800,1296079320,1296253680,1296514200,1296686940,1296770400,
   1298503260,1298592000,1298672280,1298931060,1300831920,1300917600,1301609160,1301696460,1303512420,1303768920
   };

It hasn't worked so well yet. At present terminals are busy with optimization and I will try to do it in different ways later. I suppose I have to convert from string to date.

 
I do this. I run a single test. During this testing I write arrays into a file. Then I perform optimization in the same area but arrays are not recalculated at every bar or tick, they are read from the file. Optimization by opening prices on a weekly period is instantaneous. Without file operations it takes hours.