It is a market order that is executed as close as possible to the closing price of the stock. Most brokers require that you have the order in by 15:40. I use it to trade a stock that has poor liquidity, you can also use it to try to take advantage of order imbalances, which are announced several times before the close.
You can use MOC order to open or close positions. You have to do that (enter order) at least 20 - 30 minutes before market close. My stock broker allowed me to do that 10 minutes before close when I was trading for a fund. But that was a special deal.
I am a TSX daytrader. I want test how the MOC work! as you said. The MOC order must be posted before 3:40 and can't be cancelled. then do I need to get a position before I enter a opposite MOC to flat? or I can put a MOC order first,and get a opposite position before the closing.
Atleast with IB its possible to do so. For one of my strategies I use OPG orders to open a position and MOC orders to close the same position. I send both orders well in advance of the open to my broker.