GFDL Trading Bridge with Zerodha Pi :



  • Minimum Requirements
    If you need this facility, you will need to have following :
    1. AmiBroker
      Compatibility :


1. This Trading Bridge is written for AmiBroker Standard, Professional or Ultimate Pack Pro Editions and can be tested even in free trial edition. We have tested it on latest Official Release 6.0 and works just fine in AmiBroker running on Windows XP, Windows 7 (32 bit / 64 bit) and Windows 8.


2. We have briefly tested Trading Bridge in AmiBroker Version 5.2 to 6.0 (stable releases - not RC or any Beta Versions) and it seems to work fine - except one problem. The popup window that shows order details as soon as the order is triggered is small and does not contain all order details. This is so because these versions of AmiBroker had small sized popup window of 'fixed' size and provided no way to define a custom (bigger) window. However, this is only a 'display problem' and it sends correct order with all relevant details to Pi.

    1. Realtime data from us (Any of our data products)
    2. Trading Bridge (provided free of cost by us for all our data platforms and is included with the standard installation as an introductory offer)
    3. Trading Account with Zerodha providing latest Pi Trading Terminal (Consult your broker)

e.   Pi Bridge (API) installed by Zerodha

  • Start Zerodha Pi trading platform and login. Make sure that you have to install Pi Bridge before start Pi platform. To confirm its installed or not, you can check Pi Bridge status from right bottom corner of Pi window as shown in below fig.


  • Start AmiBroker and login to datafeed. Take new blank chart from Menu File>>New>>Blank Chart.



  • Drag & Drop “GFDL_Pi_AT_Ver100” Trading Plugin AFL from Chart Tab>>GFDL-Pi on Blank Chart.


  • Once the AFL dragged on chart, need to set the parameters as per the requirement like here set option YES for Hide “Usage Instructions” from Chart.


Manual Trading (MT) :

What is this :

'Manual Trading (LPT)' allows user to enter / exit positions ANY TIME as per their will - directly from the chart. This type of trading DOES NOT REQUIRE any programming knowledge. User can also combine entry / exit of his own strategy with LPT as well as existing user strategies.


  • In parameters, select Manual Trading Strategy for demo. Set “Yes” for Use Manual Trading (MT).

  • For Manual Trading, we hide Usage Instructions by select option YES as shown above.


  • In Trade Information Option, user need to enter login credential received from broker e.g. Client Id, select exchange and symbol name.


  • Select Order Type as Market “MKT” under Order Management Option.


  • Finally, need to set option YES for Start Trading under Trading Check Order Details First & click on OK button.


  • After set all parameters in AmiBroker & clicked on OK, it will shows Green status for Pi Bridge as shown below:


  • As per the parameters set for Manual Trading (MT), Manual Trading Buttons will display on chart, here simply need to click on BUY / SELL button to place order through Plugin in Pi terminal.


  • Manual Trading buttons are displayed only when you are at the extreme right end of the chart with some blank space - sufficient enough to draw the buttons. If the buttons are not visible, press END button once or twice so that you are at the extreme right edge of the chart.
  • You will need to make sure that 'Start Trading' is enabled - to see these buttons.
  • Once signal will generate in AmiBroker as per AFL, it will pass into Pi trading platform to execute that order, you will need to click on BUY/SELL button in terminal under Generated Alerts >> Trade. To cancel the generated order, do not click on button. It will execute order only after click on BUY/SELL button.



Additionally, you can also use following options using Pi Bridge.

  • Line Pair Trading (LPT) : Line Pair Trading (LPT)' allows user to enter / exit positions on the basis of positions of 2 lines (Buy Line & Sell Line) in the chart. User can position these lines anywhere in the chart as per their will. This type of trading DOES NOT REQUIRE any programming knowledge. User can also combine entry / exit of his own strategy with LPT.
  • Trailing Stoploss: If users want to apply Trailing Stoploss for their existing strategy - even if it does not exist in their original code - they can do so by using 'Trailing Stoploss' feature of our Trading Bridge.
  • Target Based Exit : If users want to add Target Based Exits for their existing strategy - even if it does not exist in their original code - they can do so by using 'Target Based Exit' feature of our Trading Bridge.


Line Pair Trading (LPT):


What is this:


'Line Pair Trading (LPT)' allows user to enter / exit positions on the basis of positions of 2 lines (Buy Line & Sell Line) in the chart. User can position these lines anywhere in the chart as per their will. This type of trading DOES NOT REQUIRE any programming knowledge. User can also combine entry / exit of his own strategy with LPT.


How to use 'Line Pair Trading (LPT)' - Usage Instructions


  • As soon as LPT is enabled from Chart Parameters (right click on chart and select 'Parameters').
  • After reading these instructions, you can hide them by right-clicking on Chart>>Parameters>>Line Pair Trading>>Hide Usage Instructions from chart?>>Yes
  • Under Line Pair Trading, select the options as shown below :



  • Enter Client ID & set exchange, symbol name as shown below:
  • Select Start Trading Option >> Yes & click on OK button to close parameter settings.


  • From menu Insert, insert a Line on chart. Double-click on this line and in the Properties box that opens up, write GB against 'Study ID'. This is our 'BUY LINE'. You can change its color to GREEN for easy referencing during trading.



  • Follow same procedure to insert a SELL LINE. i.e. from menu Insert, insert a Line on chart. Double-click on this line and in the Properties box that opens up, write GS against 'Study ID'. This is our 'SELL LINE'. You can change its color to RED during trading.


  • Ensure that Zerodha Pi is already started and you are logged in to Pi Bridge.


Trailing Stoploss :
If users want to apply Trailing Stoploss for their existing strategy - even if it does not exist in their original code - they can do so by using 'Trailing Stoploss' feature of our Trading Bridge


1. Use Trailing Stoploss : Select Yes to apply Trailing Stoploss to your existing strategy (which does not originally have any such provision).

2. Trailing Stoploss Method : You can choose either 'Percentage of Entry Price' - or 'Fixed Value'.

3. Trailing Stoploss Value : You can enter the stoploss value here. Based on your choice for Trailing Stoploss Method (Percentage or Fixed Value), stoploss will be calculated.

4. For Long, trail with respect to : You can choose 'Highest High since Buy', 'Highest Close since Buy' or 'Lowest Low since Buy'. Accordingly, the stoploss will trail from your selection.

5. For Short, trail with respect to : You can choose 'Lowest Low since Short', 'Lowest Close since Short' or 'Highest High since Short'. Accordingly, the stoploss will trail from your selection.

6. For Long, triggering field for trailing stoploss : You can select Low or Close. Only when selected field breaches trailing stoploss, position will be closed on chart / order will be sent to Pi trading platform.

7. For Short, triggering field for trailing stoploss : You can select High or Close. Only when selected field breaches trailing stoploss, position will be closed on chart / order will be sent to Pi trading platform.

8. Show Trailing Stoploss lines : When enabled, it will show the trailing stoploss as lines on chart (green dashed line for Long and red dashed line for Short). To avoid clutter, only single trailing stoploss line corresponding to last signal triggered on chart (towards extreme right end) will be shown. For example, if last signal on chart is Buy, trailing stoploss line only for Buy will be shown on chart.

9. Hide Usage Instructions from Chart : Selecting this setting will hide 'usage instructions' from chart


Target Based Exit :


If users want to add Target Based Exits for their existing strategy - even if it does not exist in their original code - they can do so by using 'Target Based Exit' feature of our Trading Bridge.

1. Use Target-based Exits : Select Yes to apply Target-based Exits to your existing strategy (which does not originally have any such provision).

2. Target Calculation Method : You can choose either 'Percentage of Entry Price' - or 'Fixed Value'.

3. Target Value : You can enter the target value here. Based on your choice for Target Calculation Method (Percentage or Fixed Value), Target will be calculated.

4. For Long, triggering field for Target : You can select High or Close. Only when selected field breaches Target, position will be closed on chart / order will be sent to Pi trading platform.

5. For Short, triggering field for Target : You can select Low or Close. Only when selected field breaches Target, position will be closed on chart / order will be sent to Pi trading platform.

6. Show Target lines: When enabled, it will show the Targets as lines on chart (green thick line for Long and red thick line for Short). To avoid clutter, only single Target line corresponding to last signal triggered on chart (towards extreme right end) will be shown. For example, if last signal on chart is Buy, Target line only for Buy will be shown on chart.

7. Hide Usage Instructions from Chart: Selecting this setting will hide 'usage instructions' from chart.


Suggestions :