APIBridge User Guide

This user-guide is written by taking Amibroker as primary example. However, note that settings are almost similar for MT4/NinjaTrader/Python etc.

Useful Related Links

Main Tabs in APIBridge

Symbol Setting Window: This is the most important tab where you define settings for scrips in which you want to trade automatically. Here you can add symbols, one on each row, on which you want to trade. To see all features in Symbol Settings, go to Tools->Application Settings->Symbol Settings.

  1. Input Symbol is the same as you see in Amibroker or data feed
  2. Exchange Symbol is the same in which you want to trade based on buy/sell signals in Input Symbol. For example, input symbol may be “NIFTY-I” and Exchange Symbol may be “NIFTY”
  3. Other settings are self-explanatory like Quantity/OrderType/MaxLoss/MaxProfit etc. The mandatory fields are marked with *. Note that you can define quantity/ordertype from this window as well as AFL. If you want to take quantity from AFL, you should leave quantity blank in this window. Optional fields can be overwritten from AFL settings if left blank.
  4. MaxOpenPos is the maximum open position you want to take in each symbol, based on the trades for current day only.
  5. MaxProfit/MaxLoss automatically squareoff position when either limit is reached without taking StrategyTag into consideration
  6. SquareOff Time squares off all net positions for the day, cancels all pending orders and stops trading for the day.
  7. There are several other position management & risk management options which are self-explanatory

Application Settings: You can access it from Top Menu->Tools->Application Settings

  • API Settings: use as per broker given credentials
  • Signal Source: If you are using Amibroker, give it’s installation path; otherwise leave blank. Default TCP port can also be left blank.
  • Symbol Settings: If you are trading in multiple strategies, you can enter comma separated strategy tags such as STG2, STG3 etc. You can also tick which columns you want to display in Symbol Settings Window.
  • License: shows your licensing information
  • Global Risk Management: These are global settings for APIBridge and over-ride any other settings in APIBridge or your strategy code. The setting – Max Order Value Per Order – will disable Market Orders. 0 implies not limits. These are extremely helpful to manage risk even if any strategy malfunctions.

Net Positions Window

  1. APIBridge maintains a local log of all Net Positions. If it does not match from your broker API, the respective Net Position row will be shown in light red color.
  2. SyncNetPosition button syncs all net positions for current day with broker api.
  3. SquareOffAll button squares off all net positions for the day, cancels all pending orders and stops trading for the day.
  4. For trades made outside the APIBridge, you can create entries using the edit button.

Placing Your First Order

You can place your first order in Paper Trading mode, any Broker API is not required for paper trading. You do not even need datafeed for placing an order with Paper trading. Use the Button Trading AFL and based on Amibroker chart create symbol settings.

Mock Trading with Amibroke Bar-replay

Mock trading can be done after market hours to ensure no orders are actually traded on exchange. Example for NSE after 3:30pm – You can trade through charts or through scanner (without using charts) – Mock Trading after market hours, or during exchange mock trading session is preferable to Paper Trading mode. In Paper Trading mode, actual orders are not sent to exchange. There is semi-automatic mode also available which can be used as required. Mock Trading through charts:

  1. Setup multi-chart layout just as you would like to trade in live market. Ensure that APIBridge integrated AFL is used on each chart, and that chart parameters are correctly set.
  2. Under the settings tab in APIBridge, add scrips with correct settings for trading
  3. Click ‘Start Trading’ button in APIBridge
  4. Start bar-replay in amibroker. The step-interval should the minimum interval your data vendor allows- typically 1-minute. You can increase the Speed (steps/sec) to 5.

Mock Trading through Scanner:

  1. Setup scanner with correct settings. Refer article: https://algostore.in/amibroker-scanner-auto-trading/  . You can select date range to trigger signals on particular date.
  2. Ensure that all stocks are added under APIBridge Settings, and Start Trading