Hi cji82,
Welcome to the Forum.
There are a couple of things here; the first is to have a look at the work already posted on the forum regarding pivots, some of this uses the PowerPivots addon but a lot of it doesn't. Maybe these will offer a different perspective on the problem, and an alternative solution.
The next is to read up on the PREV function, which is a recursive function that can be used to store a previous value (hence the term PREV!) One problem with PREV is that is causes a dramatic drain on CPU resources and is very slow to return a result because of its recursion.
Depending on how the code you want is written, it MIGHT be possible to employ Ref() or ValueWhen() functions to return different values; it might also be possible to employ Mark Pyle's global variable library of functions (GV.dll) which is available in the downloads section. You will have to some more research on these.
Ultimately, to overcome the limitations of the native MetaStock Formula Language, you could write your own external function library after purchasing the MetaStock Developers Kit.
Hope this helps.
wabbit
MS: 6.52 EOD, 7.x EOD, 8.0 PRO, 9.2 PRO w/QC, 10 PRO w/QC & MDK
For custom MetaStock programming : http://www.wabbit.com.au
My SkyPE status : 
My SkyPE account : wabbit.com.au