I am sharing global arrays between advanced charts. I am in the process of testing how the the order of execution of the different efs's, which write and read the global values, will affect my logic.
I am updating and reading these variables on a tick by tick basis. Based on previous posts on this BB that I had seen, it seems the order in which the advanced charts load, could affect when the different efs's would read from and write to the global variables. For instance, if the efs that writes to the global variable always does so before the efs that reads the variable reads it, everything would work well. However, I do not expect this would be a normal occurrence.
During the normal trading day on a high volume issue, the order would not be significant because in my case I am writing and reading tick by tick. However, on an issue that has lower volume, or after hours trading, this could change the strategy and require code modification.
Another issue which I may run into is execution time differences. Typically, the code which I am processing which writes the globals is executing in 0.14 milliseconds whereas the code that is reading these variables is at .03 milliseconds. If the efs's are run in a parallel fashion (all at the same time) I would read the globals before they are written every time. This leads into my first question:
1. Do the efs's run sequentially or in parallel? Based on previous readings, it seems sequentially, however, I don't know.
2. If sequential, is there a function that can be written to control the processing sequence of the advanced chart / efs?
3. If parallel, is there a wait or a pause function that can be written to delay the efs which reads the globals until they would have been written? (e.g. 6 external efs's writing global variables at .14 mS each, therefore, I would have a step in the reading efs which would wait 1 mS after a tick to read the globals.
Currently, my code is written to read the global variables for ~ 2 mSec after a tick comes in. I am still testing, but I am worried about excessive CPU usage if I use a "while loop" after every tick to wait for a global variable change or 2 mSec, whichever comes first. I thought I would throw this out to see if anyone knew something that could help me out, and to see if new functions could be created to facilitate similar strategies.
Thanks!
I am updating and reading these variables on a tick by tick basis. Based on previous posts on this BB that I had seen, it seems the order in which the advanced charts load, could affect when the different efs's would read from and write to the global variables. For instance, if the efs that writes to the global variable always does so before the efs that reads the variable reads it, everything would work well. However, I do not expect this would be a normal occurrence.
During the normal trading day on a high volume issue, the order would not be significant because in my case I am writing and reading tick by tick. However, on an issue that has lower volume, or after hours trading, this could change the strategy and require code modification.
Another issue which I may run into is execution time differences. Typically, the code which I am processing which writes the globals is executing in 0.14 milliseconds whereas the code that is reading these variables is at .03 milliseconds. If the efs's are run in a parallel fashion (all at the same time) I would read the globals before they are written every time. This leads into my first question:
1. Do the efs's run sequentially or in parallel? Based on previous readings, it seems sequentially, however, I don't know.
2. If sequential, is there a function that can be written to control the processing sequence of the advanced chart / efs?
3. If parallel, is there a wait or a pause function that can be written to delay the efs which reads the globals until they would have been written? (e.g. 6 external efs's writing global variables at .14 mS each, therefore, I would have a step in the reading efs which would wait 1 mS after a tick to read the globals.
Currently, my code is written to read the global variables for ~ 2 mSec after a tick comes in. I am still testing, but I am worried about excessive CPU usage if I use a "while loop" after every tick to wait for a global variable change or 2 mSec, whichever comes first. I thought I would throw this out to see if anyone knew something that could help me out, and to see if new functions could be created to facilitate similar strategies.
Thanks!
Comment