Hi aed71,
Welcome to the forum.
Have a look at the ValueWhen() function, or BarsSince() function. Both of these could be used to "remember" the type of trade last executed; you might also be able to use the PREV function but I'd recommend looking at the other two options first as preferences over using PREV.
Roy Larsen wrote an excellent tutorial on using latches in MS, he describes using specific latches to "remember" values. The document is available in the files section of the forum.
Hope this helps.
wabbit
"The question of whether a computer can think is no more interesting than the question of whether a submarine can swim."
Edsgar W. Dijkstra
MS: 6.52 EOD, 7.x EOD, 8.0 PRO, 9.2 PRO w/QC, 10 PRO w/QC C, 11 PRO w/QC & MDK
For custom MetaStock programming : http://www.wabbit.com.au
My SkyPE status : 
My SkyPE account : wabbit.com.au