Example order placement from AmiBroker using Bridge

If you are new to API Trading, then please check out this article ‘Why we need Trade API in short?’ and watch our video’s to know more about API Trading.

If you have not installed Bridge, then refer this article for Hello Kite v2.0 setup and this for Hello Upstox v2.0 setup.

In this article, we have used Kite API to place order from AmiBroker, but the procedure is same for other Broker’s API as well.

You can download the AFL file used in this article from here.

//Initialize Bridge
Bridge = CreateStaticObject("KiteNet.Bridge");

//Just simulate buy signal
Buy = 1;

//Place a order on getting Buy Signal
if (LastValue(Buy)) {

//Calling Place order function from the Bridge
OrderId = Bridge.PlaceRegularOrderBridge( "NSE", "ICICIBANK", "BUY", "MARKET", 1, "MIS", 0, 0, "DAY", "LONG", 0, True, "AA", False, "LONG" );

//Just show the order id in a popup
PopupWindow("Order Id is " + OrderId,"KiteNet");

Functions supported by Kite Bridge
Functions supported by Upstox Bridge

Video version of this article is available here

If you are new to Algo Trading, then try exploring the strategies at https://codeadvisor.in/code-advisor/. We already have some famous strategies coded in VBA/AFL (like ORB, Levels Breakout, Supertrend etc). You can use these strategies to get started quickly or use as a reference to build your own strategy. We will periodically add new strategies and codes that are available in public domain.

Was this article helpful?

Related Articles


  1. Avatar Rajesh

    Hi Admin,

    I am working UpstoxNet.Bridge. Could you please add Square off time button in the appilication. When you mentioned square off time, then close all open positions and not to allow amibroker signal after square off time. It would be very help full very lot.
    Could you please do needful?

    Thanks & Regards,
    Rajesh RAvi

Leave A Comment?