Announcement

Collapse
No announcement yet.

efs execution flow and sharing global arrays beteen advanced charts

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • efs execution flow and sharing global arrays beteen advanced charts

    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!

  • #2
    Possible solution..

    Steve,

    Why don't you create control global variables that your systems can use to determine is a new value has been stored to the global variables..

    For example...

    Create a variable called "GV1Updated" and set it to false.

    Now, everytime your first script updates that variable, set it to true.

    Your second EFS would then check with every tick if (GV1Updated == true) { then read the variable from the global pool and reset the "GV1Updated" == false}

    This way, you are not polling the variables on every tick and have control over the way your code accesses the data.

    Another thing you could do is have the first system record the Global variables every 20 seconds, or every minute (whatever you want). This way, it would not make the polling routine use up so much processor cycles..

    If you need help, then let me know.

    Brad
    Brad Matheny
    eSignal Solution Provider since 2000

    Comment


    • #3
      Steve,

      In my scripts, I have to limit the frequency of setting global variables to control the CPU usage. Even after many tricks I have played, eSignal is still a CPU hog.


      Clearpicks

      Comment


      • #4
        CPU hog

        Brad, Clearpicks,

        I took your suggestion Brad with regards to picking one global variable which is set to true when global variables have been updated in the host program. This way, I am only polling this single variable every tick. This reduced my CPU usage significantly since I was not polling the 6 other globals every tick. During the process of testing the new configuration, when I brought up the Task Manager, I noticed my CPU usage was at 50% and stayed there regardless if I was running eSignal or not.

        I noticed two instances of "Findfast.exe" and one of them was hogging 50% of my CPU time. This usage went on for a very long time. I searched the net and found this link.

        http://www.geek.com/tipstrix/misc/findfast.htm

        When I checked in control panel, this program was set to run every 2 hours. I went ahead and set the frequency to update every 1000 hours and also set it to not automatically run (overkill probably).

        Based on some of the posts I've seen recently on CPU usage, I wonder if other people may have a similar issue.

        I'm still testing my efs which is monitoring the global arrays, so I'll probably be asking more questions.

        Thanks again

        Comment

        Working...
        X