TEMPMEM[n]

Top  Previous  Next

Keyword Description

Local temporary storage for numerical values or variables

Class

Expression

Where Legal

Resources

Entry Logic

Exit Logic

Initial Size

Resize

(Pre-Category)

Resize

(Category-Level)

l

l

l

l

l

 

Syntax

TEMPMEM[n] 

Where n is an integer value 1-100

Example

Sample code

IF COL1[2] < COL2[2] AND COL1[1] > COL2[1] THEN_

TEMPMEM[3] = TRUE

' If a cross over occurred yesterday, between the indicator 

' values in column 1 and those in column 2 then this stores 

' in TEMPMEM[3] the fact or truth that the event occurred.  

' This fact or event is lost after we exit the current page

' or anytime a day boundary is crossed.

 

ThumbTack white

A TEMPMEM[n] memory "slot" is assigned a value that can be accessed only from the page where it is created while that page is current.  If for instance TEMPMEM[1] is assigned a value while we are on the Trade In Progress page and that trade is exited putting us back on the Entry Rules page, we cannot still access the value we previously saved in TEMPMEM[1].  That value was automatically reset to 0 when we exited the Trade In Progress page.  The advantage is that we don't have to reset (manage) or worry about accidentally reusing an old value we previously stored there the next time we come back to that page.

The difference between MEMORY and TEMPMEM is that TEMPMEM values are lost when the current page is exited or when a day boundary is crossed, whereas MEMORY values are retained.  MEMORY values, you manage completely.  TEMPMEM values, Mechanica helps you manage.  Generally if your program needs to remember something that happened say, while it was in a trade or even after that trade is exited then use MEMORY to store your variables.

`

See also:

MEMORY, User-named variables (discussion)