Local Variables in OptoScript


#1

Is there a way to declare local variables inside OptoScript to be used only in that context and disposed of when OptoScript exits? Declaring global variables to be used only in one script and never to be used again seems to be very memory expensive. Thanks for your timely response.

Hamid


#2

Hi Hamid,

The only way to have Local Variables is by using a subroutine (the variables in a subroutine, whether or not they are used in OptoScript or other types of blocks, are local to the subroutine).

However, that doesn’t address your “memory expensive” comment. Are you running out of memory with some of your strategies? If so, you’d get an error when you try to download the strategy. If you’re using giant tables it’s easy to use up memory in a hurry. Here’s a helpful Tech Note about the available memory on our hardware-based PACs: Form 1646.

If you are bumping up against the hardware limitations of our PACs, you may want to consider SoftPAC, coming soon from Opto 22. Click here for more information on SoftPAC.

Can you tell us more about your specific concerns and application? There may be more than one way to reach a good solution!

Thanks,
-OptoMary