In this tutorial, we will understand how to place order via AmiBroker BUY/SELL buttons. You can place different types of orders like Regular, Bracket or Cover orders. The orders can also be placed in single as well as multiple trading accounts across different stock brokers like Zerodha, Upstox, AliceBlue, Finvasia, Angel Broking & more.
- You must have a trading account with one of the stock brokers we support. At the time of writing, we support Zerodha, Upstox, AliceBlue & Finvasia
- Amibroker (Free trial version is sufficient)
- Live data in amibroker
Initial Setup (One time activity)
- Register to AutoTrader Web.
- Create a trading account.
- Make sure it is working. Look at the trading screen, it should show your account’s data.
- If you do not see any data, then most likely you have entered wrong credentials. You can correct them by editing your trading account. (Menu: Settings -> Trading Accounts)
- Install AutoTrader Desktop client
- Add API Key in client’s settings. You will find your API Key in AutoTrader Web. (Menu: Settings -> API Key)
- Install AmiBroker library
Once you have done everything properly, you should see following button afls in your AmiBroker’s Chart section.
Start at-desktop & make sure it is in monitoring state.
- Start AmiBroker
- Bring up the chart
- Add BUY/SELL button afl of your choice
- Set the chart parameters (if applicable)
- Click the BUY/SELL button to place the order
- See AmiBroker logs to make sure order was placed (see screenshot below)
- You can also check at-desktop logs
- Check AutoTrader Web’s dashboard to see order status
You can perform any kind of actions on click of a button. You just need to write the code accordingly in the buttons action section. You can use our api functions for that.
If you look at the afl code, there two different sections for buy & sell each. See the code below:
case 101: _TRACE("Placing a BUY market order"); // You can write any of AutoTrader Web API functions here placeOrder(AT_ACCOUNT, AT_EXCHANGE, AT_SYMBOL, "BUY", "MARKET", AT_PRODUCT_TYPE, AT_QUANTITY, 0, defaultTriggerPrice(), False); break;
case 201: _TRACE("Placing a SELL market order"); // You can write any of AutoTrader Web API functions here placeOrder(AT_ACCOUNT, AT_EXCHANGE, AT_SYMBOL, "SELL", "MARKET", AT_PRODUCT_TYPE, AT_QUANTITY, 0, defaultTriggerPrice(), False); break;