lamkeng,
I think you will benefit greatly by reading the MS Users
Manual that came with yuor copy of MetaStock. After you have finished
reading the Manual, I would strongly recommend that you download the
free Equis Formla Primer from the files section and work through all
the exercises contained therein.
Armed with this knowledge, you will have no problem completing this simple coding project. After
doing the required reading and the homework yourself, if you get stuck,
please post your best attempt at the code along with a full explanation
of what you are trying to achieve to the forum and I am sure one of the
good members here will assist you to sort out the bugs.
We aren't here to write your code for you, we are here to help when you get into trouble using MetaStock.
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