Pi Bridge – Bridging All Platforms

Published by Saket Kumar on
7th Oct, 2015

What is PiBridge?

It’s a Bridge between Pi (our retail trading platform) and any other platform(eg.Amibroker/NinjaTrader/Excel etc) .

Hence,a user can do the following:

  • Write strategies in their favorite language of their choice(be it AFL / NinjaScript / Excel Macros etc),and push orders through Pi (and thus to the exchange) and receive notifications on their platform.
  • User can fetch various details from Pi to their platform.



What are the functionalities available in PiBridge ?


  • Place Orders


  • Request Pending Orders
  • Request Completed Orders/Trades
  • Request Equity Holdings
  • Request Admin Positions
  • Request Funds Available

How to get started ?

  • Latest Pi installed.
  • AmiBroker/any other application(Ninjatrader/Microsoft Excel etc) Installed.


Download and run PiBridgeInstaller.exe
Note: Once you start Pi, you will see the status bar showing pibridge status(RED) on the right end in the footer and
then start Amibroker/or your favorite platform on which you run your trading strategies.

How would I place Order through PiBridge?
API provides PlaceOrder functionality through which you could fire orders in Pi. You could get the complete details of it from the PiBridge help pdf file . We have also tried to explain the placeOrder functionality below.

PlaceOrder(string pExchnge, string pTrdSymbol, string pSymbol,string pUserStrategyName,  short pOrderSide, int pInitialQty, int pDiscQty, double pLimitPrice, double pTriggerPrice, string pOrderType, string pProdType, string pClientCode, string pValidity)

where ,
pExchange =  “NSE” or “NFO” or “BFO”  or “BSE” or “CDS” or “MCX”
pTrdSymbol = “NIFTY15OCTFUT”  
(you could see from Pi Marketwatch Trading symbol columns)
pSymbol = “NIFTY” or “BANKNIFTY” etc. should be within 10 characters
pUserStrategyName = strategy name through which orders are put to distinguish orders from different strategies..
pOrderSide = 1 or 2     //    1 for Buy or 2 for sell
pInitialQty =  1 (put LOT quantities to trade)
pDiscQty =    0 for default
pLimitPrice =  8500.05 (price  in INR  for NIFTY15SEPFUT)
pTriggerPrice = 0  price in INR (send non-zero values in case of SL and SL-M order type)
pOrderType = “L”, “MKT, “SL”, “SL-M” for Limit Market, StopLoss and StopLoss Market ordertypes.
pProdType = “NRML” or “MIS” or “CNC”
pClientCode = “DN0005” Your Pi User id like DN0005
pValidity = “DAY” or “IOC”

How would I request details from Pi  and receive back the information?

We could request information like Pending Orders, Trades, Equity Holdings, Admin Positions, Cash Positions. The detail of the request is explained in the PiBridge help pdf. We have also shown a sample to request Pending Orders from Pi.


Once Pi and Amibroker are connected through PiBridge, all orders/trades will be logged in [Amibroker
installation directory]\ PIBRIDGE_[date].log (eg. C:\Program Files (x86)\AmiBroker\PIBRIDGE_07OCT2015.log )

User could read the log to get pending orders in the below format:
Pending Orders Details:- Pi Order ID:151007000063939 NIFTY15OCTFUT nse_fo Order Type:L at limit price: 8000.25 at trigger price: 0 at 10/7/2015 11:53:13 AM.

Could I get a sample code for placing orders/pending orders request?


Example 1:

Amibroker Formula Language-AFL 

//COM Calling function:
brd = CreateStaticObject(“pibridge.Bridge”);
if(!brd.GetConnectionStatus()) brd.Reconnect();
//AFL Buy Logic
brd.PlaceOrder(“NFO”, “NIFTY15NOVFUT”, “NIFTY”,”STRATEGY-S”, 1, 1, 1, 8000.25, 0, “L”, “NRML”, “RB0799″,”DAY”);

//AFL Sell Logic
brd.PlaceOrder(“NFO”, “NIFTY15NOVFUT”, “NIFTY”,”STRATEGY-S”, 2, 1, 1, 8000.25, 0, “L”, “NRML”, “RB0799″,”DAY”);

//AFL Request Pending Orders

brd.PauseCode(60);//Pause for 60 seconds

 Example 2:

Excel Macro VBA:

Sub Sample_2()
Dim ltp As Double
Dim out1, out2 As String
Dim out3, out4 As Variant
”””””””””””’Editable region as per user’s convenience”””””””’
out1 = [RTD(“Pi.RtdServer”, , “NSE_SBIN-EQ”, “Last”)]
‘out2 = [RTD(“Pi.RtdServer”, , “NSE_SBIN-EQ”, “lastTradeTime”)]
ltp = Val(out1)
out3 = piObj.PlaceOrder(“NSE”, “SBIN-EQ”, “NSE”, “STRATEGY-S”, 1, 1, 1, ltp, 0, “L”, “NRML”, “RS4887”, “DAY”)
MsgBox “LTP of SBIN-EQ is ” & ltp & ” LTT is ” & out2
out4 = piObj.PauseCode(5)
”””””””””””End of editable region””””””””””””””””””””’
End Sub


What are the modes available in PiBridge ?

  • 1 WAY SEMIAUTO :Only Place Orders functionality is available. Buy/Sell alerts from the strategy can be located at Generated Alerts window in Pi. Users have to manually click buy/sell button to send the orders to the exchange.
  • 2 WAY SEMIAUTO : Place Orders, Request Trades/Admin Positions/Stock Holdings/Pending Orders/Cash Positions functionalities from Pi (as per API). Responses will be logged for further analysis.

What about communication of Pi with other programming languages(C/C++/Java/Python etc) for advanced programmers?

To communicate with Pi  with any customized front end/client program (written in any programming language) we have detailed packet documentation available.If you have any queries related to this mail us at info[at]tradelab.in

For other API details ,please mail us at info[at]tradelab.in

Also,for any queries/feedback ,feel free to mail or comment below.

Edit( 6th Oct’16):September release of Pi has Link to excel,thus it’s useful to use Excel Pibridge using VBA,please see short video of this in action :

Share this: Facebooktwittergoogle_pluslinkedin

Comments: 116

  1. Ramesh Gangappa October 24, 2015 at 5:24 am

    Excellent interface for autotrading !!!

    I think it will be good if functions are returning value rather than updating in the log file. Since we need additional logic to get info from the PI bridge log file to fully automation.
    Also notice that GetCash() does not exit in the environment as per the PI bridge document.

  2. Ramesh Gangappa October 27, 2015 at 7:08 am

    Algo strategy name is not reflected in PI “Order Book” like “Pending Orders” & “Completed Orders”, neither in the PIBRIDGE*.log file – when we fire orders in PI through API “PlaceOrder” function.
    It will be difficult to distinguish orders from different strategies, especially if more orders are punched.

    It will be great help if you can reflect Algo strategy name.

  3. Saket Kumar November 11, 2015 at 5:51 am

    In new release of Pi and Pi Bridge dated 11th November these have been addressed to.

  4. […] Pi bridge is built by our technology partners Tradelab. Any programming queries on the above can be asked on this blogpost on their website. […]

  5. GILARI November 24, 2015 at 2:59 pm

    I have two software
    1 Ninja Trader7(free version)
    2 Quantshare

    Q1 – Can I use bridge with NT7(free version) for buying and selling ?
    Q2- Quantshare is software like amibroker and it is programmed with C#,Can we use it with QS ?
    If yes,How?

  6. Saket Kumar November 24, 2015 at 3:16 pm

    Yes it’s possible. Can you please mail us at info@tradelab.in ?

  7. Sourabh November 24, 2015 at 6:00 pm


    Can you please share the sample Java code showing what all imports are required and how code would be written to send the orders and receive the notification.


  8. Saket Kumar November 25, 2015 at 4:12 am

    We won’t be able to provide sample in all programming languages.

    Hope you have downloaded Packet documentation that already contains sample code in Python ,please refer those to write your own code in Java,which should be quite simple.

  9. Yogesh November 25, 2015 at 6:00 am

    Dear Sir/ Madam,

    Kindly provide PI Bridge API help document/ sample for C# (.NET platform).

  10. Saket Kumar November 30, 2015 at 12:42 pm

    Hi Yogesh,

    You can contact your broker’s support team,they will provide you with all necessary documents/sample codes.
    If you face any doubts on those,let us know,we will be happy to help.

  11. Abhay Tewari December 1, 2015 at 10:54 am

    Hello Sir,

    I am trying to convert the TradeLab Python code to C# Ninja Trade.

    I am having following queries-

    For the connection to server through socket i am doing this way –

    System.Net.Sockets.TcpClient clientsocket=new System.Net.Sockets.TcpClient();

    Is it fine?

    1)What is the keyword self used for in function get_header(self,length,messagecode) ?

    2) In python we are forming the packed_data buffer in this way –

    packed_data = ctypes.create_string_buffer(14)

    How to do the same thing in C#?

    3) what is the equivalent of Python pack_into and unpack in C#?

    Your help would be highly appreciated.

  12. Saket Kumar December 1, 2015 at 1:17 pm

    I would recommend you to refer online documentation on Socket programming in C# ,where tons of tutorials are available.
    As you need to create a client program in C# to connect to the server (Pi)

  13. Santosh Kumar December 2, 2015 at 10:48 am

    I am also trying Pi bridge for NT7 but still I am not able to do. I coded a few lines like ‘Abhay Tiwari’ but still no luck. It would be of a great help if you provide a TEST/EXAMPLE documentation like you doing of amibroker.

  14. Saket Kumar December 3, 2015 at 11:07 am

    @Abhay Tewari ,hope you are able to write C# code and connect to Pi as per communication on emails.

  15. kanchan gupta December 8, 2015 at 5:07 pm

    Sir, how i can connect excel with pi for semi automated trading,Is there any guideline?



  16. amit parmar December 15, 2015 at 9:45 am

    hi , i would like to understand how to connect excel to pi bridge and trade from it,

  17. Saket Kumar December 16, 2015 at 10:55 am

    @Kanchan Gupta , @Amit Parmar,please check your inbox to get the access to it

  18. Santosh Kumar December 24, 2015 at 11:17 am

    Sorry Saket, there is no mail in my inbox from tradelab.

  19. v varkey December 28, 2015 at 3:31 pm

    The Pi Bridge documentation I have received has messages 201 and 301 for modifying and canceling order.
    when i send these messages, the socket closes immediately.

    Strategies need to modify and cancel orders. How can i send modify and cancel?

  20. Saket Kumar December 29, 2015 at 2:22 pm

    @Santosh we had sent on 24th Dec at 2.57 pm .Anyways we have sent the mail again ,please check your inbox

    @v varkey will have someone to contact you regarding this

  21. Rohan January 4, 2016 at 12:04 pm


    Is PI Bridge Support Option Trading?

  22. Saket Kumar January 4, 2016 at 4:04 pm

    @Rohan, Yes it does

  23. Kannan January 8, 2016 at 9:21 pm

    How can I place a bracket order from Python program and PI?

  24. Soumyadeep Ganguly January 9, 2016 at 2:03 pm

    Hi Saket,
    With the help of examples I am able to fire create order from Python code.But when I do the same thing for Modify/cancel Order it doesnt work.Here is the piece of code which I am using.Can you please help where I am going wrong?
    class PiBrdgHeader(Structure):
    _pack_ = 1
    _fields_ = [

    class NPiBrdgOrder(Structure):
    _pack_ = 1
    _fields_ = [
    (‘_exchange’, c_char*10),
    (‘_trdSymbol’, c_char*64),
    (‘_piOrderId’, c_char*20),
    (‘_orderId’, c_char*10),
    (‘_strategyName’, c_char*10),
    (‘_orderType’, c_char*12),
    (‘_prodTypeStr’, c_char*12),
    (‘_ClientCode’, c_char*12),
    (‘_validity’, c_char*5),

    def modifyOrder(piOrderId):
    order = NPiBrdgOrder()
    order._header._checksum = 255
    order._header._length = 243
    order._header._msgType = 201
    order._header._time = 0

    order._initQty = 1 # ( should be in lots)
    order._disQty = 1 #
    order._remQty = 1 #
    order._lPrice = 100 # price in INR
    order._triggerPrice = 10

    order._orderStatus = 0
    order._entryTime = 0
    order._execTime = 0
    return order

    def SendPktToServerOverTcpForModify(order):
    packed_data = ctypes.create_string_buffer(243)

    print >>sys.stderr, ‘sending “%s”‘ % binascii.hexlify(packed_data)


  25. Saket Kumar January 9, 2016 at 8:07 pm

    @Kanan Bracket order not possible right now from the API.

    @Soumyadeep Ganguly Modify/Cancel order not possible in the version of PiBridge you are having.Anyways,we will have someone to call you regarding this.

  26. trade_then January 16, 2016 at 3:29 pm

    could c# code example be provided please. problem is not socket programming but aligning of data.
    for those of us who have not used socket to marshal data, misalining of data and then going through all the documentation on web is a waste of time. 7 days would go on that only, with every hit an trial. With just little hint one can form and understand the rest mostly. without concerning what is going on underneath. [ StructLayout( LayoutKind.Explicit ), Pack =1 ] is not solving the problem.


  27. Aravinth February 19, 2016 at 10:39 pm

    Can you please share the documentation of Pi bridge for Python. Thanks.

  28. Saket February 22, 2016 at 9:38 pm

    Hi Aravinth,
    Please login into your broker’s back-office to download the pibridge documentation and sample codes.

  29. Soumaydeep Ganguly February 24, 2016 at 11:44 am

    I second trade_then, can we have the equivalent code for C# ?

  30. Manoj February 25, 2016 at 6:32 pm

    In the documentation provided…

    1. There are message details for Admin request and response packets. However, there is no message code for Admin positions.

    2. FO position Request and Response details are missing. Only message code given.

    Please clarify

  31. Saket Kumar February 26, 2016 at 12:49 am

    Hi trade_then , Soumaydeep Ganguly request you all to please write the code in C# using the documentation(as it has been successfully done by quite a few traders).Do have a look at the C# socket programming examples over internet,also refer the python program attached with the documentation to have the correct parameters. If you are still facing the issue mail us.

  32. Saket Kumar February 26, 2016 at 12:53 am

    Hi Manoj,

    Regarding both of your queries AdminPosition < =>FOPOSITION in our documentation. Apologies for the confusion we will have the naming convention uniform in the document.

  33. Manoj March 8, 2016 at 12:46 pm

    I am building a c# program for PiBridge. I sometimes get a null value when I open a new socket and get the following error in the log file. Can you please explain the meaning?

    New Client connection accepted ip =
    Exception 1: Connection was forcibly closed from client side, need to relogin.
    Exception 2: An existing connection was forcibly closed by the remote host

    Pi is logged in and working fine when this error occurs.

  34. […] described in the follwoing thread of zerodha nad tradelab. If possible share it here plz http://tradelab.in/blog/pi-bridge/158 http://zerodha.com/z-connect/tradeze…other-programs __________________ Trade to live not live […]

  35. Saket Kumar March 14, 2016 at 2:20 pm

    Hi Manoj,

    These are logged in log file when your client program is disconnected or Pi is closed abruptly.

  36. Subhankar Maiti April 19, 2016 at 7:31 pm

    I install the PI bridge but in PI trading platform Bridge indication not appears.

  37. Shabeer April 20, 2016 at 12:21 am

    Please forward pi bridge documentation for developing Interface by C#

  38. Saket Kumar April 20, 2016 at 9:05 am

    Hi Subhankar,
    Can you please send your issue at info@tradelab.in ,we will revert soon.

    Hi Shabeer,
    You can download the pi bridge documentation from your broker’s back office login, if you face any issue mail us.

  39. DayTrader April 24, 2016 at 11:53 am

    I think, all this stuffs are good for programmers only. I am a trader and now to do all this stuffs I will have to learn programming first and that I am not going to do. I don’t think, if it’s going to help a trader.

  40. Tradeav May 11, 2016 at 6:50 am

    Is it possible to just use Pi bridge as a provider of exchange data series ( Connections in Ninja Trader) so that only charting features of Ninja trader can be used? I do not want the ‘programming strategies” function at the moment but I just love the Ninja trader charting interface and would like to use it for Indian stocks/futures.

  41. Udayanand Pawaskar May 19, 2016 at 10:42 pm

    Dear Sir,
    I have take free trial of pibridge. As per your instruction given on word and pdf done properly. I am using ami broker.
    Line no 6 i.e. brd = CreateStaticObject(“pibridge.Bridge”); is showing error. Full day your team is trying to solve this issue but no one. Your IT people are saying they dont know how to solve. I wrote mail to your support team also no response.
    I have discontinue PI Bridge.
    Udayanand Pawaskar. ID- RU0541

  42. Saket Kumar May 23, 2016 at 10:38 pm

    Hi Uday,
    Sorry to hear ,the IT team was not able to help you.Please mail us at info@tradelab.in ,we will resolve the issue for you.

  43. Gautam Prajapatj June 20, 2016 at 6:31 pm

    Can you pls provide detail documents for VBA on earth.only@gmail.com

  44. ASHISH KACHHADIYA June 24, 2016 at 11:09 am

    We are using your PI Bridge API for C# programming. My application was connect to PI using pi Bridge.
    when i place “pending order request” without any compression, Its just disconnects my connection.

    Message Header Structure:

    [StructLayout( LayoutKind.Sequential, Pack = 1 )]
    public struct PiHeader
    [MarshalAs( UnmanagedType.I2 )]
    public short shCheckSum;

    [MarshalAs( UnmanagedType.I2 )]
    public short shMessageLength;

    [MarshalAs( UnmanagedType.I2 )]
    public short shMessageCode;

    [MarshalAs( UnmanagedType.I4 )]
    public int inErrorCode;

    [MarshalAs( UnmanagedType.I4 )]
    public int inTimeStamp;

    Pending Download Request:

    Structure.PiHeader PiPending = new Structure.PiHeader();
    PiPending.shCheckSum = 255;//unchecked( (short) 0XFF00 );
    PiPending.shMessageLength = 14;
    PiPending.shMessageCode = Structure.PiMessageCode.PENDING_DWLD_REQUEST;

    ClientSocket.BeginSendObject( PiPending );

    Please tell me what from data i am sending.

  45. Saket Kumar June 24, 2016 at 6:45 pm

    @Ashish Hope the sample Python code is working fine. Request you to please check the sample Python with your C# code, as most probably issue is with the parameters mismatch. If still unable to resolve this, please mail us at info@tradelab.in

  46. Ashish Patel June 27, 2016 at 4:59 pm

    PI Bridge Using C# code

    When i send Pending Order Request, i Will get Response for all pending order from PI. But when i place new Order i can not get any reply from Pi.I am also send mail in info@tradelab.in and Neeraj singh also.

  47. Adithya Pillai July 5, 2016 at 1:12 pm

    Hi Trade Lab,

    I had a query and have mailed trade lab a couple of days ago and still havent received a response. Please help me.

  48. Saket Kumar July 5, 2016 at 1:46 pm

    Hi Ashish,
    Hope your query was addressed .

    Hi Adithya,
    We have responded to your email.Please check.

  49. Pramesh Tyagi July 12, 2016 at 7:53 pm


    I am using python sample code just run. Only thing I changed is IP address for my machine but It gives me following error

    Traceback (most recent call last):
    File “C:/Users/PRAMESH TYAGI/AppData/Local/Temp/Temp1_OtherProgramHelp (1).zip/Sample_Placing Order.py”, line 128, in
    File “C:\Python27\Lib\socket.py”, line 228, in meth
    return getattr(self._sock,name)(*args)
    socket.error: [Errno 10061] No connection could be made because the target machine actively refused it

    Process finished with exit code 1

    what to do

  50. Saket Kumar July 12, 2016 at 8:35 pm

    Hi Pramesh,
    No need to change the IP address ,let it be ,and try again.

  51. Pramesh Tyagi July 12, 2016 at 8:41 pm

    Yes. It is working that way. thnx

  52. Pramesh Tyagi July 12, 2016 at 8:44 pm

    Hi Saket,

    Excel Macro VBA given above does not work. I get error at line “Set piObj = CreateObject(“pibridge.Bridge”)”.

    How to solve this problem?

  53. Pramesh Tyagi July 13, 2016 at 9:49 am

    Hi Saket,

    Yesterday, when I was trying after trading hours, then Sample_Placing Order.py was able to connect and in Pi the pibridge button became green but orders were not going through despite programe executing normally with exit code one.

    I though that market is closed and so it is not able to do

    So today I tried now during trading hours.

    Program still executes normally with exit code 0 but today neither pibridge button in pi becomes green nor the order is placed.

    Below is the order program message:

    “C:\Users\PRAMESH TYAGI\ForLambda\Scripts\python.exe” “C:/Users/PRAMESH TYAGI/Desktop/Sample_Placing Order.py”
    connnected to server
    Order price: 100.0
    sending “.. I took out this sending message for security reasons”

    Process finished with exit code 0

    what to do??


  54. Pramesh Tyagi July 13, 2016 at 9:50 am

    sorry exit code zero always..

  55. Saket Kumar July 13, 2016 at 1:42 pm

    Hi Pramesh ,
    Please check your mail.

  56. Vipul Shah July 30, 2016 at 11:44 pm

    need my workspace to open up in excel to calculate the spread, is it possible how shuld I go upon

    Vipul Shah

  57. Saket Kumar August 4, 2016 at 8:11 am

    Hi Vipul,
    Currently not possible,though we will have Link to excel feature in the next release

  58. gurpreet singh August 9, 2016 at 12:32 pm

    sir pls share the details of order placing and idicatorsetting for NT7 as shared above of amibroker .

  59. Saket Kumar August 10, 2016 at 8:04 am

    Sure,we will try to come up with a installation documentation for using PiBridge dll with NT soon.
    Though few users have successfully created Pibridge socket programs(Other programming documentations available in broker’s backoffice download) to connect Pi to NT

  60. sankar naryanan September 2, 2016 at 11:50 am

    Hi Saket, I wanted to activate algo trading in my PI. I had already send a mail to Zerodha. Its not happened. What should I do now. And can u elaborate the steps I should follow for a live trade. I used to backtest some of the strategy by my own using Zerodha Script. Please guide

  61. Shiv Kumar September 5, 2016 at 1:35 pm

    Hi i need mt4 to PI Bridge. Any time plan to release ?

  62. Saket Kumar September 5, 2016 at 2:01 pm

    Hi Shiv,
    We don’t have immediate plan,may be in future.Do check your mail.

  63. Ajith October 4, 2016 at 8:10 pm

    Hi Saket,

    Can you please share the VBA code or documents with me.

  64. Saket Kumar October 6, 2016 at 6:43 pm

    Hello Ajith,
    Thanks for reaching to us.As we have the latest release of Pi in which Link to excel is there,hence Excel Pibridge would be beneficial(Please see the edited section in this post as well)
    Please check your mail to get started.

  65. kumar October 19, 2016 at 7:18 pm

    Why Pi does not have indicator-ichimoku kinko hyo?

  66. Saket Kumar October 20, 2016 at 9:06 am

    Hi Kumar,
    We will be adding this in coming releases.

  67. Karthik November 15, 2016 at 3:13 pm

    Hi Saket,

    Please forward the excel to pi bridge setup details and sample code. Thanks

  68. Saket Kumar November 15, 2016 at 5:16 pm

    Hi Karthik,
    You can download from your broker’s back office for Amibroker PiBridge or Socket Programming PiBridge.
    Anyways have mailed you the links(including Excel PiBridge).

  69. Dhiraj Patil November 21, 2016 at 11:40 am

    Can you please let me know how the PiBridge can be used for Java socket Programming. I mean what are the jar files of the PiBridge to be Imported and used in our custom strategies ? An example would be great help.

  70. Saket Kumar November 21, 2016 at 12:04 pm

    Hi Dhiraj,
    No jar files,but Java socket programs written are required to connect to Pi.If you require you can download PiBridge for other programming help zip(it contains sample program and API document) file from your broker’s backoffice.

  71. Kiran December 7, 2016 at 9:16 am

    I am looking for excel vba pi bridge and could you please forward the excel to pi bridge details and sample code for the same. Thank you very much.

  72. Saket Kumar December 7, 2016 at 1:05 pm

    Hi Kiran,
    Please check your mail ,have mailed you the link

  73. L S Singh December 15, 2016 at 7:31 pm

    Hi Saket,

    (1) How can I link 5,10,15 minute RTD (OHLC) for all the nifty50 stocks from PI to Excel sheet ?
    (2) How can I link 5,10,15 minute RTD (OHLC) for all the nifty50 stocks from PI to Ms Access 2007 ?
    (3) Is it possible to trade from my access database form making buy/sell buttons etc by linking with PI.If so , How

    Please help


    Surendral Lal singh

  74. Saket Kumar December 16, 2016 at 1:12 pm

    Hi L S Singh,
    In Pi ,there are couple of ways to export data to excel:
    a)Link to excel option (from Pi Market watch)- this will be real time tick data (RTD) received on Market watch.
    b)Save chart data to excel (OHLCV, so any timeframe chart be it 1 /5/10/15 minute etc) data can be exported -but it will be static data and not RTD as Link to excel is.

    Regarding your queries:
    1)It is not possible to have RTD(OHLC) of particular minutes.Though if a user wants can definitely code himself,firstly exporting chart data to excel and then using RTD formula (from link to excel ) to create and update the candle formation accordingly.
    2)It is not possible to have RTD(OHLC) of particular minutes.
    3)There is Pibridge Excel trading in Pi ,more details in this post.But no trade option from access database.

  75. L S Singh December 18, 2016 at 4:01 am

    Dear Saket Kumar

    Thanks for your prompt reply.

    I understand your points. But will you please elaborately show me about ” RTD formula (from link to excel ) to create and update the candle formation accordingly.”


    L S Singh

  76. Saket Kumar December 19, 2016 at 6:22 pm

    Hi L S Singh,
    New minute candle can be formed using changing LTP (from Link to excel RTD) for that minute (Open,High,Low,Close can be stored for the minute in the Microsoft Excel).

  77. L S Singh December 24, 2016 at 7:00 am

    Dear Saket

    I am already a Zerodha user (ZZ3103).I want to get full knowledge of excel vba pi bridge and so requesting you to forward the excel to pi bridge details along with sample code for the same.

    Regards and thanks

    L S Singh

  78. Saket Kumar December 24, 2016 at 6:08 pm

    Hi L S Singh,
    Please check your mail .

  79. Joseph D December 27, 2016 at 12:25 pm


    Can anyone share document or sample for using excel PiBridge feature.?

    “Link to Excel” from PI results in “#N/A” error in excel. What may be the problem.?

    Thanks in advance.

  80. Saket Kumar December 27, 2016 at 12:44 pm

    Hi Joseph,
    You can download Pibridge documentation from your broker’s back office or their support team.
    Also,regarding Link to excel ,can you please check if your MS Office is x86-x64 bit not x64 bit(or else it won’t work),if possible you can contact the broker’s support team to resolve the issue.

  81. satya December 29, 2016 at 9:12 am

    Hi, Is it possible to place after market orders for the stocks. I usually place orders at the end of the day after market close.

  82. Saket Kumar December 29, 2016 at 11:19 am

    Hi Satya,
    After Market order(AMO) is possible from Pi.Currently AMO is not there in PiBridge.

  83. satya December 29, 2016 at 5:20 pm

    I enter around 10 – 30 trades every day. Entering it manually in pi is tedious job. Is there any plan of supporting AMO in piBridge.

  84. Ritesh B February 9, 2017 at 12:48 am

    If ami bridge to pi doesn’t have modify pending order functionality then how can a system that uses trailing stoploss will work on ami to pi bridge ?

  85. Ritesh B February 9, 2017 at 9:53 am

    I have recently enable pi bridge from Q backoffice and install the pi bridge software. Installation was successful. But When I go to View->User Settings there is no Pi Bridge option shown on the windows. I have recent version of pi install in my system ie v1.0.0.6 (11/18/2016).

  86. Saket Kumar February 10, 2017 at 6:15 pm

    Hi Ritesh,
    Request you to please contact your broker’s support team they will help you regarding this.

  87. Dharmender February 18, 2017 at 6:30 pm

    Can using PI bridge & amibroker I can do trading fully automatic?

  88. Saket Kumar February 20, 2017 at 1:36 pm

    PiBridge is only for Semi-Automated orders.Anyways you can contact your broker support team to know more.

  89. Radhakant Kumar March 28, 2017 at 9:25 pm

    I am getting error while creating object. Set piObj = CreateObject(“pibridge.Bridge”). Please help me in setting up the environment.

  90. Saurav April 5, 2017 at 3:57 pm

    Hi, Does PI Bridge support Bracket Orders or Cover Orders.

  91. sibgathulla zeeshan April 6, 2017 at 4:43 pm

    Hi, can i please know, how do i connect to pi bridge with excell, is there any documentation for it ? and other guidelines ?

  92. sibgathulla zeeshan April 6, 2017 at 5:29 pm

    also need help with formats/ guidelines for placing orders from excell, through pi bridge.

  93. L S Singh April 17, 2017 at 10:26 pm

    Dear Saket Kumar

    On 17-04-17 Opening price of GAIL at 1Day time frame is recorded as 380.1 whereas at 1m, 3m, 5m,10m,15m,30m,1H time frame it is recorded as 381.7.Which opening price is correct ? I am quite confused.
    Please enlighten.

    Thanks in advance and regards

    L S Singh

  94. Sibgathulla zeeshan April 22, 2017 at 1:59 am

    Hi Saket,

    Please forward the excel to pi bridge setup details and sample code to su.zeeshan@gmail.com

    Please do the needful.

    Thank you

  95. Saket Kumar May 12, 2017 at 9:21 pm

    Hi Sibgathulla,
    Do contact your Broker’s support team to have this mailed to you.

  96. Saket Kumar May 12, 2017 at 9:24 pm

    Hi L S Singh,The Time frame of daily chart you can consider to be 100% accurate as it is synced with exchange bhav copy.For more details on chart data do read this post

  97. Saket Kumar May 12, 2017 at 9:37 pm

    Hi Radhakant/Sibgathulla,
    For queries related to PiBridge you can contact your Broker’s support team.

  98. Saket Kumar May 12, 2017 at 9:37 pm

    Hi Saurav,
    Currently No

  99. Aditya Parakh June 23, 2017 at 3:55 pm

    Can you please email the download link for excel vba pi bridge and sample.

    Purpose : Enter a trade in the morning and monitor the Sum(price) of the entire portfolio through the day , every moment. And instantaneously capture a profit. Scalping in a manner.

    can this be considered an alternate to Zerodha Kite API for this purpose ?

  100. Aditya June 23, 2017 at 4:45 pm

    In case of 2 way semi auto ?
    Will the orders be places only in the Generated Alert section and then manually have to be placed ?
    Or can the order be placed to be at the executed level.

  101. Saket Kumar June 30, 2017 at 11:47 am

    Hi Aditya,
    Will the orders be places only in the Generated Alert section and then manually have to be placed

  102. Saket Kumar June 30, 2017 at 11:49 am

    Hi Aditya ,Can you please contact your broker’s support team to get the excel PiBridge installer.

  103. Sri July 14, 2017 at 7:18 pm

    I recently enabled Pi Bridge. I am using Python 3.5. Green led is enabled once the code connects to Pi but it is unable to create the order in generated script.

    Trying out in after market hours using the sample provided…

    First, got this error “TypeError: expected bytes, str found” for all strings. Used solution mentioned here https://github.com/skggm/skggm/issues/83 to prefix with b”” for all strings, and it solved the issue.

    Next error is
    File “F:\Downloads\OtherProgramHelp\Python sample\Sample_Placing Order.py”, line 84, in SendPktToServerOverTcp
    print >>sys.stderr, ‘sending “%s”‘ % binascii.hexlify(packed_data)
    TypeError: unsupported operand type(s) for >>: ‘builtin_function_or_method’ and ‘_io.TextIOWrapper’

    I commented the print line, and executed, but code now runs without error with
    ‘connnected to server’
    Order price: 100.0

    But order is not generated. Can you please help me?

    But the

  104. Amreshwar July 18, 2017 at 3:25 pm

    HI, I have locked indicator and robo on NINJATRADER which giveS the buy/ sell signal. Now how can I connect NINJA TRADER to give buy/sell/short/cover signals to the PI directly? Regards

  105. Saket Kumar July 22, 2017 at 8:37 am

    Hi Sri,
    Can you please try with Python 2.7 and select 2way in Pibridge settings(in user settings),also open Generated alert section.

    Hi Amreshwar,
    You have to do socket programming in Nijascript / C# to achieve this.The socket programming documentation can be downloaded from your broker’s back office.

  106. Navin August 17, 2017 at 5:43 pm

    Could you please send me the sample xls file on my email or share the VBA code for placing orders and retrieving order status?

  107. soundar September 28, 2017 at 12:12 pm

    I have Strategy in Excel..How to add buy and sell signals in excel that will be automated in PI? I am PI user. Pl guide

  108. Jay November 2, 2017 at 6:20 pm

    Is there any documentation that provides details of following calls…?

    Request Pending Orders
    Request Completed Orders/Trades
    Request Equity Holdings
    Request Admin Positions
    Request Funds Available

    I am aware that Pending orders writes the details to log but not able to find any info on rest of calls.

  109. Sumit Jain November 4, 2017 at 8:18 pm

    i have a account with Zerodha

    how can i get the pi bridge for excel vba? Pls advise

  110. muniraj November 7, 2017 at 7:57 pm


  111. Venkat November 10, 2017 at 9:12 pm


    In the Excel Pi Bridge You tube video, I see that there is a PIBridge_Installer_Excel_VBA.Exe.
    Could you please let me know where I can get that.

    I downloaded PI Bridge from “Q”. It does not have it.


  112. PAVAN November 24, 2017 at 3:14 pm

    how i can get pibridge excel VAB ??

  113. Praveen Soni December 21, 2017 at 7:01 pm

    I have account with zerodha. I m not an software engineer and don’t know anything about programming. Can u help me start auto trading in my zerodha kite account.

  114. Manoj Singh December 27, 2017 at 4:12 pm

    Hi, I want to use python script to fire order in pi, how can I do this, the sample python code is not working

  115. Manoj Singh December 27, 2017 at 4:18 pm

    My start pibridge is not activating,what is the issue?

    Clicking at the “Start pi bridge trail” nothing is happening

  116. L S Singh February 8, 2018 at 10:54 am

    Dear Saket Kumar

    I used to link RTD market watch from PI to excel .( 5 nos market watch consisting of 50 scripts each).It works fine for the first 15-20 minutes.But, after that PI stops working.Is it normal ? Please advice for a solution.


    L S Singh

Leave a Reply

Your email address will not be published. Required fields are marked *