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
thank you very much for the good advice. definitely worth it.
Finally, I would like to ask that if the struct array[] is still somewhere inside the function, how can it be accessed or not?
thank you very much for the good advice. definitely worth it.
Finally, I would like to ask that if the struct array[] is still somewhere inside the function, how can it be accessed or not?
I was in a hurry to quickly delete the question but You was faster. this was a quickly written and very stupid question on my part. sorry. I already got works and get access nicely. data can be accessed same way as usual. Here it wasn´t about accessing data from another class, but a normal scope problem indeed, this recent learning of OOP has turned my brain into ultimate mess. Just a little while ago o tried to do the same thing with a class that´s why it crashed in my head. I initially decided to simply put the data in a structure so that they would be in a separate room and better arranged. If I already wrote in the topic here I will show how I solved this situation, so if that something is very wrongly made you can hang me :D Anyway thanks again !
I was in a hurry to quickly delete the question but You was faster. this was a quickly written and very stupid question on my part. sorry. I already got works and get access nicely. data can be accessed same way as usual. Here it wasn´t about accessing data from another class, but a normal scope problem indeed, this recent learning of OOP has turned my brain into ultimate mess. Just a little while ago o tried to do the same thing with a class that´s why it crashed in my head. I initially decided to simply put the data in a structure so that they would be in a separate room and better arranged. If I already wrote in the topic here I will show how I solved this situation, so if that something is very wrongly made you can hang me :D Anyway thanks again !
don´t hang me yet, went wrong in a hurry again....now it should be written in proper handwriting, often used arrays are not directly global ,but are accessible from everywhere. : I couldn´t do better :D
now it is the case that my data can be accessed like this ts.c[0] but mqlrates data are accessible like this ts[0].c
I understand that the mqlrates data is in inside the additional array that holds the index, but the elements must still exist inside separate arrays ? Or am i wrong? would it be better if i try to put the data as they are after mqlrates and copyrates ? It would require making an additional array, does it make any sense ? I just want to do things 100% properly....
don´t hang me yet, went wrong in a hurry again....now it should be written in proper handwriting, often used arrays are not directly global ,but are accessible from everywhere. : I couldn´t do better :D
now it is the case that my data can be accessed like this ts.c[0] but mqlrates data are accessible like this ts[0].c
I understand that the mqlrates data is in inside the additional array that holds the index, but the elements must still exist inside separate arrays ? Or am i wrong? would it be better if i try to put the data as they are after mqlrates and copyrates ? It would require making an additional array, does it make any sense ? I just want to do things 100% properly....
There is no propper way to do it, because it depends on the situation.
MqlRates places data in order of the struct into memory:
Depending on your access pattern to the data, it can be more efficient to have the data organized like that. In case you access open high low close and then move on to the next "set" of data.
Contrary to that, if you pan through all close values, and then all high values in separate loops, you might want to have your data organized as arrays of close values and separate from that array of open values.... - This will make data be most compact in memory, in terms of processing order, and therefore support your CPU caching to be more efficient.
There is no "one fits all" solution, as it depends on the usage of the data.There is no propper way to do it, because it depends on the situation.
MqlRates places data in order of the struct into memory:
Depending on your access pattern to the data, it can be more efficient to have the data organized like that. In case you access open high low close and then move on to the next "set" of data.
Contrary to that, if you pan through all close values, and then all high values in separate loops, you might want to have your data organized as arrays of close values and separate from that array of open values.... - This will make data be most compact in memory, in terms of processing order, and therefore support your CPU caching to be more efficient.
There is no "one fits all" solution, as it depends on the usage of the data.thanks for referral. After this information, i thought that i would start measuring the difference in performance speed but then i luckily decided to read more about this topic first. It was all new to me and i guess i couldn´t read it with that look before as i had no direct contact with this subject and to me seemed everything like one big struct :D. Now with surprise it turned out that there is a lot of talk about it and there is a lot of information available about this topic and the results of the performance measurements also. Depending on the cases that confirm until 2-3 times differences in speed and the main speed advantage is related to the cache. Without going into deep i´ll share a quick summary about the topic. Since i didn´t know it myself, maybe someone else is also interested.
this topic was discussed two primary types of structures. SoA(Struct of Array) and AoS(Array of Struct). There is more like AoSoA, SoP, Padded AoS and maybe more but they are not discussed at the moment.
AoS is better choice : less load data pet time. process one or few struct at a time. May lead to better cache utilization if data is accessed randomly.
SoA is better choice : heavy load data per time. If you have you process a bunch of structs at a time. especially vectorized processes. Keep memory access contiguous if access over structure instances.
I guess it went well this time and SoA was right choice. because in my case the close, high, low and time arrays receive quite a lot loads in parallel all the time until ea works.
and again... if I explained something very wrong, you can shoot me :D
thanks for referral. After this information, i thought that i would start measuring the difference in performance speed but then i luckily decided to read more about this topic first. It was all new to me and i guess i couldn´t read it with that look before as i had no direct contact with this subject and to me seemed everything like one big struct :D. Now with surprise it turned out that there is a lot of talk about it and there is a lot of information available about this topic and the results of the performance measurements also. Depending on the cases that confirm until 2-3 times differences in speed and the main speed advantage is related to the cache. Without going into deep i´ll share a quick summary about the topic. Since i didn´t know it myself, maybe someone else is also interested.
this topic was discussed two primary types of structures. SoA(Struct of Array) and AoS(Array of Struct). There is more like AoSoA, SoP, Padded AoS and maybe more but they are not discussed at the moment.
AoS is better choice : less load data pet time. process one or few struct at a time. May lead to better cache utilization if data is accessed randomly.
SoA is better choice : heavy load data per time. If you have you process a bunch of structs at a time. especially vectorized processes. Keep memory access contiguous if access over structure instances.
I guess it went well this time and SoA was right choice. because in my case the close, high, low and time arrays receive quite a lot loads in parallel all the time until ea works.
and again... if I explained something very wrong, you can shoot me :D