MEMORY[n]

Top  Previous  Next

Keyword Description

Memory variable

Class

Expression

Where Legal

Resources

Entry Logic

Exit Logic

Initial Size

Resize

(Pre-Category)

Resize

(Category-Level)

l

l

l

l

l

l

Syntax

MEMORY[n] 

Where n is an integer 1-99

Example

Sample code

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

MEMORY[3] = TRUE

' If a cross over occurred yesterday, between the indicator 

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

' in MEMORY[3] the fact or truth that the event did occur.  

' This fact or event may be referenced even after we exit the current page

IF MEMORY[3] = TRUE THEN BUYSTOP = COL7

 

ThumbTack white

A MEMORY[n] memory "slot" assigned on a SIG page can be referenced in SIG code. If assigned on a SIZ page it can be referenced in SIZ code. If for instance MEMORY[1] is set while executing on the Trade In Progress page and that trade is exited putting us back on the Entry Rules page, we still have access to the value previously saved in MEMORY[1].  The value remains there until it is changed by program instructions.  In SIG processing Mechanica automatically resets MEMORY[n] values to 0's as each new symbol is presented.

The difference between MEMORY and TEMPMEM is that TEMPMEM values are lost when the current page is exited whereas MEMORY values are retained.  MEMORY values, you manage completely.  TEMPMEM values, Mechanica helps you manage.

See also:

TEMPMEM, User-named variables (discussion)