Staticvar array problem

In first file I have this code which works properly.

for (i = 0…)
{
pivot[i] = …; // calculate values of pivot[]
.
}
.
Plot(pivot[i],"",colorTurquoise,styleDashed,zorder=-5); // plot pivot[] data to make sure it is right

StaticVarSet(“pivotCount”,i); // number of elements in pivot[]
StaticVarSet(“pivots”,pivot); // store pivot[]

All the data is plotted properly. If I take the code below and put it in the above file everything works. StaticVarGet() gets the data and plots it properly. But I put the below code in a different AFL file and run then pivot[] is empty.

.
.
pivotCount = StaticVarGet(“pivotCount”);
pivot = StaticVarGet(“pivots”);
Plot(pivot[0],"",colorTurquoise,styleDashed,zorder=-5);

In the second AFL file the pivotCount is correct but pivot[] is empty. What am I doing wrong? Is it possible to send array variables via StaticVar? Thanks.

A workaround that I implemented was to write the generated pivot data out to a file that is stored on a ramdisk. ImDisk is a good freeware with lots of options that is available here https://sourceforge.net/projects/imdisk-toolkit/.

In fact the first AFL file, which generates the pivots, writes out AFL code consisting of the Plot() commands. I then #include this file in the second AFL file and code consisting of Plot() is executed. This way there is no need to read the file for the data. I use this in four different places with four different output files and there is no noticeable degradation in performance.