I want a code to buy a equity at market price on open

i want a code to buy a equity at market price on open with specified quantity

you can use After Market Order (AMO)  

coding is not possible with Tradescript or AFL to automate.

i want to buy 2o different stocks at market open price and sell them at 1% profit. can you guide me a easy procedure to do it (or) ?

an alert will also be ok