Pi Bridge for Amibroker
Traders,
Pi, our proprietary trading platform is now accessible to everyone who has an account with Zerodha. It has all the features you could expect in a modern trading platform. Check out https://zerodha.com/pi.
Why Pi Bridge?
With Pi we are trying to introduce the concept of coding and backtesting strategies. “Tradescript” the scripting language on Pi is intended for traders who want to code their own trading strategies but don’t know how to program in low-level languages like C, C++, and others. Without a programming language traders can’t develop automated trading systems or perform backtesting of strategies. Tradescript, a vector programming language, offers extreme flexibility with a minimal learning curve. So for example, the code for a 14-candle moving average strategy is Close>EMA(Close,14). Quite simple, right?
Tradescript is good for traders who don’t know programming, and for those who are looking at it as a stepping stone to learn. But for professional traders out there who are adept at coding and run complex trading strategies, Tradescript will not fit the bill. We ran a survey few months back to find out what such advanced traders like to use. The answer was: AFL, Easylanguage, Python, C++, etc. Tradescript is within our trading platform, so executing trades based on signal/alerts is quite easy. But what about traders who are using pure charting, analytic, or programming tools like the ones above which have no trading capability?
This is why we (Zerodha + Tradelab) have decided to build Pi Bridge to give seamless and reliable connectivity from the charting or programming tool to the trading engine on Pi. The plan is, whatever be your front end, we will help you fire orders using the bridge. This will definitely be the first of its kind in India. We started off by enabling the bridge for the most popular request we got – AFL or AmiBroker Formula Language. We also made the bridge compatible Ninjascript (Ninja Trader) and other programming languages like C, C++, C#, Python, R programming etc. Check this link to know more about them.
Following are the details on getting started with Pi bridge for AmiBroker:
Enabling Pi Bridge
You can place a request for the bridge on the Pi page of Q by clicking on Start the Pi bridge trial .
After a 7 day free trial we you will automatically be charged Rs 500/month + taxes (which will be automatically debited from your trading account on the first week of every month). Enabling the bridge might take up to 24 hours from the time you have put in a request.
If you wish to unsubscribe, you can disable access from from Q itself, as manual requests will not be accepted.
Installing
Make sure both Pi and AmiBroker applications are closed. Download the installer from Q after you are enabled for the bridge.
Double click on the Pibridgeinstaller.exe file from the installation file for Bridge that you would have downloaded from Q. You should get a message saying Pi bridge installed successfully within a few seconds. Once done you should be able to see pibridge.net.dll in installed Amibroker folder on your computer.
Launch Pi and select Two-way Semi-auto or Mock trading
Make sure you first launch Pi before AmiBroker (every time you want to use the bridge). You can go to View -> User Settings on Pi, and under Pi Bridge choose either Mock , Semi Auto, or Two-way Semi-auto trading (will explain both in a bit).
Launch AmiBroker
If everything has happened correctly, as soon as you launch AmiBroker, you should see the Pi Bridge button turn from red to green at the bottom of the Pi screen.
*Even if you don’t see a green light, we have added a small check in the AFL if(!brd.GetConnectionStatus()) brd.Reconnect(); to reconnect the bridge before the order is fired.
Difference between Mock and Two-way Semi-auto trading
When you select mock, orders are logged as a file and this can be used to test and improve your trading system. You can find the log under Pi folder as PiBridge.log; see the image below.
In Two-way Semi-auto trading, the orders instead of getting logged onto a file, get logged into a window called “generated alerts” from where it can be very easily traded.
Firing order from AmiBroker using AFL
To place orders, you have to first create a Pi Bridge object using CreateStaticObject function (AmiBroker function to create a global instance) and place orders using the PlaceOrder function.
API Details –
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)
Example:
//COM Calling function:
brd=Null;
if(IsNull(brd))
{
brd = CreateStaticObject(“pibridge.Bridge”);
}
//AFL Buy Logic
brd.PlaceOrder(“NFO”, “NIFTY15SEPFUT”, “NIFTY”,”STRATEGYNAME”, 1, 50, 50, 8500.05, 0, “L”, “NRML”,
“DN0005″,”DAY”);
where
pExchange = “NFO” or “BFO” or “CDS” or “MCX”
pTrdSymbol = “NIFTY15SEPFUT”
(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 or2 . 1 for Buy or 2 for sell
pInitialQty = 1 (put actual 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”
Here is an example on a simple strategy, sending a buy/sell order every 15 seconds at a predetermined price.
Write the AFL and take it live on AmiBroker
Generated alerts window on Pi
As soon as you take the AFL live, every time your AFL gives a buy/sell, the alert is logged into the generated alerts window (under the Alerts menu on Pi) along with a Buy/Sell Trade button. When you click on this, the buy/sell order window opens with your predetermined product type, quantity, and order type. See the pic below where you will see a buy/sell alert generated every 20 seconds.
Here is a short Video of the Pi Bridge for Amibroker in action:
For all those looking to get started coding on AmiBroker, here is a link to download a database of over 5000 AFLs. Make sure to backtest before taking any strategy live. If you have any coding related queries related to the Pi Bridge you can post it here.
Note: The Pi bridge will work with AmiBroker irrespective of where you source the data feeds from. As a Zerodha client you can get a special offer on real-time data feeds from Neotrade Analytics.
Happy Trading,
Does the stop order (stop loss order) from Amibroker send the “native stop order” that hosted in the NSE exchange? It can reduce a lot of slippage. If it is a simulated stop order hosted in Zerodha or Amibroker, it will be kinda slow. Where will the stop order be hosted? Thanks..!
AmiBroker is a fantastic tool for trading, Please do something to connect kite to Amibroker so that we could plot the Nifty50, Bank Nifty Option charts into it and do necessary analysis, also include cash equity for NSE. This will help many trader.
Zerodha does not currently offer an API bridge for integration with third-party charting software like AmiBroker. For those with programming expertise, the option exists to develop a bridge independently by subscribing to Kite Connect API.
Have you spiked the pi to excel link. It never works, shameful, if you did not spike it, its pure incompetence, and you are greedy if you spiked it. Traders leaving you by thousands because of this .
Right now its possible to make bridge in between MT4 and zerodha?
Hey Ilyas, we don’t offer this product anymore I’m afraid.
Is Pi bridge functionality still there ?
I dont see any option in console in this regard. Hence asking.
Can i use Zerodha account and Pi for automated trading? Is using Amibroker alongwith Zerodha Pi must for auto trade?
Dear Sir I was using PI Bridge software from many years on two computers but suddenly PI software is not working on both the computers with PI Bridge software from 12/05/2020 onward.
Pi software is working but if I installed PI bridge, PI software gives error.
Please find the solution or check If PI Bridge Subscription expired.
Client ID : DM3713
Please create a ticket on our Support Portal and someone will be in touch to help.
does product type CO, BO allowed for firing order from pi bridge?, apart from pProdType = “NRML” or “MIS” or “CNC”
I’m afraid not.
May I know what is the price of this Amibroker to Zeerodha pi API and who is the provider for the same ?
Best raise a ticket on our Support Portal for this.
May I know what is the price of this Amibroker to Zeerodha pi API and who is the provider for the same ?
I’m afraid we don’t offer Pi Bridge anymore.
Hi Sir,
My orders are fired through pi bridge but when i confirm the order in Generated Alerts window
it gives an error saying “Order tag should be alphanumeric and max 8 chars in length.”
Any help will be useful please reply asap…..
Regards.
Can we place a cover order through pi bridge….??
Without toggling the order form in the generated alerts window…???
Hi ,
After new Pi update , facing issue with Pibridge for excel …
like “=PiBridge.GetNetPosition ” not working …
all was working fine before pi update …
Plzzz Help …..
Hello sir,
Can you give details on hardware requirements for
Daytrading, algo trading and for effective back testing and to take full advantage of pi and other real-time charting software.
Thanks in advance
Ashokkumar
We’ve mentioned the system requirements here.
Sir,
I am getting following error while placing order from Amibroker chart window to pi software. that too only for few equities not for all. kindly resolve the issue. Thanks.
“com error HRESULT=8002000a”
Does Pi Bridge works with Scan Process in Amibroker?
Yes.
hiii ….sir ……
in pi bridge -amibroker…….
can give auto buy sell signal……or……..on your own
I am following up with Zerodha team for almost 10 days for activation of PI Bridge trial for my client code DS7294. Despite several emails stating that I have followed all processes for installation of PI Bridge, the same is not reflecting yet in User settings on PI and bottom right corner in PI. Zerodha customer service is unable to understand this, and sending me email with process to be followed again and again.
Can someone help me with my problem? I have followed all processes perfectly for installation of PI bridge.
Thanks for quick action and rectification of problem. Thanks again.
sir
Why Pi is not working now.Earlier it was working now i have installed and reinstalled and it is not getting launched.i am using windows8.Kindly revert back
Why Zerodha is restricting bracket orders through Pi Bridge. I think no complex technicalities involved. When can zerodha users expect Bracket order placement through Pi Bridge. Unnecessarily we are forced to look for other routes for semi auto trading using maximum leverage, when we have such a good Pi platform,
Hope Nithin is seriously considering to expose APIs for bracket order placement through Pi Bridge.
Hey, we have stopped supporting new upgrades to Pi Bridge. Have you tried using Kite Connect APIs for placing Bracket Orders?
Hi..
Their is any leverage for delivery trading, like a 5paisa brocker
Hi Nithin,
Is the LTQ in Pi, the volumes traded at you terminal or at the exchange?
For ex, if i sum up the LTQ (Last traded quantity) for 1 minute period, is that the total quantity traded at the exchange during the 1 minute period or is it the volume traded only at your terminal?
If i pull out the tick data from Pi through link to excel, the cumulative traded quantity for 1 minute period does not match with the Pi or kite charts. Why so??
Comparing ticks on 2 separate platforms would always lead to a mismatch. As it happens, it isn’t feasible for any trading platform to capture each and every tick originating from the exchange (there could be hundreds of thousands of ticks in a second). As such, one of these ticks is captured and displayed on any platform. So, when you try to match these, you’ll not be able to. The LTQ you see is from the exchange, but the ticks being different on both the platforms, the summation over a period of time wouldn’t match.
I INTEND TO USE THE SIGNALS GENERATED BY NINZATRADER, PLEASE TELL ME HOW TO INTEGRATE THE PI WITH NINJA I SEE EVERYTHING EXPLAINED FOR AMIBROKER BUT NOTHING FOR NINZATRADER.
Hi Neena, we don’t support Ninja Trader as of now.
Does it allow to use Java ?
Hi Pavan, Pi Bridge doesn’t support Java. You can check out Kite Connect for this.
should i depend on 3rd party data vendor for charting in amibroker , even though i use Pi bridge ?
I don’t know what to say, by default zerodha had activated pi-bridge for my account and they have charged @1k without my knowledge. It would have been better if they had intimated through email/call first.
Hi
I tried installing pi bridge in my latest version of Ami Broker 6.20. However, your support team informed me that Pi bridge will only work on Ami broker version 5 and not on above.
I have genuine doubt on this issue and thus, requesting to resolve this issue for me.
Thanks
Anurag
y mistake i have activated my PI brdige today but i dont want it to be activated suggest me how to cancel it .
I have installed the Pi bridge from the Q-back office.I ran both Pi and Ambibroker application Separately. But still I am unable to see the ”Pi bridge” under User Setting in Pi application.What is the solution?
I am not able to download PI bridge for my account. When I click on “Start PI Bridge Trial”, nothing happens. Please help from where I can try to download it.
Can somebody from support team reply to my query?
Hi Team,
Can Anyone Suggest/ Post Pi-Bridge sample working programs using Python Language to place order/ modify orders ?
I tried with supplied sample program (sample placing order.py) & able to connect the Pi-Bridge (able to turn bottom right Pi Bridge ICON to Green) with successful script execution. but program fails to place order in Zerodha Pi. ..
It generates the following error in Pi log
Error in request packet end:
Not a Valid packet format request, please verify and try again!
Thanks in Advance
Hey Nirali, Pi Bridge support for Python has been deprecated for now. The only available bridge right now is to AmiBroker. I suggest you check out Kite Connect for this.
I have Enabled Pi Bidge but still i am unable to get PI bridge option in user settings nor in the Notification bar (bottom right left hand side).
Zerodha support team as well could not resolved today.
Please help me to resolve this issue asap.
Hey, can you please write to tsiva[at]zerodha.com. Someone will get in touch with you and help you out.
Can PI be used on an Macbook pro
It’s a Windows-only platform, I’m afraid.
Dear Nitin
I am a Zerodha customer trading in cash segment. I am using Zerodha PI software. Just now I have read about PI Bridge. What is the total charges I have to pay for month using Ami Broker with PI Bridge is it totally 500/- or I have to pay separately for PI Bridge and Ami Broker and data feeds.
Thanking You,
Ramesh
It’s just Rs. 500 per month.
How do I unsubscribe PI version, which I install? I didn’t find any where.
Kindly let me know ASAP
Pi is free, there is no subscription charge as such. For the Pi Bridge, you can end the subscription from Q. Write to supprot[at]zerodha.com for more assistance.
if a person opens commodity trading acccount with you and trades do you charge for pi and pi bridge
and if so tell your charges in detail
Hello,
I have sourced some AFL which gives me buy sell short cover signals and plots the same on the amibroker chart
with SL levels and take profit levels
I have enable PI bride
My question is
My AFL can give me signal on any chart of currency or Commodity or FNO
So how do i get them as alerts in PI to trade as this looks bit complicating and difficult to implement. I already went through available blogs on z connect but since I am not from coding background its not happening proper
Manish
9820818028
RM0215
Hey Manish, I suggest you write to tsiva[at]zerodha.com for assistance.
I have not enabled Pi Bridge and yet I have been charged since last two months!
Can you write to tsiva[at]zerodha.com with this? Will have this rectified immediately.
sir if i took a normal position and after 1 week whether margin amount exceeds for that normal position whether my position will be hold or my position will be sqaure off
Which software is good for scanning live candlestick patterns currently formed or forming in Cash and Derivatives and MCX market such as bullish engulfing, hammer etc. Please advise the cost per month as well if you have any info?
Hi Nithin, I would request you to comment on Investar, investar.com when it compare to ami. & ninja. for pi bridge and other technical & automation Intra day trades.
Pl. advise.
Thank you
Raj Kamath
Hi Nithin, I would request you to comment on Investar, investar.com when to ami. & ninja. for pi bridge and other technical & automation Intra day trades.
Pl. advise.
Thank you
Raj Kamath
By mistake i have activated my PI brdige 3 days back, now the status is showing as enabled.
Please tell me how unsubscribe it ?? i dont want it but unable to find the unsubscribe button..
Anil, You will have to write to us at [email protected].
Hi,
I wanted to know whether Zerodha provide any execution algo to execute large option orders without much slippage/impact cost !!
If yes, then on which platform it is provided??
I have seen a execution algo on Symphony Presto platform.
Does Zerodha have one??
Thanks
Rama, you can check out kite.trade.
how to cancel pi bridge access?
Dipak, can you write to [email protected].
can i do mock trading through pi bridge without live data feed in to amibroker.
i understand that now to make full use of amibroker plus pi bridge , cost will be Rs500 to data feed plus Rs 500 to pi bridge.
without data feed from a third party vendor i can save relevant costs
No, I don’t think it is possible.
Hi Zeroadha,
I am trying to setup bridge between Zerodha and Amibroker. I have installed it correctly. However, I do not see Pie bridge in User Settings.
i am interested in pi amibroker setup installation. I have read several times and also contacted customer care for the procedure to install. i have done everything as guided by customer care. it needs to be enabled by zeroda. AS directed i have installed latest version of Pi, then i installed 3.2 version Amibroker. next thing was to install pi-bridge which is not responding as the bridge is not enabled . kindly do that for me. you have so much in advance stage but for all these problems would have solved by taking things our personnel computer on remote access easily or at least chatting would have done the things faster. by email support ticket i don’t think my problem will be solved. This is just a feedback sir. kindly solve my problem ASAP
Krishna, we only support Amibroker versions 5.0 and above.
Does PI Bridge now support placing bracket orders through it? or is it still not supported?
Share Khan API does provide the support for trade tiger.
Not yet Vikram.
What’s the technical challenge here I wonder ? The API call is similar only. This is a major blocker for many like us. Any ETA on this ?
Hi Nitin,
I am surprised that this tool is not available on mac yet. It would be very good if you can provide us ETA for availability of the tool on mac
Thanks
Amrut
Pi since uses dotnet is not really possible on mac.
Hi Nitin,
I am trying to execute the order place command(exactly mentioned in above blog) from ami broker,
command:
brd = CreateStaticObject( “pibridge.Bridge” );
brd.PlaceOrder(“NFO”, “NIFTY15SEPFUT”, “NIFTY”,”STRATEGYNAME”, 1, 50, 50, 8500.05, 0, “L”, “NRML”,”ZT2886″,”DAY”);
Getting following error :
Error::Not a valid packet format request,please verify and try again!
05/09/2017 23:46:14: Error in request packet start:
STRATEGYNA_12_NIFTY_X7D5USM937
nse_fo
NIFTY15SEPFUT
LongSide
50
50
8500.05
0
NRML
50
L
ZT2886
DAY
Error in request packet end
It seems to be the above command no more valid, can you pls share the last function with all the signature to me.
rEGARDS,
aRAVINDH
There is not change in function or parameters formats, if you are trying same above line, check the contract symbol (it should be NIFTY17SEPFUT ) and the LTP price and try, you can check below given simple code for reference,
_SECTION_BEGIN(“PiBridge Test”);
brd=Null;
if(IsNull(brd))
{
brd = CreateStaticObject(“pibridge.Bridge”);
}
if(!brd.GetConnectionStatus()) brd.Reconnect();
brd.PlaceOrder(“NFO”, “NIFTY17SEPFUT”, “NIFTY”,”STRATEGY-S”, 1,1, 1, 9900, 0, “L”, “NRML”, “RA0000″,”DAY”);
brd.PauseCode(60); //Pause the code for 60 seconds
_SECTION_END();
Is PI bridge is compatible to Spider Software IRIS plus? if not do you have plan to do so?
Not possible now, but yeah have some plans.
Hi Nithin,
Do you have any plan to integrate PI/PI Bridge with matastock?
Metastock doesn’t allow outside integrations.
Hi Nithin,
While this is true for the later versions of Metastock, I am sure it can be integrated with earlier versions of Metastock ? I think upto MS V11, it was a different model. Many of us use multiple versions of MS for various reasons and it can help if an earlier version can be integrated to Pi bridge..
Could this be explored ?
Hi Sir,
the link given for 5000 AFL is not working. can you please correct the link and re post it?
Thanks in advance.
Regards
Hari
Here is the link: https://goo.gl/L141Lj
We’ve updated the link so you can check the blog again. Cheers.
can we fire Bracket order with pi bridge or it is only Normal, mis or cnc for Futures
Only MIS/CNC/NRML
Are Bracket Orders allowed from pi bridge or they are not ? Also, kindly clarify if trading in futures could be done via PI Bridge ?
Could you also let me know where to get the data feeds from. In the “download pi bridge” section it’s mentioned that we should use neotrade but then google said it’s closed. I had myself written code which used to login into google finance and retrieve the data…Is there no way, I can use my own code to do this ?
Hi Zerodha…Please activate my Pi Amibroker Bridge..still status is pending..My client is ZT5514
This is done, from next time for any support related queries you can write to [email protected].
Select horizontal line and click on delete, or right click and select delete study option.
To edit, again select horizontal line and right click or double click and select edit study.
For more help on this you can write to [email protected].
Hi Nitin
please include the “Supertrend” indicator in “Zerodha pi”.
Thanks in advance.
With regards
Dear Nitin
Updated the “pi” by removing the old one and installing the new one. The “Supertrend indicator is available.
Regarding drawing horizontal line in “pi” :
How to delete one horizontal line out of many horizontal lines drawn in the chart. How to edit the y-axis value of the horizontal line ?
Kindly help to find out the solution.
With regards.
Hi Nithin, will you please help me to know. willl I have to write it for all the scripts manually in amibrokers ? Or is there any static way to feed it and use it when ever i want. Because there are so many contracts available in the nfo section like June July and etc. your quick response will be awaited Thanks.
Hi,
is there any way to put target and stoploss at once without requiring additional margin?
You can use bracket orders, but possible only for intraday trading. Check this: http://kite.trade/docs/kite
hello Team,
I have my own software, which I and developing for the the generating the buy sell alerts. Will I be able to pull the data from the PI. If so, can you please help me with the details about the languages supported with the version details, Details about available APIs to download the data and the fees for the data.
Ah Pramod, you can’t use data for commercial use.
sorry.. In pi i am not getting pi bridge menu in user setting also as shown above.
In pi i am not getting pi menu also
Hi,
I have activated pi bridge last week. But it is still showing STATUS : ACTIVATION PENDING. and down it shows..
“You have successfully bought Pi bridge, your account will be enabled by admin shortly. Fee of Rs.500 will be deducted form your trading account monthly after a free trial for 7 days. You can stop your subscription anytime by clicking on the cancel link below. Click here in case of any queries on using the Pi Bridge.”
whats the issue???
1. If there is any formation of reversal pattern forming in any stock. The system notified me
Is this possible in PI???
If yes plz mention details over here !!
2.Is there any way to use PI in my android device ??
You have a great managers i must say . Your manager is very much helpful to me.
Thanks!!
1. Ah not currently. You will have to use amibroker or something.
2. No, windows desktop only.
I want the trade script for following condition
MA 3 >MA 5> EMA 9 LAST CANDLE OPEN & CLOSE ABOVE EMA 9 THEN BUY
& REVERSE FOR SELL
Hello,
Can you please help me to understand if the PI bridge is connected to Ninja Trader and if we can fire orders using Ninja Trader 7 ?
Thanks!
http://zerodha.com/z-connect/tradezerodha/pi-bridge/pi-bridge-gateway-to-trade-using-other-programs
Can I use Meta Trader for Pridge Connect .
for Automatic Orders from MT4 to Pi
Not for now.
When are we getting BO support in pi-bridge?
This will take time.
Mr. Nitin,
I am really disappointed the way your support teams are giving support to the customers.
I have called multiple times at your support desk and people are just in a hurry to disconnect the call without providing any resolution.
Can you please help me in getting the PI bridge connected to amibroker? your support team is not able to fix it.
Will get someone to call you tomorrow and help you with this.
at a time can i access the multiple accounts to create multiple order using AmiBroker
Orders can not be placed on multiple accounts. The connections is a one to tone TCP connection.
Hi
“pLimitPrice = 8500.05 (price in INR for NIFTY15SEPFUT)” .I could not understand this statement when in my afl buy and sell signal generated at market price than why i should give limit price to fire my order? pLimitPrice = 8500.05 (price in INR for NIFTY15SEPFUT). Plz rectify my confusion. I just want to connect pi with amibroker for trade where my afl itself genrating buy and sell signal with target on market price and dont want any limit order.
you can fire signal for market order, just modify the parameter “L” to “MKT” in brd.PlaceOrder() function
Example:
brd.PlaceOrder(“NFO”, “NIFTY16SEPFUT”, “NIFTY”,”STRATEGY-S”, 1,1, 1, 0, 0, “MKT”, “NRML”, “clientid”,”DAY”);
you can initiate the above function at your buy and sell signals in your AFL.
i have supertrend afl and getting buy and sell signal in amibroker . I just need to generate in pi. Is there need of modification in afl of supertrend or just punch formula else in ami so that it generate signal in pi?
Yes, you need to initiate above place order function at buy and sell in your super trend
Can anyone please provide a sample afl for use with Pi bridge to scan multiple symbols or a watchlist in Amibroker. When i scan in automatic analysis Pi bridge generates signals but the symbol remains the same only the price of different stocks are updated in Pi. I tried using the following codes, which i read about but when inserted in afl, the afl stopped generating signals.
Symbol = StrFormat(Name()+”-EQ”);//
Qty = ceil(50000/lastvalue(c,1));
Buyprice = Valuewhen(Buy,C);
brd.PlaceOrder (“NSE”, Symbol ,”NIFTY”,”STRATEGYNAME”, 1,Qty,0, Lastvalue(Buyprice,1), 0, “L”, “NRML”,
“DZ1105″,”DAY”);
I am new to coding so anyone with the solution please help me out.
sir ..what is the maximum qty allowed per trade in usd vs inr pair
sir i has coverted my position to normal but i cant place my stoploss order to gtc order
Best to send such queries to [email protected]
hi..
It would be great if you could provide datafeed….why should we go for a third party if you can provide datafeed…Please work on it
thanx in advance
Broker can provide data feed on trading engines, providing outside of trading environment is a grey area in eyes of the exchange.
hi i want to trade on ncdex
We don’t provide trading on NCDEX yet.
can i view the scripts of ncdex
No
Can anyone let me knw where I can get Ans.
Well I had sent an email to Zerodha Support & EA Zerodha regarding mine Pi bridge & AFL query on Last Sun 12/06/2016, whatsoever till date ryt nw I had nt received any respond from them…
So jst let me knw wht to do???
on Which platform should I raise my Query…
We don’t offer any AFL support. You could ask any queries on AFL on tradingqna.com, for someone from the community to support you.
sir i need data table of january month for crude oil in nest trader.
Since we currently don’t show continuous futures chart, January data table wouldn’t be possible.
Is it possible to constantly scan market/particular scripts/segments for price discrepancies using algorithm for the retail traders to find the arbitrage opportunity during market hours?? If so kindly suggest. Not asking for fully automated system.Have to get alerts about the arbitrage opportunity.
Yes Vasanth possible, you could do this very easily on amibroker.
Hi Nitin,
Hope you are doing great!
1. when can we expect pi for macbook?
2. Could you please suggest most suitable software for pairs trading which can be bridged to pi?
1. Pi on mac not possible
2. hmm.. you can just link excel (you will need some programming knowledge though).
Hi,
I’m on a MacBook Pro and was wondering if you had Pi for MacBook.
The installation instructions seem to suggest that it is only for Windows machines.
Giri
Works only on windows. If you are looking at a bridge, check this: https://kite.trade/
Sir,
I am interested in technical analysis and opened account in ZERODHA. Till now I have been using METASTOCK.
Is there any way by which I can incorporate an indicator formula written in METASTOCK in ZERODHA PI and keep it confidential.
Currently it is not possible. You can create expert advisors though https://zerodha.com/expert-advisors/, but they wont’ really be like an indicator.
sir any paid mobile alert service available
Not yet.
sir what is the maximum lot allowed per trade in crude oil mega and mini in mcx
crude 100 lots
crude mini 1000 lots
per order
Crude 100 lots
Crude Mini 1000 lots per order.
sir brent crude oil is available for trade in mcx
Brent crude has no liquidity any more on MCX.
Dear Nitin & Team,
Please guide/ provide sample documents in C# for placing orders from virtual system.
Have you checked the Kite connect API’s https://kite.trade/docs/connect/v1/
sir i need green colour as background in pi software its possible.
Not currently.
Sir,
I was activte pi bridge trial 3 days back but still today it is not connected with amibroker and no technical person can guide in this issue ,they simply say that post your query to tradingqna.
Please help
Dear Sir
How to apply PI Bridge formula into Amibroker. I have copy paste formula from PDF file but it is not saving in Amibroker AFL. Afl is mentioned below. Please correct this Afl.
_SECTION_BEGIN(“PiBridge Test”);
brd=Null;
if(IsNull(brd))
{
brd = CreateStaticObject(“pibridge.Bridge”);
}
if(!brd.GetConnectionStatus()) brd.Reconnect();
brd.PlaceOrder(“NFO”, “NIFTY15OCTFUT”, “NIFTY”,”STRATEGY-S”, 1,1, 1, 8700.25, 0, “L”, “NRML”, “RB0799″,”DAY”);
brd.PauseCode(60); //Pause the code for 60 seconds
_SECTION_END();
================================================================
_SECTION_BEGIN(“test”);
plus=Null;
if(IsNull(plus))
{
plus = CreateStaticObject(“pibridge.Bridge”);
}
Trading_Symbol = ParamStr(“Symbol”, ” NIFTY15OCTFUT”);
Quantity = Param(“Lots/Quantity”,1, 1, 10, 1 ,1);
Strategy = ParamStr(“Strategy Name”, “Zerodha”);
Button_Cover = ParamTrigger( “BUY”, “Click Here To Buy”);
Button_Sell = ParamTrigger( “SELL”, “Click Here To Sell”);
Start_Trading = ParamToggle(“Start Trading”, “No|Yes”,0);
Trigger_Price = Param(“Trigger Price”,7900.00,0.00,10000.00,1.00);
if(Start_Trading)
{
GfxSetBkColor(colorBlack);
Pi Bridge Help Document
GfxSetTextColor( colorWhite );
GfxSelectFont(“Times New Roman”, 25, 900, True );
GfxTextOut(“You Are Trading”, 200 , 20 );
}
if(Button_Cover==1 AND Start_Trading==1)
{plus.PlaceOrder(“NFO”, Trading_Symbol, “NIFTY”,Strategy, 1, Quantity, Quantity, Trigger_Price, 0, “L”, “NRML”,
“DN0005″,”DAY”);
PopupWindow(“Time: ” + Now() + “\n\n\n\n Price: ” + Trigger_Price,”Turtle: Cover ” + Trading_Symbol, 7200,
640*mtRandom(), 480*mtRandom());
PlaySound(“C:\\Windows\\Media\\tada.wav”);}
if(Button_Sell==1 AND Start_Trading==1)
{plus.PlaceOrder(“NFO”, Trading_Symbol, “NIFTY”,Strategy, 2, Quantity, Quantity, Trigger_Price, 0, “L”, “NRML”,
“DN0005″,”DAY”);
PopupWindow(“Time: ” + Now() + “\n\n\n\n Price: ” + Trigger_Price,”Turtle: Sell ” + Trading_Symbol, 7200,
640*mtRandom(), 480*mtRandom());
PlaySound(“C:\\Windows\\Media\\tada.wav”);}
_SECTION_END();
Can you post all coding queries on tradingqna.com
Dear Sir
Please activate PI BRIDGE, I subscribed yesterday but still Activation pending. My PI ID is DM3713.
Thankyou
Yesterday being Sunday was a holiday. It has been activated today morning.
Hi Nitin,
It great that you have provided the bridge but it only logs the trades, is there any scope of automating them with amibroker based strategies in the near future , else are you a partner broker with symphony amifuse to automate my trades ?
Thanks
Srinivas
SEBI has prohibited automation for retail clients. You’ll have to become an Authorized person and obtain a dealer terminal to automate trades.
If SEBI has prohibited retail investors then how come composite edge , sharekhan and IIFL is permitting for auto trading for their clients using the symphony API ? It would to great if zerodha tie-up with symphony and help their customers for doing auto trading using the amibroker based AFL’s.
hi nitin i want ambibroker or any one wat can i do pls
You can contact Global Data Feeds: http://www.globaldatafeeds.in/
Hey …….Thank you. It works.
Hello Sir ,
I tried to download the AFL from the gitHUb as you mentioned the url in your article like this ” For all those looking to get started coding on AmiBroker, here is a link to download a database of over 5000 AFLs. Make sure to backtest before taking any strategy live ”
But that link is not working. Can you please check and advice ?
Thanks
BM Kumar
Check this Link for amibroker AFL Collection
https://github.com/smnuman/AB.Formulae.git
sir my ID is DG0092.My Pi bridge is not working . Request you to please provide help me with team viwer. My phone no is 9646041230
Will get someone to call you and assist you with this.
Is it possible to place the bracket order from the Alert generated window or otherwise is there any option of modifying Shift+F3/F4 shortcut keys to any other key?
Not currently
Is there any pi bridge for metatrader 4 also? I want to create EA and technical indicators in MT4, but use pi for order execution.
Not currently possible with MT4.
Hi Nithin, Venu
I need conversion of MT4 indicators to Amibroker AFL, is there any professionals who can do it for a fee ? do you know or suggest anybody please ? I’m tired of existing MT4 vendors in India 🙁 so planning to move over completely to Ami from MT4…
Why don’t you contact them: http://neotradeanalytics.com/. Tell them you are a Zerodha client, they will give you a discount.
Is Pi bridge to Ninjatrader is launched yet? I have been waiting for this since quite a long time
Yes, if you subscribe to Pi bridge, you can connect to NinjaTrader.
i want installation for amibroker with choks
Hi sir, I m Rajesh, I’m having account with Zerodha, I ‘m getting Live Market Data from other source to feed Amibroker and do the trading, I heard that Zerodha itself giving Live data to feed Amibroker for a monthly subscription of Rs 500/- Is it correct. Can I view the live chart in Amibroker with Live data provided by the Pi-Bridge ?
Rajesh, we are not giving. We have partnered with http://www.neotradeanalytics.com/, can you check with them.
Hi, Nithin
Pls let me know, if pi bridge is supported for MT4 Application. Will be glad to know the same. I can see Meta trader in the screenshot of this post and When I login to Q backoffice, Meta trader is not listed. C#, python is mentioned.
Yeah, MT4 has not been possible because of the way Metatrader is designed.
When will the ninjatrader bridge for pi be ready Nithin. I am sure many ppl have been waiting for it for quite long now.
Donno if you saw this post Karan, we have launched Pi bridge with 2 way communication. You can also connect any program that you want using socket programming.
I am a zerodha client and my question is, How do you get pi to automatically execute every alert generated without having to click on buy and sell for every order generated in Generated alerts window?
Shubham, complete automation is not allowed for retail as per exchange regulations.
Hi Nitin,
I have just become a client of Zerodha. I have a technical query.
Can you let me know if Zerodha has the facility of a scanner, where I can ‘pick’ ready queries and fire the same of a set of stocks.
Examples:
1. I need to run a query (On NSE Cash & FnO) to fetch all stocks where a Bullish Engulfing candle is formed. This query can be run for any time frame (Intra-Day & EOD). The query should return a list of stocks where a Bullish Engulfing candle is formed. Moreover, this will not be a Buy or Sell query as we currently have it in the back testing feature.
2. I need to run a query on 15 min charts. The query should scan the market (Entire market) and display results of the query. The query can be a combination; like, All stocks that have a volume of 10 Lakhs or more and have a price between 100 and 500. Again, this will not be a Buy or Sell query as we currently have it in the back testing feature.
3. I need to run a query to fetch all stocks where a certain Indicator or Oscillator has cropped up. Lets say I need the query to fetch all stocks where the SMA 10 has crossed over SMA 20 AND has a volume of 10 Lakhs or more and a price between 100 and 500 AND at this moment is exhibiting a Doji. Again, this will not be a Buy or Sell query as we currently have it in the back testing feature.
Once the scanner lists the stocks, if I click on Chart, the system should pop up the chart with the technicals in place. For example in ex 1 above; the chart should mark out those areas where there has been a Bullish Engulfing candle. Or like in ex 3 above; the chart should display the SMA’s and mark the Doji.
I ask the above questions because its really cumbersome to select stocks, then put in Buy and Sell queries and then back test it or use it for intra-day selections.
Does Amibroker or Ninja Trader offer these features.
If this is not the correct email ID to ask this question, then please forward it to the correct department or still better please have the concerned person call me.
Warm Regards,
Siddhant
Siddhant, Pi our desktop trading platform has scanning facility. But you can’t use volume condition in the code. Yes, Amibroker and Ninjatrader will both have this option and much more. We have a partnership with http://neotradeanalytics.com/, they can also probably code this scanner for you on AMi or Ninja.
Thanks Nitin appreciate it.
Siddhant
so if i understand correctly,once the pi bridge plus is out, its possible to:
1) bypass cumbersome protocols (as described here(http://tradingqna.com/173/which-software-based-trading-amibroker-spider-ninja-other) and here(http://tradingqna.com/980/trader-fully-automate-their-trades-algo-what-formalities-cost)….
2) get data out of the pi universe into R, python, matlab, excel, any trading platform, just about anything….(provided one has the know how). And things need not be just semi automatic 😉
it blows my mind to think about it. But to make things even better could you not do away with the 55 scrip limitation. make it unlimited, for a cost
Hey Vivek,
yes with bridge plus, you will be able to pull all the order/funds/position details into any programming language of your choice. But note that we will not be able to give you live market data (exchange has issues as it is against their data vending business). We have partnered with exchange approved data vendors, Neotrade, who will give you market data on any programming language of your choice http://neotradeanalytics.com/
But then, don’t data vendors have issues if quotes are taken from pi(pi2ami for ex)?
The bridge we have can be used to fire orders and get back positions/orders etc. We dont’ provide any utility for pulling quotes from Pi 2 ami or anything else.
Nitin Sir, Where is MT4 Plugin.
i m MT4 user i use only MT4 for my trades.
MT4 is a world number 1 technical and auto trade software.
Please Nitin sir do something for MT4 Bridge. MT4 is a very helpful for every trader.
Pi Bridge plus will allow you to connect to most trading platforms. We’ll let you know once its out.
New PI bridge update
Thanks to Nithin, I have been waiting for this PI bridge update since a long time now as it supports more functionalities.
New functions apart from PlaceOrder are ModifyOrder, CancelOrder, GetNetPosition & many more using logging mechanism.
Algo strategy name is not reflected in PI “Order Book” like “Pending Orders” & “Completed Orders”, neither in the PIBRIDGE*.log file.
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.
On Pi, Go to Alerts –> Generated Alerts –> If your orders are traded, you’ll find them here with the strategy name. Here’s a screenshot:
Hi Venu,
Generated Alerts is only for mock & semi automation. Im requesting for “Complete Auto” where Algo strategy name is not reflected in order book or log file.
Any chance that it can be made fully automatic?
Too many regulations around fully automated trades for retail clients. So probably not. But if you are tech savvy, u will know how to automate without us knowing about it. 😉
I read between the lines 😉
Is there a pi-bridge API kind of thing (in C/C++ or Python etc). I would like to write my strategies in Python and fire orders thru pi-bridge. As there is already support for firing orders thru AFL, If you could make the interface API open that would be great.
:), u asked the question just about the right time. We are launching Pi bridge+ in next 10 days. You should be able to fire through python.
Is Pi bridge+ is released? Eagerly waiting for it.
Not yet. We’ll let you know once its out.
Team,
Can we or do we have a detailed presentation on Pi Bridge, if yes, please provide me the link also let me know how much it costs. Regards, Muthu.
Hi,
Can someone please tell me how to place a SL-M buy and sell order in pi bridge.
Amibroker conditions are:
Buyvalidate = ExRem(Buyvalidate,Buy);
Sellvalidate= ExRem(Sellvalidate,Sell);
sir,
what is the difference between trade script and afl
Tradescript is the programming language on Pi, AFL is what is on Amibroker.
helli sir
can i convert interday trading to delivery trading?
Yes you can: http://zerodha.com/z-connect/tradezerodha/zerodha-trader-software-version/zt-position-conversion
what is the meaning of Trade book, Positions, Holdings, Orderbook, and Buy/sell?
Hmmm.. if you have an account with us why don’t u ask ur sales manager to give a demo.
Hi Nithin,
I need all details to start AutoTrading with Pi. (Without AmiBroker)
i.e
1. Coding my strategy
2. Backtesting it
3. Going live with my strategy.
Can you please share any link or document where everything related to Algo trading is discussed ?
Thanks and Regards,
Divyesh
Can you send an email to [email protected], he can help you out.
Is there any way to check PlaceOrder execution status ?
Finding difficulty when we execute PlaceOrder continuously even with the delay.
Example
ThreadSleep(25);
plus.PlaceOrder(“NFO”,TSym,PSym, myid,1, Qty, 1, 0, 0, “MKT”, “MIS”, “RR3676”, “DAY”);
ThreadSleep(25);
plus.PlaceOrder(“NFO”,TSym,PSym, myid,2, Qty, 1, 0, mysl, “SL-M”, “MIS”, “RR3676”, “DAY”);
ThreadSleep(25);
Sometime it will work if we increase delay like 100ms …but not sure ….
It will be good if it returns the status, so that we can send the another if status is completed.
Thanks
Ramesh G
Nitinji,
Have you enabled data from Pi to Excel ?
Thanks
Arun
No
When I am sending command – brd.PlaceOrder (“NFO”, “NIFTY15SEPFUT”,”NIFTY-I”,”Pibridge”, 1,1,0, 7700, 7788, “SL”, “MIS”, “DS2286″,”Day”);
It is working… But when I try to replace the fixed price with a variable… then it gives error
mprice=7700;
mprice1=7788;
brd.PlaceOrder (“NFO”, “NIFTY15SEPFUT”,”NIFTY-I”,”Pibridge”, 1,1,0, MPRICE, MPRICE1, “SL”, “MIS”, “DS2286″,”Day”);
Error hresult=8000402
Please guide..
as you are using PlaceOrder () you can input the price parameter as number, but you can not define as above as it gives error. In Amibroker AFL Parameters are case sensitive.
So how do I send order in Pi if I want to send order value by variables… Will much appreciate your help
to send order value by variables use
Price=NumToStr(L,8.3,True);
brd.PlaceOrder(“NFO”,Symb,Symb1,”AMI”,1,1,0,Price,0,”MKT”,”NRML”,”DV0412″,”DAY”);
in place of “L”
put your parameterized value or the price which u want to place
Price = NumToStr(“SL”…)
where SL can depend on you AFL
Thanks a lot. It worked…
its available for MT4?
We are launching something called Pibridge+, you can connect it to any programming front end that you wish. It will require u to have some software skills though.
thanks for replay
I am whiting for it
thanks
Hi Nithin
Is there a way we can integrate Pi with Metastock Pro Trading System.
Appreciate your response.
Regards
Manoj
We’re working on Pi Bridge plus which should allow you to connect to MetaStock. We’ll let you know once its released.
Is Pi bridge compatible with the trial version of Amibroker?
Hi DK..
PiBridge is fully Comaptible with trial Version of AmiBroker…
yes.
getting This error in Pi bridge testing , can u help in that nitin or expalin the error..
Hi Udit..
That is a warning raised by AmiBroker whenever we Use CreateObject Function in our AFL…
This is to alert the user that COM objects are not MultiThreading friendly..
What does that mean is whenever u create a COM Object and Call a Function…Amibroker will stop the execution of AFL code at that line and wait for the COM Object Function to finish and then continue executing the AFL code..
Suppose if your COM Object Function takes 1minute to Execute then till that 1minute your chart will hang and freeze..
But in Case of PiBridge….Its functions are executed in Milliseconds..and are Called only at the Signal
U Won’t find or Notice any lag when calling PiBridge Functions like “PlaceOrder”
So No Need to bother about that Warning…
Go Ahead..
sir,
as a beginner is bit confusing please share a you tube video it will very helpfull
Sarath, to be able to use the bridge you need to have an understanding on using AFL’s/basic programming.
we have expert advisor on PI software its also fire orders on our strategy, so why there is a need of amibroker ? what is the diff. bet amibroker and expert advisor on zerodha PI software ?
please reply…..
Amibroker is a much more advanced analytical platform. So you can code complex strategies which can’t be on Pi EA
sir, please suggest me, i am not a good programmer so amibroker is suitable for me or not ? if yes then how the programming strategies will done ? or suggest any other automatic or easy usable software for me to generate bye/sell signal with target……generally which is used in private consultancies….by using particular software they generates bye/sell signals and suggests us to bye/sell……
please reply in detail….
its very valuable for me…
Aniket, if you want to automate strategies you will need to know how to make those strategies into a code/know programmin, Amibroker, pi or any other platform. If someone is selling you a software that it automatically makes buy/sell and makes you money (a money making machine), hmmm.. i’d probably not buy that.
Ankit kinldy spend some time in technical analysis of the Share Market than u will be able to get the idea of u r own strategy or can code it …..
Sir,
In Pi we place bracket order on pressing shift+F1
With help of pi bridge, is it possible to place similar order from amibroker chart?
If I have opened a chart in amibroker then is it possible to open bracket order form to place bracket order for that particular stock?
Not possible to initiate a bracket using Pi bridge from Amibroker currently.
Sir, Thanks for your reply. Are you planning to provide above facility in near future?
Yes we will.
Sir,Can you suggest me some realtime time data feed provider except globaldatafeeds from where i can purchase history data also?
You can try http://www.neotradeanalytics.com/
Dear Sir,
I am using tradescript now i want to amibroker codes fir trading, I want to know you will charge fee for this , if yes how much ,
RM2227
Manoj, the rental for Pi bridge is Rs 300/month. We haven’t still started charging for this though.
is there any amount deducted for the use of pi bridge as of today(11th july 2015). when will the trial period expire?
Nopes, nothing deducted till now.
Hello,
Zerodha Executives are very good, they co-operate but Auto trading through PI is not very easy until you know AFL programming yourself.
Dear Sir,
I am having trading a/c with Zerodha (RS6209). I get free trial of Pibridge upto 10.7.2015. I download Pibridge from Qzerodha. But it was not installed. They require Amibroker path for install. I don’t have amibroker software. Please guide me how to install the pibridge?
Shakeela, there is no point of having pi bridge if you don’t have amibroker software. the Bridge connects ami to pi. If you want ami, you can contact http://www.neotradeanalytics.com/
Hi this is really nice and new to India 🙂
I was wondering if there is any API for python ?
Harsh, in the next two weeks we are launching Pi bridge +, basically sockets through which you can pull all trading account data and also fire orders from any programming language, including python.
Nithin sir
when will new version of pi bridge + has been launched eagerly waiting for that which
already explained by you that it is basically sockets through which we can pull all trading account data and also fire orders from any programming language, including python.
So Sir can i place and fire my order from itself when signal generated in my amibroker
through pi bridge+ to pi irrespective of any real time datafeed of choice i have used please explain
Yes that is the plan. We are testing right now, son in a few weeks.
Waiting desperately for Python API….
When can we expect Python API’s? Please let me know as soon as it is available.
We will let you know soon.
so can we place bracket orders with this plugin
No Kishan, brackets not possible for now.
Has the field for Quantity changed from net quantity to lotsize?
brd.PlaceOrder (“NFO”, “NIFTY15JUNFUT”,”NIFTY”, “STRATEGY1”, 1, 100, 0, 8306.25, 0, “L”, “MIS”, “DM9999″,”DAY”); ==== gives and alert with quantity 2500
In earlier version (and in the code in this article), it is quantity, not lots.
Any such changes, must be communicated properly, else will create problems.
Hi Manoj,
In Pibridge Code,
If Trading Equity, then the pInitialQty variable should be filled with number of Shares U want to Buy/Sell
If Trading Futures,then u should enter number of lots to Buy/Sell(Not Lot Size).
In your case, u have entered 100 lots of Nifty.So your total quantity in generated alerts is 100 x 25(Lot Size of Nifty) = 2500.
PiBridge code is not Changed.
Hello Nithin
Is it possible to connect to PI software without the bridge through some custom code without using your PI Bridge (any exposed API for PI ) ?
Best Regards
Syam
Syam, the bridge is the only way to connect. The bridge soon will have options for you to fetch your order status/funds, positions, and more. The bridge will also soon have an option to connect to other programming languages like python and etc.
Thanks Nithin. Will it be possible to directly generate the order window rather than just logging the amibroker signal in the alert window in pi ?
Not for now Syam.
Thanks Nithin. Would you consider adding that feature any time soon ? That would save bit of time between order generation in AMIBROKER and TRADE EXECUTION and reduce slippage due to time delay between the two.
Regards
Syam
Hello
In the example you have shown an alert every 20 seconds. What is the minimum time-gap allowed for such high frequency alerts?
I am asking because an ex-employee of NSE once told me that very short times between orders are alerted to NSE Surveillance as possible (illegal) auto-trading. He was part of the team which did this.
So if Pi Bridge generates orders say every 5 seconds (for say 2-3 minutes) and I rapidly accept them as-is, will this be a problem? I am stretching the example a bit, but want to know if there are any such limits.
Manoj, you don’t have to worry about this. These are just alerts, when you place a buy/sell on this alert, the orders are sent through our execution management system. EMS takes care of all the exchange compliance issues.
Hello Nitin,
First of all thanks for providing the ‘Pi’ platform , seems to have most of the features that are needed for a professional trader. Can we connect and place orders from Meta Trader 5 on android?
Metatrader is still not possible, but we are working on it.
I trade using Metatrader 4 charts. I hope you come up with Pi bridge for Metatrader 4/5 as early as possible.
The issue with MT is that all signals from MT fires only to its proprietary server. We are working on this.
hi nitin and choks
i have installed latest version of pi and pi bridge but pi bridge tab s not appearing in user settings,but pibridge.dll is placed in amibroker folder , path to amibroker folder is program filesx86 so created a empty folder in programfiles no use
used choks trail code and made it work in amibroker but connection s not present , help me subscribed pi bridge for amonth
Hi Chandru,
Seems like not enabled from server side…
Pls send a mail to [email protected]…
They will get this done..
Hello,
Some questions:
1. I want to buy manually, but place a trailing stop loss of 3% on a daily basis based on previous day’s close, and should trigger a sell if the stop-loss is breached.
Is that possible?
The trailing stop loss should get adjusted everyday.
2. Similarly, a trailing stop loss for shorts.
3. Do I need to keep my machine and Pi running through the whole trading session, for this, or would the alerts and scripts be saved on your servers?
We have trailing SL orders, check this link. We will have this on latest release of PI by tonight.
The order is at the server end, so you don’t have to be logged into your system. That said, currently this order type is only for intraday trades. All bracket and trailing SL orders get squared off by 3.20pm everyday.
Thanks. I do not trade intraday, so any way to do this across different days, based on previous day’s Close?
Can this be scripted into the Alert funcion of Pi?
Hmm.. not possible for now. The issue is that exchanges in India consider anything that changes its value automatically as an algo. If it is an algo it has to run at our servers, and not allowed on your machine.
Any plans on enhancing the intraday trailing SL feature to across days? Asking because a good built up profit got negated in just one day on Bank of Baroda 17% spike today!
Or if even sending an SMS alert would be extremely helpful….if not actually executing an exit trade.
We have plans to build something like this, but will take some time.
For now it is not possible because exchanges in India cancel all pending orders end of each day.
hi, i have installed the latest version of pi, but i still cant get the cross-hair on charts. without that its very difficult to browse through charts. m sure its a pretty basic tool . if i have missed it somehow kindly tell me how to enable it . thanx
Puneet, cross hair is not available as of now. But you can left click and hover on the candle to do the same. Explained in this post.
For me, AmiBroker is not getting connected to Pi. I tried various AFLs posted above by Choks and others. But, it couldn’t connect to Pi.
Yesterday when I started the trial for the bridge, it was connected with the AFL I used for connecting and logged the trades to a file even though, I selected Live Semi-Auto Trading in user settings of Pi. Support was unable to resolve it. Can anyone clarify what’s going wrong?
Nachiket, will get someone to call you back on Monday.
Hi Joshi,
Follow the below Trouble Shooting steps…If U checked all the steps..then Pi Bridge will work Fine
If Orders are not shown in Generated Alerts Window on Pi or Pi Bridge is not Working.
Then….
1.Ensure that Amibroker is installed in C:\Program Files\Amibroker Directory
If U are Using 64bit os then Create a Empty Amiboker Folder in C:\Program Files\ and Amibroker may be installed in C:\Program Files (x86)\Amibroker
2.Ensure Pi & Pi Bridge is installed and U are enabled for Pi Bridge
3.Ensure pibridge.net.dll file is present in amibroker directory
4.U must first start Pi and then Amibroker..If u opened amibroker first and secondly pi..then Just close and reopen Amibroker only
5.In Pi–>> User Settings under PiBridge Tab Select – Live Semi Automatic
6.Ensure in Ur AFL u have correctly mentioned Exchange,ClientId,TradeSymbol,Symbol,Qty,OrderType,ProductType,Validity
7.Use the sample AFL to check the Function Again
8.Fired Orders will be available in Generated Alerts Window on Pi
Download the sample AFL from the link below
It has both Sample Trading System and PiBridge
U can use this AFL for Your own Trading System
Instructions are given in the AFL itself
U Can check the Pi Bridge Connectivity From Parameter Window
https://drive.google.com/uc?export=download&id=0B-AWKNHhYByLZmVEVFNxRVBuNUU
Hi Choks,
I don’t know whether you’re from Zerodha or not, but either way, thanks for taking out time.
1. I actually replaced all the paths in your AFL with this path “C:\Program Files (x86)\AmiBroker”.
2. I installed Pi bridge after I was enabled and it showed the successful installation message like in the installation help file.
3. pibridge.net.dll file is present in AmiBroker directory.
4. I opened Pi first yesterday as well as today.
5. “Live Semi Automatic” was selected after installing the bridge, before running AmiBroker for the first time after installation.
6. Exchange,ClientId,TradeSymbol,Symbol,Qty,OrderType,ProductType,Validity have been correctly mentioned in the parameters of the AFL.
8. Fired Orders from the bar replay function were shown in the order log file in the Pi folder yesterday even after selecting “Live Semi-Auto Trading”. They were not reflecting in that file today, neither in the generated alerts window.
There seems to be some other issue. I’ll try with the sample AFL you’ve given again.
Please introduce the ichimoku indicator in pi.
Can i code my own custom indicator using trade script.
Thanks
Indicators can’t be coded. We will add new indicators soon.
If i place a market order from any location off pi chart..will it be executed?
There are no market orders allowed when trading from the chart. If you are buying below the current price, a limit order is used, and if you are buying above the market price a stoploss limit order with trigger is used.
Any problem..if provision of market order directly from charts enabled..it will greatly increase execution efficiency which is vital for intra-day scalpers. one click market buy/sell orders with pre-set (eg quantity) criterion from chart itself is desirable.
The idea of placing orders on the chart is to basically put points at which u want to buy/sell (lines are drawn wherever you place these orders). If you want one click orders, go to user settings and untick on order confirmation/transaction pwd. Now you can use the normal order window as one click buy/sell.
1. Please enable pi bridge to place manual order from Amibroker chart.
2. in pi chart,plz enable crosshair.without it, very difficult to see ohlc value along with volume n other indicators.
3. in pi chart ,plz introduce option of color coded volume ( ie say green for rising n red for decreasing vol)
Thanks
Yep on our list.
Hi,
Can you please provide some sample AFL codes for Amibroker-Pi bridge integration? i.e. sample strategy and its semi-automated execution for Pi bridge.
Thanks,
Birju
Birju, if you can check in the comments above, Choks has given a couple of strategies. You can also check this section on Tradingqna.
Hai Sir,
I buy nifty 8600 APR CE 4 LOTS @70 (100*70), if on expiry nifty close around 8550 and 8600 CE @10 , if i am not sell these on expiry date. how much amount i got, is it 100*10 or zero.
or If NIFTY expiry at 8600, if i am not sell, how much i got?
Gp, if on expiry Nifty closes at 8550, 8600 calls will have zero value. On expiry, 8600CE will have Rs 10 value only if Nifty closes at 8610. So if Nifty closes below 8600 on expiry, you get back Rs 0, you get back money only if Nifty closes above 8600. Check this module on options which is still in the works.
sir, I am trading Pi Terminal, position convert is not shown my admin position.
Please tell me solution.advance Thanks
hmm.. convert position is the button next to square off all. Are you using a smaller screen as the screen seems to have shrunk? Can you click on the minimize and maximize button once, right top of Pi screen.
Hi Nithin
Can you give me a expected date when Zerodtha is going to provide MT4 support? I MT4 is most easier for a retail customer to trade. I am using Pi and seriously keep asking for MT4 is annoying. Since I join here I am listening that very soon we are coming with it, but the point is when? Atleast we should have some dates with us or a time frame, recently your support team told me that it will take more two months for this. Kindly increase your speed and help us to trade more.
Thanks
Raman, the bridge to connect to MT4 we have realized is quite tricky. MT4 doesn’t work like Amibroker or other softwares. MT4 talks only to its own servers and nothing else, so if you have to fire orders to anywhere outside the MT4 universe, it is not possible. Apparently this is available on MT5, and we are giving that a shot now.
Hi Raman..
U can look at this for time being…
http://tradingqna.com/17406/your-algo-read-files-place-orders-process-and-format-please
Hi Nitin,
NT& is quite advanced compared to Amibroker. It is free as well.
My question is will we be able to use all the order types and management options available in NT& with PI?
I think all the orders are on the NT7 software and are sent to brokers terminal as and when they are triggered(correct me if I am wrong here), so if this is the case we should be able to use the Bracket Order features, and several interesting features on NT7 with regards to order management without any hindrance from the regulators AKA SEBI, et all.
Shall we be expecting all the these things fro the new Pi-NT7 bridge which your are going to provide?
One last thing, much programming is required in case of Amibroker, hope no programming will be required for using existing features of NT& with Pi bridge with NT7?
Plz guide at your convenience.
Regards
Aniruddha
Aniruddha, to fire an order from NT7 to Pi, you will still need to write a code, without a code there is no way your NT7 will know that it has to fire a signal.
So the Chart Trader facility in NT& cannot be used with Pi, you mean to say. But the whole point of using NT& is that feature where one can use Chart Trader with all the ATM strategies.
Even in Pi “trade from chart” I am expecting similar features to introduced soon.
Please Advise.
Regards
Aniruddha
I think a much better solution would be to have ‘brokerage interfaces’ for both AmiBroker and NinjaTrader. We’ll be able to manually fire orders from both of them.
Hi Nachiket Joshi,
Manual Orders from Amibroker Chart Like in Pi is possible through AFL..Will Post the Code in http://tradingqna.com/. U Can place Buy/Sell Orders as and When u need.U Can Pre-define Qty, Product Type etc for Each Symbol.Right now the Code will enable the user to place Buy/Sell order only.When the Final Version of PiBridge is released,then it can be modified to fully manage the orders from Amibroker itself.
Hi,
U Can download the Code to Place Manual Order from Amibroker chart from the Below Links.Links. Pls Read the Instructions given in the AFL thoroughly.
https://drive.google.com/uc?export=download&id=0B-AWKNHhYByLWmwxSzlNMTBVZzg
http://tradingqna.com/14486/order-placement-from-amibroker-charts
Thank you for the AFL!
@Nitin
That’s refreshing to hear, will wait for the codes. Also awaiting your reply on NT7 chart trader facility.
Regards
Aniruddha
As long as the chart trader on NT lets u write a code that can fire signals, it will not be possible. Yes we will add more options on Trade from chart.
Its not working completely waste PI Bridge integration is not working.
Sankar, a lot of our clients are using it. There must be something wrong that you are doing, we will get someone to call you back and have this checked.
Is there a Amibroker – Pi/Nest Bridge for Discretionary Trading? Like fire Orders whenever you want to buy/sell.
Manju, you can use the Pi bridge for doing this. Requires some coding from your side on Amibroker though (I know a couple of clients who have done this).
I have two queries:
1. Is tradescript similar to javascript?
2. Can I use Pi bridge with Ninjatrader?
1. No, Tradescript is a vector programming language, more meant for traders who are not proficient with programming. Check this section, you will get an idea.
2. Yes, we are working on taking the bridge live for NT
Are you looking forward to integrate Pi Bridge with Python?
Yes.
Dear Sir,
We have an option of using PI-Bridge for Ninja Trader to, I wanted to ask can one use it with Free Ninja Trader account. With all the functionalities.
Regards
Aniruddha
Ninjatrader is not live yet, but yes you can use it with free ninja trader account similar to AMibroker.
Sir,
How long should it take??
There is no hurry, but need to plan a few things at my end.
Thanks, and if NT bridge works with all NT features, it would be nothing short of a dream. Keep up the great work.
Regards
Aniruddha
After installing the latest version of PI , I am not able to install the PI Bridge. Getting error msg “This is not supported on your machine version” . I am using windows 8.1
what is the status of the MT4 bridge ?????
We are having some issues with this, but should have something up soon.
Hi Nitin,
When will the final version of Pi bridge be released ?
We should have something out next week.
why PI and NEST generates signals which is different as in amibroker…
Hi Biju..
1. The Price shown in During Amibroker Scan is the Close Price of the Signal bar..(Always)
2. The Price shown in During Amibroker Back-test is may be any one of the Below
It depends on what settings u have in Back tester Settings under Trades Tab OR
U can control it in Formula level by Assigning BuyPrice / SellPrice / ShortPrice / CoverPrice
Close Price of The Signal Bar or
Open Price of The Signal Bar or
High Price of The Signal Bar or
Low Price of The Signal Bar or
Avg Price of The Signal Bar or
3. The Price U have in Nest/Pi is the Price at that time of Signal
To understand More easily..
Ur Database base interval is 1 min
Below is the sample 1min Data from 10:00:00 am to 10:09:59 am
Ticker,Date,Time,Open,High,Low,Close,Volume
AXISBANK,11-03-2015,10:09:00,589.65,590.25,589.1,589.65,23916 //Highest of the 10 min Bar
AXISBANK,11-03-2015,10:08:00,589.2,589.7,589.1,589.65,4643
AXISBANK,11-03-2015,10:07:00,589.35,589.5,588.75,589.4,75740
AXISBANK,11-03-2015,10:06:00,589.25,589.4,588.35,589.3,25061 //Lowest of the 10 min Bar
AXISBANK,11-03-2015,10:05:00,589.35,589.95,588.95,589.25,12904
AXISBANK,11-03-2015,10:04:00,588.6,589.45,588.6,589.35,10685
AXISBANK,11-03-2015,10:03:00,589,589,588.5,588.85,5166
AXISBANK,11-03-2015,10:02:00,589.2,589.3,588.45,589,7128
AXISBANK,11-03-2015,10:01:00,589.5,589.6,588.9,589.2,8707
AXISBANK,11-03-2015,10:00:00,589.5,589.6,589.4,589.5,4850
U r testing Ur Strategy in 10 min Chart interval
Suppose U get a Buy Signal at 10:03:59 am..
Ur Buy Order ‘ll be fired to Nest/Pi with price at 10:03:59 am i.e. 588.85 (See Above Quote)
So Ur Nest/Pi price ‘ll be 588.85..
Buy when U Scan …It ‘ll show only the Close price of the Signal Bar…in this case it is 10 min Bar..
Its Opening Price is Open price at 10:00:00 am i.e. 589.5
Its Closing Price is Close price at 10:09:59 am i.e. 589.65
Ur Scan price will be 589.65
Same way Ur backtest price also ..
If Ur afl has Buyprice variable
For example
BuyPrice = valuewhen(Buy,C); then backtest price ‘ll be 589.65 (Close Price of 10Min Bar)
or
BuyPrice = valuewhen(Buy,O); then backtest price ‘ll be 589.5 (Open Price of 10Min Bar)
or
BuyPrice = valuewhen(Buy,H); then backtest price ‘ll be 590.25 (High Price of 10Min Bar)
or
BuyPrice = valuewhen(Buy,L); then backtest price ‘ll be 588.35 (Low Price of 10Min Bar)
U can’t set the Price in Scan Bcoz it always show Close price of Signal Bar..
But in Backtest..If U want the Same price as it is in Nest ..U have code it accordingly..
Hope I explained it Clearly..
I’m getting this error msg when i log in pi trader after installing pi bridge and not able to login.
now updated to latest version and got logged in. thanks
NITHIN,
i installed new patch,where to find pi bridge ,i check user settings
now no orders firing from ami to pi
can u send an email to [email protected] and [email protected] , they will call and help you out.
I am also facing the same issue. Sent an email to the email id given.
Hi Nitin,
I have been testing my strategy live using PI Bidge last couple of weeks. Some of the challenges summarized below:
1. My strategy is live (entry) during first 40 mins. Actually its first 20 mins. During which lot of orders are fired one after the other sometimes around 20 within a minute time.
2. When the order gets populated on the Generated alert window, I keep clicking buy or sell. One of the pain point is its takes some time for this order window to come up and by the time I come to the 20th order more than a minute would have lapsed.
3. Due to this there are lot of slippages and tried to minimize this by cancelling the order confirm window and also voice msg. But still slippage is high for my kind of strategy.
4. Following are some requests:
Can the Buy/Sell window pop up faster.
Is it possible to keep a check box next to Buy/Sell button on selecting that order gets fired immediately.
Is there a possibility in future that PI supports direct order placement from Amibroker like a dealer terminal ( of-course after NCFM certification).
These are really critical points for me or any traders whose frequency of trading is high.
Regards,
Harish
Without the confirm or voice message, I thought it would have been quite fast. But let me speak to the guys if we can make this any faster. Firing orders directly from that generated alerts window is a little bit of issue in terms of compliance. But anyways we are working on seeing how fast we can offer complete automation on Pi.
Its takes some time for the Order window to show up after clicking.
As I mentioned above, if you can provide a check box next to Buy/Sell button and on checking this if orders get fired without needing to open the Order window that would save lot of time.
Good to know that Zerodha is working on fully automated solution. I have seen the demo of one of the product called Symphony presto and looks like there are not many decent competitors for them in India right now in the fully automated space , at-least at the retail end.
Nitin, URGENT ISSUE FOR ME .PI bridge connectivity is not working. Its the same setup i used yesterday. The Bridge Button is not turning Green.
Error msg is ” COM method/function Reconnect call failed. Source:mscorlib
Its not able to access PiBridge.log file as its been used by other program. Please note that I have only PI and Ami open
Getting someone to call you back. If you face any issue send an email to [email protected] and keep [email protected] in cc.
After couple of times of restart this worked fine. Looks like as the PI was responding slow I was clicking on it couple of times and this would have opened another pi.exe. But feel this should be handled at code level itself.
Hi Nithin,
During launch of Pi, it doesn’t pass through the contracts download page and it hangs there forever. This is not the first time its happening, it happens randomly. After few retries, relaunching the Pi seems to fix the issue. What might be the problem? is there any setting i need to do or is there is a option to turn off auto downloading contracts?
Thanks,
Pramod
Pramod, keep the quick login button ticked. Btw we are launching the final release day after, this issue has been taken care off.
Hi Nithin,
Generated alerts in Pi application doesn’t match well with the the AFL buy signal. For the below buy singnal from AFL,
brd.PlaceOrder (“NFO”, “NIFTY15MAYFUT”,”NIFTY”,”SNAME”, 1, 25, 0, 821000, 0, “L”, “NRML”, “RP0000″,”DAY”);
I see quantity is getting changed to 625, limit price is taken as 821000 instead of 8210.00.
Also there is no way to delete the alert from Pi Generated alerts window. This makes quite confusing to track the new alerts and difficult to get rid of the unwanted alerts. Is it possible to incorporate this feature?
However, I really appreciate the Pi tool you developed and banking heavily on the improvements yet to come.
Thanks,
Pramod
Pramod, copy pasting what choks mentioned:
What he has done is Just He copy pasted the Code from the Blog.In the Example given in the blog “NIFTY14DECFUT” price is written as 780000 (Seventy eight thousand);
So he also put lmt price as 821000 (To be 8210.00)
Second, He wish to buy one lot of Nifty…So entered lot size in qty instead of No of lots he want to Buy…So 25 x 25 (nifty lot size) =625
thanks for the clarification Nithin.
hi nithin,
my trial datafeed ends on monday.my support ticket still open ,nobody from zerodha contact me,still my status is activation pending,my id is RB0730,please solve this problem
my status now
Someone from our team will get in touch with you.
thanks nithin
sir,
i requested for pi bridge yesterday.but still my status is activation pending
We approve all requests end of everyday.
Hi Kirrick,
Amibroker is expected to refresh on following factors & execute AFL code. I’m not finding repeated order in PI until unless Amibroker fires ….
1) Local database change
2) Plugin-based realtime feed “Intraday refresh interval” )
3) Dedicated RequestTimedRefresh() function
4) Manually refresh
5) Wakeup from Sleep mode if it is enabled
Just testing my code again which places a single order in live market. Now its continuously placing order very one sec and still not stopped. Attaching screenshot
I closed PI and tried this again and its workign fine. I had opened PI and Ami and was not using it for almost couple of hours and later found this issue. After closing both of them and working on it again its fine now. Anyways this is an issue that need to be look into, the reason being is there is a strategy that generates buy/sell signal once in a day then this might be an issue for the trader.
Kirrick, you have to incorporate the change within your code on AFL to ensure that orders don’t keep firing. Check this: http://tradingqna.com/13310/afl-for-ema-crossover-firing-through-pi-bridge
I understand where you are coming from , but I didn’t do any changes to my code. It was working earlier and it was again working after i restarted PI & amibroker. So only inbetween ( as mentioned in the scenario above) it was not working.
Kirrick, you need to lock once the order is placed, otherwise it will trigger multiple times as it is enabled “Multi threading” and time intervals.
Thanks Ramesh . I didn’t get what exactly you mean by locking, is it something I need to do at the PI end or in AFL code.
Check Choks code here for EMA crossover: http://tradingqna.com/13310/afl-for-ema-crossover-firing-through-pi-bridge. You need to do this in AFL.
you can refer the link as Nithin mentioned …
Add locking mechanism while placing the order
currTimestamp = LastValue( TimeNum() );
LastTimestamp = Nz( StaticVarGet(“LastBarTimestamp_”+Name()+”_” +GetChartID()) );
if ( currTimestamp != LastTimestamp )
{
StaticVarSet( “LastBarTimestamp_”+Name()+”_” +GetChartID(), currTimestamp );
BUY or SELL
}
I got it now what you are referring to as locking. I have a different logic in my trading system code to handle this. Actually I was just testing with a simple code as mentioned in my query above which I fired once ( by scanning once). It used to work always as this is the basic testing code which I use for testing the AMi -> PI connectivity. Only once it showed me the above behaviour ( firing order every one sec continuously ) as I had kept the session open for long time. After I restarted PI and Ami and tried this again there were no issues ( Didn’t do any change to my code). I thought this might be a bug ( in PI or Ami not sure) and that is the reason I bought it to notice of Zerodha. As this might be difficult to reproduce attached the screenshot also.
I was trying to use “MIS” and “MKT” option. Eventhough MKT shows up in the Generated alert window when you click on Buy or Sell button, the window that pops up is still prepopulated with default values liek NRML and Limit. Then need to manually change the values.
Having this checked.
Hi Nitin, Any update on this. Actually i was testing my algo today and its painful to keep changing the values and click on submit as one short lot of orders get into the system. Without Bracket Order and this feature not working, for active day traders this is nightmare.
Also just one more observation : Today morning when I was firing lot of orders that were in Q (generated alerts) some of the orders took time to execute and they were still in the order window. Please note that they were all market orders and orders after these were executed. Observed this earlier also. Later slowly all the orders got executed.
Hi Kirrick,
As a Temporary solution, the following may work..
In Pi User Settings under order Window Tab, Choose your desired Order Type and Product Type.Regardless of what product type and Order type u entered in Pi bridge code..
Your Order window reflect the Order and Product Type from User Settings…
In Short…Just select Prod Type as MIS and Order Type as MKT in user settings in Pi…Ur problem solved.
Thanks Choks, @Kirrick, this should help you for now. Will have this checked out about orders firing being slow from generated alerts window.
Hi Nitin,
Any update on the order execution delay issue. Even today I faced this problem and this is turning out to be a big issue for my style of trading as this will create lot of slippages for me. I am attaching the screenshot also.
I guess I found out the cause of this delay.(Just a guess after seeing this behavior again). This should be something to do with voice alert. Please check with your dev team whether next order gets fired after previous order voice alert is finished?
Kirrick, if there are multiple orders, they are all fired instantly. The voice alert might take a little long to read the orders out. But if you check the time on your orderbook, it will be fired as soon as you click in the alert box. Also there is an option to delete alerts in the generated alerts box.
Nitin, All the orders were Market orders they should not be sitting in the pending order window (Top part of the window) with status Open. I have seen this with ZT also sometimes after the server migration.
For how long does it sit as open?
It depends. When i fired only 2 orders the second order executed soon after voice msg got completed. For the screenshot which I have attached as many orders were in q, it took some time, maybe around 1 min. You can reproduce this by firing 10 to 20 orders one after the other quickly during early morning session.
Thanks Choks. I tried this now (non market hours) and looks like its partially solved. Product is correctly reflecting the settings i.e “MIS”, but the Order Type is still “Limit” eventhough in the settings its been set as “Market”. Need to check this during market hours.
Hi Kirrick,
If U still got Limit in Order dialog..Then U may try this..
since U want to Place order only in Market…
Then add/Subtract Price Slip of 0.5% of C to Ur Buy/Short Price…
i.e BuyPrice = Lastvalue(valuewhen(Buy,C) + (C*0.005),1);
ShortPrice = Lastvalue(valuewhen(Short,C) – (C*0.005),1);
Thereby U R placing a Buy Limit Order with price Higher than 0.5% of Mkt/Ltp price and Sell Limit Order with price lesser than 0.5% of Mkt/Ltp price..
So Ur order gets executed with the available best Buy/Sell Price…
Placing a Order with Higher/Lesser price than Mkt/Ltp dosen’t have any effect if ur intention is to place a Mkt order
I Hope..this may temporarily solve Ur issue
Choks, I am doing this already. But didn’t want to do this as wanted to be 100% sure of order execution as currently there is no way to know in Amibroker about the order status.
Hi nithin
Awaiting for ur PI final release in order to fire BO
I think its too late….
how long should i wait for final release will it it release in this year or not?
¶
The current beta version of Pi is working quite well, yes brackets are still not available. It might take a little longer. I think it will release this year.
During non market hours does PI Bridge work ( For testing purpose). Its not turning Green when I fire the code from Amibroker.
I am using the following code:
brd=Null;
if(IsNull(brd))
{
brd = CreateStaticObject(“pibridge.Bridge”);
}
if(!brd.GetConnectionStatus()) brd.Reconnect();
brd.PlaceOrder(“NFO”, “NIFTY15MARFUT”, “NIFTY”,”STRATEGY-S”, 1, 1, 1, 8395.25, 0, “LIMIT”, “NRML”, “RB0799″,”DAY”);
brd.PlaceOrder(“NFO”, “NIFTY15MARFUT”, “NIFTY”,”STRATEGY-B”, 2, 1, 1, 8412.50, 0, “LIMIT”, “NRML”, “RB0799″,”DAY”);
Use this:
SECTION_BEGIN(“PiBridge”);
RequestTimedRefresh(15, False);
brd=Null;
if(IsNull(brd))
{
brd = CreateStaticObject(“pibridge.Bridge”);
}
if(!brd.GetConnectionStatus()) brd.Reconnect();
brd.PlaceOrder(“NFO”, “NIFTY15FEBFUT”, “NIFTY”,”STRATEGY-B”, 2, 1, 1, 8412.50, 0, “L”, “NRML”, “RB0799″,”DAY”);
brd.PlaceOrder(“NFO”, “NIFTY15FEBFUT”, “NIFTY”,”STRATEGY-S”, 2, 1, 1, 8395.25, 0, “L”, “NRML”, “RB0799″,”DAY”);
_SECTION_END();
the download zip file doesnt have pibridgeinstaller.exe.
it only have patch file.
as per your instruction we have to install it. but that file is missing.
I requested for pi bridge ambibroker for trial today.
its been activated.
the download link for this was done.
but on installation error is appearing.
pls find attachment of screen shot.
pls guide me as there is only 7 days of trial.
my id DA0172.
Anand, don’t worry about the free trial, it is currently free till end of March. Will get someone to get in touch with you.
Nitin,
I was under the impression that with PI bridge we will get the tick by tick data from Pi. But after reading some comments it seems that you need a separate data source for Amibroker. We dont understand then what is the use of the Bridge? Sorry some of us does not have this much knowledge. Can i get the tick by tick data from Nest? I saw some post regarding NEST2AMI.
Hi Anantha Raman,
Pi bridge is just a link between Amibroker and Pi terminal.It enables the Amibroker (Charting Software) to communicate to Pi terminal.Pi bridge’s sole purpose is to fire orders to pi terminal from amibroker whenever u get a signal in amibroker.If Pi bridge is not there, then whenever u get signal in amibroker,u have to switch to Pi terminal and manually enter the order details and place the order which is time consuming.But with Pi bridge,U have ur order details prefilled and just u need to confirm the order.To use amibroker, U need to subscribe data from any authorized data vendors.Pi is Trading terminal just for Trading (With Advanced Features), It’ll not provide U data for amibroker.Amibroker can be feed with data by many ways, and Nest2Ami is one of them..
Anantha, We are not allowed to give you data on anything outside the trading platform as per exchange rules. The NEST2AMI utility is something built by people, and we have no control on it. The use of bridge is only if you are someone who is coding strategies using AFL on amibroker. If you don’t, then Bridge may not be of any use for you.
pi bridge done but get error 31 on alf
Raj, you will need to know AFL to have that fixed.
Hi Raj
Could U post ur code in http://tradingqna.com/..?
Hi CHOKS
I have a personal wish
can u share/upload a Bit advanced AFL best for MCX trades and index espicially crude -gold-nifty
it would great helpfull for all traders
pi bridge showing red plz help me
Send an email to [email protected]
Hello,
i wish to automate a investing (very low frequency) strategy on Amibroker using Pi bridge. Can you suggest some professional outfit or can some super user (like chocks) here can provide me his services on a professional basis to get this going.
Tks.
Alok Jain
Alok, complete automation is a little tricky. You need to be registered as an authorized person, and get approvals. Semi-automation should probably be the first step. If you put up your strategy here: http://tradingqna.com/, can get someone to code it for you.
Hi
When will the next version of Pi bridge be released ? Any tentative date ?
Thanks
sh, we are working on getting the order updates back to Ami. We should have this within the next two weeks.
i am being able to generate the orders in amibroker, the orderlog & orders.txt is getting generated but the orders are not going in PI ? what can be the issue ?
Alerts->Generated Alerts, all orders get logged in this window as you are semi-automated. You will have to click on this to fire the order.
Nitin sir,
User ID : DR2267
I Installed Pibridge and Amibroker but no access to use Pi bridge.Please do give me the access.
Ami-PI Bridge is still not activated, please help
SIR
I REQUEST FOR PI BRIDGE IT IS PENDING ,AFTER ENABLED ,I HAVE TO INSTALL AMIBROKER SOFTWARE OR JUST PI BRIDGE DOWN LOAD ,
Rao, Pi bridge is for people who use AFL (amibroker formula language). So unless you know how to code strategies using AFL, Pi bridge would not be of any use to you. Yes, you will need to have Amibroker, Have data feeds to Amibroker, and have knowledge to code using AFL.
Hi Nithin,
any update on MT4 bridge, when are you planning to release it ?
Facing some issues with MT4 in the way it is designed. MT4 talks only to its own server, so no interface like Ami or Ninja on MT4. Give us some more days.
thanks for the update Nithin
Hallo Nithin Can We Use Any other Data Feeds With Amibroker For PI Bridge or only Use GFDL For Amibroker Data Feed ?
No restrictions on data vendor.
when i try to download the pi bridge from q.zerodha.com, a “pibridgeinstaller.zip” file is what i get. but there is only one file inside it: pibridge_critical_patch_04022015
what should i do?(the bridge was activated on 3 feb)
Vivek, just run that patch, the bridge will be enabled.
IN THE PI CHART HOW TO CREATE BUY AND SELL SIGNALS SIR, IN ALERTS BACK TEST THEY SHOW FAIL TO LOAD CHART , HOW TO GET BUY AND SELL SIGNALS
Rao, alerts can be created using expert advisors or using scripted alerts. Check this video. We will have detailed explanation soon.
RESPECTED SIR
IN THE CHART I HAVE NOT FIND BACK TEST OPTION AND MY STRATEGY OPTIONS
I HAVE ATTACHED SCREEN SHOT
THANKING YOU SIR
K.NARASIMHA RAO
CLIENT CODE :RN0796
Are you talking about backtesting on Pi or on Amibroker? On Pi, you can see under the main menu “Alerts”
Hi Nithin,
My Client ID is DR1595
I have the following up and running :
1. AmiBroker
2. Live NSE Data Feed
3 .AFL for my strategy, capable of firing orders.
4. Pi
5. Ami-PI Bridge (getting activated tomorrow morning)
My Question:
What additions I need to do to enable the same AFL for sending/firing orders to Live Market using Pi?
Thanks
That’s it, you should be able to semi-automate your trades from tomm. This has a sample AFL.
Choks,
Can you code an Amibroker AFL,on any EMA-SMA crossover strategy on NIFTY15FEBFTR,with Pi bridge plug in and voice alert with AFL, as a reference forever, pls for the sake of all
Check this: http://tradingqna.com/12194/afl-to-place-order-from-amibroker-to-pi-using-the-pi-bridge
Having issue with placing order with PI bridge. Following order is sent from AFL thru PI bridge.
Issues are
1) Trigger Price has additional digits 1660.09997558594 in “Generated Alerts” window.
2) The product, Order Type & Trigger Price is NOT updating in Order Window.
Order Triggered as follow
plus.PlaceOrder(“NFO”,”LUPIN15FEBFUT”,”LUPIN”, “try1”,2, 1,1, 0, 1660.10 , “SL-M”, “MIS”, “RC0232”, “Day”);
Thanks
Ramesh G
Have u checked this Ramesh? http://tradingqna.com/12194/afl-to-place-order-from-amibroker-to-pi-using-the-pi-bridge
Will get our tech team to have a look at these two points.
Im attaching screen shot for your reference …
Thanks
Ramesh G
Hi Nithin,
I have raised a ticket ( #658306 on 14 Feb), the main issues are with plus.PlaceOrder ….
1) Trigger Price has additional digits 1660.09997558594 in “Generated Alerts” window.
2) Order Window is NOT updating properly, look like it is fixed to NRML product
a) Product type is not changing to MIS
b) Order type is not changing to SL-M
c) Price is not updating
d) Quantity is not updating
Thanks
Ramesh G
1. Yes we should have this fixed in the next patch.
2. Getting someone to call you back on this. Not getting what you are trying to say.
forgot to mention that apart from so many private softwares for full automation, master trust also provide fully automated trading from amibroker to their terminal MT3..also data comes from their terminal. monthly charge 900rs.. then why not Zerodha !
my expectation is fully automated and to try any strategies let everything remain same just select demo/live button as in best trading terminal think or swim. in options part bring all the features of think or swim.
Dear Nithin/CHOKS,
may i request for any sample AFL which is ready for trade via Pi Bridge. trader should have to change his strategy portion. so the people like me who don’t know language, can easily convert his study and can do trade via Pi Bridge…..!
or plz create any video on that and publish so it can be easy….!
Check this: http://tradingqna.com/12194/afl-to-place-order-from-amibroker-to-pi-using-the-pi-bridge
actually am a novice in trading ,so i cant invest huge amount for trading,and lack of time for trading is a problem for me,so backtesting and automated trading trading is possible ,it will help us
hi nithin,
i have a doubt,what do you meant by active trader,if those who have more than 10000 in their account,do you think they are active traders?
Having 10000 doesn’t make anyone active, but we needed to have some condition. We will change it by the time we have the final release.
D.Omprakash
Hi Nitin i need the coding strategy for the below one and please tell me where i have insert this coding in pi software. The strategy is need alerts in pi whenever eod charts daily charts crosses 30 day ema with adx symbol crossing 20 and above for all stocks
Can you ask this on tradingqna.com, make sure to tag tradescript to the question.
placing BO is not possible in PIE beta
finally can mention the relase date?
¶
We are hoping to have the final release 1st week of March, and yes with BO. Fadil it is Pi and not Pie ;).
Nithin,
Is there any access to Web based trading of PI beta version.
Rajesh
We have a web based version Kite, but might be few more weeks before the beta is out.
Hi Nithin,
I just installed PI in my office laptop.
I am not able to login, possible because my laptop is behind an office firewall.
Any work around for running PI under office firewalls.
ERROR:: Unable to login, please restart to continue
I am getting above error after answering security questions.
Thanks,
Rajesh
Hi CHOCKS
No reply afterwards still waiting for ur update……it very helpfull to all zerodha users
who has lack of knowledge in code writing
He is replying on Tradignqna, do check it out.
Hello Nithin
I am not satisfied Fibonacci retracement tools . Please improved Fibonacci retracement tools for Pi. i am confused this tools. view attachment and improved… thanks
It works the same way as what is in your attachment. 168% is not a retracement, it is an extension, so doesn’t show on this.
I follow all the instructions. but, still pi bridge is not working . I sent 2 or 3 mails . no reply
To which email, and what help do u need? Do u need help with coding?
Hi Nithin !
Am a new client of Zerodha. Please clarify my doubt.
With the Expert Advisor, the trades takes place automatically as MT4 OR I have to wait for popup signal before sitting the system all the time ?
And also please provide the link which shows the HOW TO SETUP AND USE AUTO TRADING with PI.
Thank you and Awaiting your reply soon.
-Sai
VNS, unfortunately complete auto trading is not allowed for retail in India. So you will have to still click on buy/sell to execute after you get the alert.
Hi Nitin, Choks,
I am new to PI and Pi Bridge.
When using pi bridge, got error Access to the path “G:\Zerodha\Pi\userSettings.xml” is denied.
Pi Bridge icon at the bottom showing Red.
opening the pibridgeinstaller.zip, there was only one file in it:
pibridge_critical_patch_03022015.exe is there any file i am missing to download.
Prabhakar, we will have the new exe for the bridge in a little while. Try installing that and see if it works.
Nitin, it seems that new exe for the bridge not available yet. Since it is not available yet, will the trial period/date be extended? 🙂
Trial extended till everything is working perfectly. So definitely extended till the month end.
@zerodha
tried downloading the pi bridge today. only the patch seems to be available, not the bridge itself. after opening the pibridgeinstaller.zip, there was only one file in it:
pibridge_critical_patch_03022015.exe
where can i get the bridge from?
Vivek, give it sometime, we will have the latest bridge updated there.
@zerodha,
if its non compliant to allow feeding ami from nest, why is it made possible by those who own nest , in the first place. the exchange could ask omnesys/reuters to stop it. right?
Vivek, what is used to feed data from NEST to Ami is not what omnesys/reuters has built. It is a hack that some guys have built on their own, and hence omnesys/reuters don’t come into picture.
hi choks,
by macro, i did not mean an excel vba macro….
was referring to the macro software to simulate keyboard and mouse(there are many available online). so it can simulate any manual action in an automated fashion. that way i just have to click one button and leave the pc on for 3-4 hours- i kno thats a lot of time, but its only once in 20 days.( better to use esignal which can give 5-6 years of back data without any hassles- perhaps better than gdfl or neotrade)
pi should start capturing all data for several years. it could offer more than 50k candles for a premium charge- dont kno,maybe, that would amount to competing with data vendors?
hi choks,
am able to get data from nest trader to ami using both the methods u discussed above(1. using excel VBA and Amibroker Com Object…
2.Using Amibroker Dll Plugin and Excel as a DDE server..). been doing so since a long time and have also solved the backfill issue(coded a macro to get data from data table of nest once every 20 days for all scrips in fno,cds segment. hence am having backfill for the last 4-5 months).
my question is: since pi and nest cant be kept running simultaneously(when i login to pi, am logged out of nest automatically), how to feed ami
Hi Vivek,
Log in both Nest Trader & pi at a time not permitted…
Current Version of Pi doesn’t support RTD…
So We have to Wait till the Final Release of Pi…
Could U pl post Vba to extract Data Table from Nest…
Let Me Try it…
Hi CHOCKS
waiting for ur PI Tradescript update
Login in PI and after that in nest both can work. I am doing it because i am using Excel file to monitor my trade.
Can you share the link for Neotrade Analytics pricing for zerodha clients. Unable to find on their website
Can you email: ““, he will be able to help you out.
didnt get it? to whom should i mail?
🙂 [email protected]
Hi,
Those who want to fetch data from Nest Trader to Amibroker, can download the file from the link below.
It ‘s not the new thing, it’s already available in internet..under the name Josh utility …
But I modified certain code for better performance and user interface…
There are Two Method,s
1. using excel VBA and Amibroker Com Object…
2.Using Amibroker Dll Plugin and Excel as a DDE server..
I uploaded the first method Only to Just get started with…
First method uses little bit more resources than second one..
Second Method is very straight forward & Use very little Resource and Faster than 1st method..
(U’ll definitely like the second, one when u use)
//—To Whom—–\\
Those who New to Amibroker and Coding…
and want to test their Buy/Sell Logic and coding…before subscribing to data from vendors…
Who want to familiarize themselves with Amibroker Charting…
And For Those Who not in position to Subscribe to Data….
//——Features——\\
I supports all exchanges..
U only need to add symbol and select Exchange and select contract month(if Futures)..
Symbol ‘ll be automatically add to Amibroker
No Need to Manually Create any Database in Amibroker…
The Amibroker symbol format is Equivalent to Nest Traders TradeSymbol..So U don’t need any symbol mapper or manually enter symbol name in the AFL …
Supports Multiple strategy…..
Data updates instantaneously…
For NSE stocks , Quote’s ‘ll be fetched only from 09:15:00 till 15:30:00..
For MCX , Quote’s ‘ll be fetched only from 10:00:00 till 23:55:00..
U’ll not find any irrelevant quotes in the Database
Starting and closing of the Amibroker from the Excel itself…
Databases’ll be Automatically Backup-ed with Date & time…When U close Excel file..
Data Speed More or Less matches with RT data provided by most of the vendors…
and many more
//——Limitations——\\
It don’t have back fill…means if ur Net disconnected for 30Min.. there’ll be no Quote for that 30 Min…
or if U just sit for Trading at 1100Am… U’ll get quotes only from 1100am..Better sit 10min before Market starts…
(this is the Main Difference between this and the commercial RT Data…For NSE EQ, U Can fill that 30 Min with Google API)
It’s not substitute for RT data provided by commercial vendors…
(Of course, if U r satisfied with this U no need to Subscribe for RT Data)
//—Tested in—\\
Windows 7
MS office 2007
32Bit OS
Nest Trader 3.11.2
Amibroker 5.7.2
//—-Final—–\\
To fetch Data always do
1. First open Nest Trader and log in and Let it fully load
2.Second Open the Excel File (Amibroker ‘ll be Opened From Excel)
If U opened Excel 1st and then Nest Trader..the RTD Function’ll not work
//—-Link—\\
https://drive.google.com/uc?export=download&id=0B-AWKNHhYByLdDdKeHFJYmJTU1E
Dear Choks,
Would like to have the 2nd method in my coffers. Can u post the link plz for dll based feed.
Thx
Hi Alex,
U can Download the 2nd method from..
https://drive.google.com/uc?export=download&id=0B-AWKNHhYByLd3k5ZVl3eDhVX3c
Try both method..Post Ur Feedback..
i got an error while setup excel file (data to ami)
Hi Rahul,
Ignore the Error …
Ensure AmiBroker&NestTrade is not Running
Now Goto Folder options in controlPanel..
From the View Tab…Select Show Hidden Files & folder..Press Apply & OK…
Goto C:\Users\Public\Documents\ or Documents Folder..
There’ll be Folder Named TickData..
Inside that Folder..A File Named..DllReg.cmd..
Just select the File..Right click..Runs As Administrator..
It’ll Unregsiter & Register Nest Dll Files..Press ok Button..
Finished
/////
To Get data…
First Start nesttrader..Login and Wait for it to fully Loaded..
Then open the ShortCut RTDataDDE from desktop..
It’ll open the excel file..
Add all Required…Symbols(Not Trade Symbol),select Excahnge, select Contract month…
Ex
SILVERM – MCX -FEB
ICICIBANK – NSE – BLANK
ACC-NFO-FEB
It’ll show price in LTP Column..
Now press the Open Ami Button..It’ll open Amibroker…
Then Press Add symbols to Amibroker button..
Now All Symbols’ll be added to amibroker..U can Check it Amibroker..
As soon as the market opens..ie 091500 for NSE & 100000 for MCX..
It’ll start feed Data…
U can check the Quotes from Quote Editior in Amibroker…
Hi CHOCKS
iam still waiting for ur tradescript update (PI tradescript) ……..
any plans to release bridge to esignal 12 in future ??
Yes, we do. Waiting to make a bunch of updates on the amibroker bridge first.
Hi Choks
I was asking for a popup alert in Pi when the alert is generated and an option to place order from the alert itself. Yeah i am managing with the amibroker alert for the timebeing. Thanks Choks
Hi Nitin,
When will be the updated version of Pi bridge be released. Its very difficult to use it without popup alert. Please update it and release the new version as soon as possible.
We will have a new patch for Pi and bridge. But the popup alert bit is still not live I guess.
Hi Sh,
where U want pop alert?
in Amibroker? or in Pi?
If Amibroker, it can be easily implemented through AFL……
U can also Hav Audio alert through AFL…….it’ll Alert U even if u are in another room provided that u turned on Ur Comp Speaker….
HI chock
waiting for ur tradescript update
Hi Choks,
Is it possible to get the traded price and quantity from Pi and display it in amibroker chart? Thanks
Hi Sh,
At Present, Pi Bridge doesn’t support that feature.
Present version supports only placing order
As mentioned by nithin,,future version ‘ll include that so that U can modify or cancel or even U Can do trailing stoploss…
If u want the last buyprice and current P/L in ami Chart .. U can Do it with AFL…
U can Create a box which will show the details of trade which generated in amibroker
Thanks Choks
Hi Choks
I am facing multiple orders problem again, The AFL(your codes for placing order) is working fine, but now i have noticed that the AFL is sending multiple orders “when a signal is generated for more than one chart at a time”. For examble i have two charts open and buy signal is generated in both same time, then the afl is sending multiple orders for this two symbols one by one until the signal bar is closed. As its not happening always, i can still manage, but do u think u can find a solution for this too. Thanks Choks
Hi Sh,
That Can be easily managed with AFL…
I’ll post complete set of AFL…with which U won’t face any Order Problem..
And I’ll also include Symbol mapper for managing symbols in Amibroker & Pi..
Thanks Choks, will be waiting for the codes.
Also Sh, let us take the discussion of queries on coding/pi bridge to tradingqna under the category algos. It will be much easier to ask/answer, and for other people who want to refer back to it.
ok Nitin
i have asked the question again in this section.
http://tradingqna.com/12194/afl-to-place-order-for-amibroker-to-pi-bridge-posted-by-choks
Hi Nithin
I have a Suggestion plse consider
we can modify Bracket order price only through Nest terminal it is difficult to Zerodha client who were outside after placing Bracket order can u plse opt other alternative ways to modify Bracket order
throgh Mobile app , (so it is easy to acess any where) and zerodha customer care (right now when any one call u customer care to modify BO they told they have no option to modify)
plse consider both option it will be helpfull to all zerodha customers…
Yep, we are working on this.
Hi Nithin,
Does Pi Bridge support Modify or Cancel function ?
Also is there any way to get the status of the placed order ?
Thanks
Ramesh G
Not right now, but we are working on having it up soon.
Nithin sir , the best thing in zerodha is ,,, guess ?? improving , changing , working ….
even semi-automated is not bad if ? pi bridge communicates both way.
Idea : add a script (tradescript or internally in Pi) which will auto-click stoploss & target buttons. or provide a 3rd party software to click the buy/sell button automatically ofcourse exchange willn’t mind it. no exchange rules broken 🙂 🙂
Haha! Windows UI Automation is very easy. Many tools are available. AutoIT, PyWinAuto, Swapy.. many more..
Can you post how to do the same. Any videos, or screen shots of step by step doing.
Krishna, the bridge is useful only if you understand programming AFL’s. What is the on the post above is more than enough to get started.
Hi Krishna
U can use a UI macro Recorder to do the same…WinAutomation is One of the Best for That..
If U have Knowledge of Visual Basic..U Can Build your Own…
Developed such a tool.. to Use with AmiBroker & Pi….U can download it from the Below Link
https://drive.google.com/open?id=0B-AWKNHhYByLUUhOMk5MdGppQWc
This works on the Principle of UI Automation
Install the Exe as Administrator and Pre Install Close AmiBroker if it is Running..Post Install Read the Help File which contains details on How to Use it
For More Information on UI Automation..Please Refer the Below Links
https://en.wikipedia.org/wiki/Microsoft_UI_Automation
https://msdn.microsoft.com/en-us/library/ms747327(v=vs.110).aspx
Hi CHOKS,
I cant find C:\Tickdata as mentioned in excel. It will be in Amibroker folder or NEST folder ? I am using Zerodha Trader (3.11.2), so can I also use that excel for realtime feed ?
Thanks CHOKS…
CHOKS, please tell where can I find Dllreg file, I searched but in vain…
I followed all other steps and configured, excel refreshes everysecond but LTP or Volume is not showing any values in excel,may be because of C:/Tickdata and Dllreg file I guess…
Suggest how to proceed..Thank you…
Hi Billa,
Sorry for the delayed Post….
just Re download the Zip file from the link…
Follow the steps provided in notes
Before Open the excel file close Nest Trader and Amibroker if it is running
While Opening the Excel File, if u Got security warning that macro is blocked
Just select options and select enable this content
then proceed as per notes..
I programmed all steps except 2 or 3 steps in Excel
I hope it’ll work fine
U no need to create database in amibroker….
Hi CHOKS,
When i click on setup i received access denied error. Pls advice what would be the issue. I am login as administrator also pls advice what is the default directory is excel look for? Any change in windows 64bit ? Thanks again for your help.
Hi Dp
Hav U Enabled macros?
Post the exact Error?
Let me check
Hi Choks,
I think its “Run time Error 70” Permission Denied(Visual basic error). Bcos I am also getting same…
Hi Billa,
I think, some of my macros’s uses FileCopy command…May be that giving the Error..
What OS u r using and architecture ?and MS Office ?
I modified some of the filecopy Command ..
just download the file again….and follow the steps..
If u still got error..Just post the screen Shot…
Hi nithin u miss my prev comment
Hi Nithin
Iam new to Zerodha
I ve have a suggestion
when i open a/c with zerodha they told me that only listed stocks avail in Zerodha website got only margin other stock should take n cash postion after ward i checked zerodha website and saw listed stocks
otherthan listed stock there are more stock which are fundamendally sound so can u add more stocks to get margin (intraday)on my investigation by comparing with other brokers stocks listed in zerodha (margin stocks) not much as compared to other brokers
it will be greatfull to all Zerodha users to add more stocks to margin list
Taron, we keep updating that list. It is just not about being fundamentally strong, but also on how liquid and volatile the contract is.
Dear Nithin, is It possible to put orders from Ami manually, through PiBridge to Pi
Should be possible. Will be nice if someone who is proficient with Amibroker, can give this a shot.
Hi Nithin,
This is the IB trading interface developed for Amibroker. This is separate exe which when installed the Amibroker dropdown will shows the option in the brokerage drop down.
http://www.amibroker.com/at/
The code for this is now open source so you guys should be easily able to do it .
http://www.amibroker.com/devlog/2013/06/03/ibcontroller-1-3-8-source-codes-released/
Thanks bpr, we are looking at it.
Hi Nithin
Iam new to Zerodha
I ve have a suggestion
when i open a/c with zerodha they told me that only listed stocks avail in Zerodha website got only margin other stock should take n cash postion after ward i checked zerodha website and saw listed stocks
otherthan listed stock there are more stock which are fundamendally sound so can u add more stocks to get margin (intraday)on my investigation by comparing with other brokers stocks listed in zerodha (margin stocks) not much as compared to other brokers
it will be greatfull to all Zerodha users to add more stocks to margin list
Hi Nitin,
1) Is there good Real time data provider to Ambibroker for NSE cash segment?
2) With Zerodha Pi, we would never have to subscribe to real time data feed. Right?
3) I am new to automated trading and not planning to trade actively but I want to have i) Backtesting my own strategy as well as ii)Running own startegies in real time(data) with Alerts …Would “Tradescript” sufficient for that in near future develoement of Javascript(6 months)?
4)I am planning to deploy Ambibroker and/or Zerodha Pi on “cloud VM”…What should be min requirements for cloud VM (wrt no of CPU cores, RAM size, Disk Size)
Thanks in Advance Nitin
Sorrry…Not Javascript but Tradescript
Sorrry…Not “Javascript” but “Tradescript”
Also reason for asking question (3) is “Should I buy ~30K worth Ambibroker” OR is Zerodha Pi sufficient with future devlopments in Zerodha Pi
Hi Intime,
In India , No authorized Vendor is Providing Real Time Data for NSE Equity…
Earlier Global data Feeds provided data but Stopped Right Now…
Those who are advertising in Internet, are providing data which is Scrapped from Broker Terminal and also their data Updates 2 o 3 sec after Our Trading Terminal and also they are not authorized.
I have tested almost all Real Time Data available in Net… All are same scrapped Data with 2 or 3 sec delay….spent More Than 3 months for Searching Realtime data vendor for NSE Equity,,,
Even Global Data Feeds Real Time data of NFO is somewhat delayed than our ZTrader Terminal.Currently I subscribed to NFO realtim data in Global Data Feeds…
ESignal which is Leading Data Provider, provide realtime data for NSE Equity,but I have not tested it… They r not providing any Demo….Live Chat with their Representative ,told that NSE Realtime Data cost is $159 per Month Appx 10000 per month…Too Costly….
My opinion is,
Our Ztrader Terminal data is Sufficient or U Can Say more Reliable and Fast and Accurate than the Data Vendors Data….There So many Ways, U can fetch data from Terminal to Amibroker……
Happy Trading
Hi Chocks
How can i get connected Ztrader terminal data to amibroker ? plz tell proced
Hi Rahul,
I’ll post the procedure on how to get data from Ztrader to AMI tomorrow. This is already available in net. But I modified some of the code for better performance and user friendly….
It uses excel as source……
I’ll upload the Excel file, which u can use straightway for feeding data to Ami…..
Hi Choks,
I am also waiting for your code .
Thanks in advance
Siva
thanks CHOCKS
waiting for ur reply…..
Hi Rahul,
U can download the file from here…
https://drive.google.com/uc?export=download&id=0B-AWKNHhYByLdDdKeHFJYmJTU1E
Just go through the notes
Let me know how it works
happy Trading!!
Hi CHOKS,
You are a Rocker bro…
1) Thanks for the Ami coding, I got time to check now only
2) Again thanks, gonna try ur datafeed method
Happy Trading & Living…
Hi CHOKS,
I have checked neither the file nor the google drive exist anymore. Can you please give this file?
Regards,
Sudheer
Hi CHOCKS
I have a personal wish
Can u please post a usefull Tradescript for Day-Traders for backeting in Zerodha PI (little bit advanced by applying ur strategies (usefull indicators incl trend forcast etc) with Buy-Sell signal)
it will usefull to all zerodha users who has lack of knowledge in code writing
if u fullfill wish it will be great full to all of us…
Thanks
Hi fadil,
I’m not familiar with Tradescript….Since my coding is based on AFL….
curently I’m looking into it…I’ll be back witin 1 or 2 days…. with some Tradescript coding that might be useful….
Happy Trading!!!
Thanks for ur reply
we will wait for ur update…
Ok CHOCKS
shall wait for ur tradesript update
thanks 4 ur reply
Hai Chocks.
I am also suporting to above query made by Fadil
with pleasure
1. Guess only GFDL and Neotrade offer data for amibroker in India, both of these don’t offer for NSE cash.
2. No, there is nos subscription fees for real time feeds as you get this on your trading platform.
3. Tradescript is good for beginners to intermediate coders, but as you advance you would probably have to migrate to other languages.
4. If you want to run this on bigger scale, 8 cores, 8 gb ram, 1TB hard disk, and i7 processor.
thanks nitin for reply
So in case I go for Ambibroker, whats best way to feed my ambibroker instance with
i) historical (intradya) data
ii) real time data
I am sure many of zerodha clients would be using Ambibroker, how do they populate their DBs
Best way is to go to an authorized data vendor like Global data feeds or Neotrade. The other way is not compliant to exchange rules, so can’t really advise on that.
Hi Nithin until we fix the all issue with bridge. pls continue the trial. When all issued fixed then you can charge Rs 300 for PI Bridge. My Trial expire 27 jan.
Yes, the trial will continue until next month end.
Hi
Anyone able to use Pi bridge successfully ?.
Pi bridge is working nicely. Thanks Nitin & Choks for the code. Please incorporate pop-up alert and release the new version of bridge soon. Thanks.
Can we triger a bracket order using pi bridge when bracket order is eabled in PI ?
Not for now, but yeah in the future we will give an option for you to fire various kinds of orders using the bridge.
Hi Nitin,
I think that Current Pi Bridge does n’t support Modify or Cancel Order…
Those Two features are very Important…..
Pl try to include it in future release……
Nest Trading Plugin Supports all three features…Place , Modify and Cancel ….
And Also…
Link to Excel i.e. RTD function is very Important to any Trading Platform..So Pl include that too also….
Happy Trading
Yes Choks we are working on that along with being able to send order updates to Ami. So you could then use all the position management strategies available on Ami.
Hi Zerodha,
When I do Mocktrade with AFL, its generating too many signals in PiBridge Log (almost every 2 seconds), but in AFL only 1 signal is generated. Client ID : DB0235
Can you pls suggest a solution..Thanks..
Billa, you have to make changes in your AFL code. My guess is that your AFL code is firing orders every 2 seconds, so it just has to be coded properly on AFL. The Bridge picks up alerts, only when it is fired by AFL, and not on its own. Will try to put up some sample AFL codes next week.
Thanks Nithin.. if sample codes are posted it will be very much helpful, Eagerly waiting !!!
In my case i am also facing same issue. This amibroker bridge bridge firing to many signal.
Like I said, Pi bridge just accepts your signals sent by your AFL. So it is upto the way your AFL is designed. If you are getting continuous buy alerts, put in a condition saying fire the next alert only when a sell comes. We will put up some sample strategies soon.
Hi Billa,
This is bcoz of Ur AFL.The Ami Chart is refreshed every sec,so that it re executes all the lines in ur AFL every Sec . As Long As the lastvalue or EndValue (BUY) or (SHORT) or (COVER) or (SELL) == 1, it’ll fire orders to PI Bridge.For Ex if chart time frame is 1min, & u got Buy signal at 10:55:06, the lastvalue(BUY) ‘ll remain 1 Until 10:55:59 & at 10:56:00 it’ll become zero.So ami ‘ll continuously fire Order from 10:55:06 to 10:55:59.
For that U hav two option;
One is make the RefNO Unique.
Ex;
BuyRef = StrFormat(Name()+”_Buy_” + Cum(Buy));
What’ll happen, as soon as the 1st buy signal fired at 10:55:06,it’ll be reflected in Pi Bridge and other signals ‘ll be rejected by the pi since other fired signals have same BuyRef & Finally U’ll hav only one order shown in Pi Bridge.
Option-II
Using StaticvargetText and StaticvarsetText
This method is very good.Bcoz it’ll fire only one signal & other signals are ignored by amibroker AFL itself.
Just post ur Ami Time Frame & I’ll post relevant code…..
Hopes this might hav solved ur Problem……..
Happy Trading
Hi CHOKS i am using 5 minutes time frame. Pls advice the sample code what we have to use with our AFL. Thanks for your help.
Hi Just, Copy the Below Code and Paste at the end of your AFL i.e. before _SECTION_END();
When U Copy Paste from ZConnect, the Double Quotation mark will Change in AFL, So ReType all Double Quotation Marks after copy Paste.
I Hope This’ll work….Check it …..
Happy Trading
////——————————-\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
ClientId = “DP0012”;//Change As per Your client ID
TrdSymbol = “ICICIBANK15JANFUT”;//Change As per Your Symbol
Symbol = “ICICIBANK”;//Change As per Your Symbol
QYT = Param(“Lot Size?”,1,1,25,1);
Exch =ParamList(“Select Exch?”, “NFO|BFO|NSE|BSE|CDS|MCX” );
PType = ParamList(“Product Type?”, “MIS|NRML|CNC” );
OType = ParamList(“Order Type?”, “L|MKT|SL|SL-M” );
BuyP = LastValue(ValueWhen(Buy,C),1);
ShortP = LastValue(ValueWhen(Short,C),1);
SellP = LastValue(ValueWhen(Sell,C),1);
CoverP = LastValue(ValueWhen(Cover,C),1);
Checkone=Nz(StaticVarGet(“Check”),0);
Checktwo = LastValue(BarIndex(),1);
OrdCond=LastValue(Buy) OR LastValue(Short) OR LastValue(Sell) OR LastValue(Cover);
Brd = Null;
if(OrdCond AND CheckOne != CheckTwo)
{
brd = CreateStaticObject(“pibridge.Bridge”);
if(LastValue(Buy))
{
brd.PlaceOrder (Exch, TrdSymbol ,Symbol,”MyAFL”, 1,Qty,0, BuyP, 0, OType, PType, ClientId,”DAY”);
}
if(LastValue(Sell))
{
brd.PlaceOrder (Exch, TrdSymbol,Symbol,”MyAFL”, 2,Qty,0, SellP, 0, OType,PType, ClientId,”DAY”);
}
if(LastValue(Cover))
{
brd.PlaceOrder (Exch, TrdSymbol,Symbol,”MyAFL”, 1,Qty,0, CoverP, 0, OType, PType, ClientId,”DAY”);
}
if(LastValue(Short))
{
brd.PlaceOrder (Exch, TrdSymbol,Symbol,”MyAFL”, 2,Qty,0, ShortP, 0, OType,PType, ClientId,”DAY”);
}
StaticVarSet(“Check”,CheckTwo );
}
Alert = Buy OR Short OR Cover OR Sell;
AlertIf(Alert,”SOUND C:\\Windows\\Media\\Notify.wav”, “Audio alert”, 0 );
///————————————–\\\\\\\
Thanks CHOKS,
Your codes resolved the issue of multiple orders . Great.
Working thanks for your help CHOKS.
Hi Choks,
It is not working for me. Please help.
When debugging I found the LastValue(BarIndex(),1) is always returning a constant value in my case 186.
IT actually goes through the if condition once and then never as the value of CheckOne = Checktwo always true afterwards.
I am new to Amibroker. I was testing this on Nifty 1 minute chart with neotrade data if that helps.
Hi Bpr,
If i’m correct then ur prob is only the first Buy/Sell signal is fired to Pi and Other signals are not fired
Just copy paste the code below at the end of ur afl i.e.
before _SECTIONEND
Delete and retype all Double Quotation in the formula U just copied
///—————-
Reset = Ref(Buy,-1) OR Ref(Sell,-1) OR Ref(Short,-1) OR Ref(Cover,-1);
if(LastValue(Reset))
{
StaticVarRemove(“check”);
}
///———————————-
Thanks a lot CHOKS.
After putting this I see it that it partially works. Meaning sometimes single order and sometimes multi orders are fired.
After debugging I see the barIndex () gives a same number most of the time but some times changes the number arbitrarily that causes this issues.
So I replaced checkTwo with a constant as anyways the barIndex is not working and the logic above urs is a workaround to that
//CheckTwo = LastValue(BarIndex(),1);
CheckTwo = 50; // a arbitrary constant
Now it is working except for cases where a signal comes back to back.
Because say previous candle has a sell signal and as soon as the current candle start the reset block runs but then when the current candle signal comes it will still go through the reset block thus multiple buy will be fired.
Pi Bridge for Amibroker is good stuff. What are the requirements for fully automated trading in MCX?
Your MCX transaction cost 310 is now high. Other discount brokers reduced their charge to 260.
You already have lowest transaction charge in NSE derivative. We have full faith on you.
I want to ask little tough question to you but it is important.
How much more volume do you need to bring it down?
Best of luck.
I am interested with PI. Want to join Zerodha soon.
Nilanjana, presently we don’t have full automation on MCX. You could use the bridge for semi-automation. The commodity business hasn’t really picked up much, but yes we are looking at ways to reduce any additional overheads.
Nithin sir, what you said ? “The commodity business hasn’t really picked up much”. 🙂
Your transaction cost is still very high in MCX .check your brokerage calculator.
only high volume traders are able to afford & utilize zerodha.
zerodha is cheaper but still not the cheapest.
Rs 10 per trade is not far away.let see who will make new records… maybe a new broker will come or zerodha will do it.
Zerodha…Please activate my Pi Amibroker Bridge..still status is pending..
Can’t search client ID by your email, can you send an email to [email protected]
Sorry ! My mistake… Client ID : DB0235
Thank you…
Hi Nithin,
I have installed Pi plus the Amibroker Bridge including the latest patch still the bridge is RED.
Amibroker complains saying com object is null. Is there any specific to Amibroker version?
Thanks
Ramesh G
Ramesh, have updated the post above, even if it is red, it should be okay. Make sure to run the AFL with the updated code, it should automatically reconnect.
Ramesh, I guess the bridge is not installed correctly. Can u uninstall and install again. You can also send your details to [email protected], we will call back and help you out.
Hi Nithin,
Look like pibridge.net.dll not installed in respective path. Null pointer error is vanished after registered pibridge.net.dll but no green light.
I have installed Amibroker 5.8 & 5.9 version in different path, how can I select during installation ?
Thanks
Ramesh G
Ramesh, can you send an email to [email protected], we will call and have this checked.
Please send us your teamviewer credentials at [email protected], we will resolve it
Thanks Nithin, IT team resolved it.
For an active trader one of the benefit is quick order placement through the bridge. Whenever a order gets updated in the notification window can it come with a beep sound so that the trader is alerted, now its assumed that he would be glued to the screen always.
Other point is when we have mulitple order entries, can we have a colour code if the user has already clicked on it. So that he knows what he has seen and what not . I think current ZT works like this only
Regards,
Harish
Yep, on our list of things to do.
Hi Harish,
If u Use Amibroker, U can do it with AFL
Alert=Buy OR Sell OR Short OR Cover;
AlertIf(Alert,”SOUND C:\\Windows\\Media\\Notify.wav”, “Audio alert”, 0 );
in Built Notify.wav is not that Much audible,
So U can Download any Hig Pitch Wav file from Net and copy to C;/Windows/Media Folder and use it…
Happy Trading
its okay dont eye the sky be on earth&take ur minimum basics in PI first provide pivot,r,r2,s1,s2 mr.kamath these r basics in any software.walk the talk be realistic
Yes sir, we shall. We are trying to ensure whatever is present works fine before adding more.
Sarcastic 😀
New patch installation error.
Can you send this with a good time to reach you to [email protected]
Hi Nithin,
I installed PI and now want to try out this Bridge too. Here is my question. Let’s say I don’t use AFL to fire buy sell… instead I use the Buy/Sell trigger we have built in from Amibroker.. will it work ?? Here is the screen shot for your reference.
http://prntscr.com/5vxcxc
I know PI has this feature of trading from the chart… but Basically.. I want to fire the order from Amibroker instead of doing that from PI. 🙂
Manish, if you have someone who is proficient at AFL, this should be easily possible. Like I said in the post, we are also working on giving you back order updates, so you can even run execution algos that are available on Ami.
How would the brokerage be charged if we’re using our execution logic from AFL? Would we be charged 20 for every order that’s traded or the master order? On other words, how would you identify an order which has been sliced?
Nachiket, we will still charge per executed order within our trading platform. If you have a master order on Ami and using some execution logic, the trading platform will not really be aware of it.
when we run the patch i received the error amibroker not found. i have to done all the patching manually.
We have updated a new installer exe, can you try that. It should automatically detect where Ami is installed.
Nithin, Requested for Pi Ami Bridge activation yesterday, Please activate… Thanks
Hi ,
i am new , i am heaing about auto trade with zerodha , how is work and how much perct. safe
i am not full concrate in trading i , am looking amibroker with zerodha,
i am only take postion in NSE future opition and leave so how is work amibroker and given singnal sell and buy comes in acc. money , need any human interface or not
pls. guide me
tnx
Paresh, this is just semi automated, so you get an alert from your amibroker strategy. You still have to click on buy/sell.
Nor do I see the second green light at the bottom. DO I need to wait for activation?
There is an update to the code, can you check now. Do copy this within your AFL. It is okay even if it showing red light. If you run the AFL, the pi bridge should turn from red to green.
Hi nithin,
Even after doing the aforementioned, I am not able to get the bridge to work. Amibroker complains saying com object is null. Please help.
Udit, can you send an email to [email protected] and [email protected] with your contact. They will call back and check this out.
Its working fine now. It will be a really convenient feature for my wife :). Now if you can just add support for cover orders it will be really great. We can calculate the SL in AFL and pass it on to Pi through the bridge.
Sharing the afl snippet that I am using to help others..
_SECTION_BEGIN(“Pie Bridge”);
enablePiBridge = ParamToggle(“Enable PI Bridge?”,”NO|YES”,1);
Contract = ParamStr(“Contract”,”NIFTY15JANFUT”);
Sym = ParamStr(“Symbol”,”NIFTY”);
nLots = Param(“Lots”,4,1,20,1);
if(enablePiBridge) {
brd=Null;
if(IsNull(brd)) {
brd = CreateStaticObject(“pibridge.Bridge”);
}// AFL Buy/Sell Logic
if(!brd.GetConnectionStatus()) brd.Reconnect();
if(EndValue(Buy) == 1) {
brd.PlaceOrder (“NFO”, Contract,Sym,”PIVOTBREAKLong”, 1,nLots,0, EndValue(C), 0, “LIMIT”, “MIS”, “DU0126″,”DAY”);
}
if(EndValue(Sell) == 1) {
brd.PlaceOrder (“NFO”, Contract,Sym,”PIVOTBREAKLong”, 2,nLots,0, EndValue(C), 0, “LIMIT”, “MIS”, “DU0126″,”DAY”);
}
if(EndValue(Cover) == 1) {
brd.PlaceOrder (“NFO”, Contract,Sym,”PIVOTBREAKLong”, 1,nLots,0, EndValue(C), 0, “LIMIT”, “MIS”, “DU0126″,”DAY”);
}
if(EndValue(Short) == 1) {
brd.PlaceOrder (“NFO”, Contract,Sym,”PIVOTBREAKLong”, 2,nLots,0, EndValue(C), 0, “LIMIT”, “MIS”, “DU0126″,”DAY”);
}
}
_SECTION_END();
Hi Nitin,
I have downloaded and installed the PI bridge patch. I get the installed alert prompt. However, I’m no able to see the bridge file in the Pi folder.
Hi Nitin,
Client ID is RM0029.
1st let me congratulate you for an excellent software “Pi”. I know it will take some time but just a kind reminder except market watch no other fonts could be customized or made to “Best Fit Of All”.
I have installed Pi plus the Amibroker Bridge including the latest patch still the bridge is RED. I have called zerodha they said send a mail 2 [email protected] still waiting for somebody 2 help me out as my trail of amibroker bridge will expire on 27th.
Mohideen, the latest release of bridge is available on Q. Do install it. A small change in the code, I have already updated the blogpost above as well. So even if you see red light on Pi, fire the order with a new code, it should work.
I installed the latest PI bridge. When i tried to login it just hung. Then uninstalled PI reinstalled it. I use Windows 8.1 and this time it asked to install the dependables and never has asked this for my previous 2 installation of PI . Now its been more than 1.5 hrs and its still hanging and this time have not even installed PI Bridge.
Never faced this issue before. Please look into this soon
Regards,
Harish
Getting Saket to call you back.
Thanks Nitin.. I got the help for setting up the bridge.
As far as PI hanging during login …. This is my observation/scenario ……..
1. Login using credentials
2. Input the answers to secret questions
3. Again the login screen is shown … During first login this would be present for sometime. Actually what I used to do this time was that again I clicked on “Login” button in this screen and PI used to just hang.
If i dont click on login button again after input of secret answers … Everything works fine.
Note- This issue is only during first login
When I try to install nothing happens and I went to the directory and there also nothing was added.
Also my PI bridge request is still pending.
We have just updated the bridge installer and small change in the code. Do give it a shot.
Sorry Nithin I didnt see your reply before posting this. Ignore 🙂
Hi Nithin..
When our tradescript backtest completes, all the indicators we used in code are coming in result page ( with chart above and all the indicators used in code below in minimized forms ).
If possible, before showing up backtest results , a dialog box with options to show/hide indicators based on our need will be great for users, who just need Buy/Sell signal for clear view ( or based on their choice of view ) and indicators wont get cramped at end of page.
For example even if we try simple crossover code, it generates atleast 4 indicators below. Please take this as my suggestion…
Yes Bill, next release should have this fix.
Hi Nitin,
I am getting the following error when installing PI Bridge :
“Could not find Amibroker installed”
My Amibroker is installed in the following directory
C:\Program Files (x86)\AmiBroker
Please provide a resolution quickly. I have also raised a support ticket for the same
http://support.zerodha.com/tickets.php?id=944472
Yes Udit there was some issue with that. We will have a new bridge installer up on Q by tomorrow.
with 4-5 days of using live charts…quite few problems… don;t have confidence in watching the charts to manage the trade. as they frequently stop drawing and lack of refresh button makes it difficult, need to close the chart and reopen…today’s example attached… instead of current candle the candle the old candle started changing with illusion that price is still within the limit drawn…after re adding the chart that candle showd long wick which was not there before and now the wick is gone and the actual candle is showing gap down as it should.
this is gbp/inr 15 mins chart.
Your number not reachable. Can u email ur number and a good time to reach u to [email protected] and [email protected]. do copy a snapshot of the issue that you have posted here when sending the email.
Pi bridge is not working for me. I am getting the error that the server cannot be started and the attached error as well. Please check.
One port is blocked ,try restarting the PC ,this should resolve this issue.
Nitin, Thank you for ur response. I have restarted it now but still its giving the same error. i tried it on my laptop, its giving the same error. Please check.
Hi,
Please check if any application is using port 8000.
In cmd type following:
netstat -an|find “8000”
If yes,please stop that application,let us know if it helped.
port 8000 is not used by any software. please find the attached screen shot.
pls. delete all history from web browser…n restart pc…n connect…. wish u happy trading…..
Trying to reach your registered number, it is off. Can you email back a number to [email protected] and [email protected]
I am overseas, email me ur contact number and persons name, i will call back.
8040402075 and Saket
Thank you Nitin & Saket, Its working fine. Great support.
PI bridge for AMI is use less if bridge work like this. Its keep sending buy/sell order every second you can pick buy or sell to place the order. PI Bride should send order to PI for buy and sell when any signal appear in Ami. other wise if some one has to monitor 5 or 6 chart. He will gone mad to see the 5 to 6 signal in one second in PI and failed to select correct signal.
getting someone to call you back and have this fixed.
Seems to be working fine at our end, can you check your strategy. If your strategy on AFL gives you 6 signals a second, those six alerts will be triggered here. You will need to make those changes in your AFL
I have tested some other service provider auto trade software it’s working fine with my AFL. Only place the order when signal appear on the chart. But when i live the PI its shooting buy or sell every second. I have added below to my AFL.
_SECTION_BEGIN(“PI-AUTO”);
//COM Calling function:
brd=Null;
if(IsNull(brd)) {
brd = CreateStaticObject(“pibridge.Bridge”);
}// AFL Buy/Sell Logic
brd.PlaceOrder (“NFO”, “ICICIBANKJAN15FUT”,”ICICIBANK”,”AMI-B”, 1,3,1, 0, 0, “M”, “MIS”, “DZ1105″,”DAY”);
brd.PlaceOrder (“NFO”, “ICICIBANKJAN15FUT”,”ICICIBANK”,”AMI-S”, 2,3,1, 0, 0, “M”, “MIS”, “DZ1105″,”DAY”);
_SECTION_END();
Is it possible to select Date Range for Back testing of Tradescript strategy in Pi ?
If not, Please do include that option, will be very helpful when we test strategies on Futures contract ( so that we can test strategy on each month contract in specific range )
Thanks Nithin….
Date range not possible currently, you can only choose the candle duration to backtest on. But adding your request to our list of things to do.
Hi Nithin,
Am trying to write simple strategy in Tradescript, its giving signals properly, but to finetune it furthermore like adding stoploss n some tweaks, I need to make small modifications in code but dont know how to code that ( read manual completely )…So where can I find sample codes for stoploss,target ? Zerodha tech team will help ?
Thanks….
Dear Nitin,
For long have been using Zerodha trader terminal with RTD activated for live data into excel and thereby into Amibroker. Will this feature remain intact in Pi too or have to pay now on for RTD ???
Alex, there is no live data to excel on Pi as of now. So you will have to continue using ZT for now I guess. The bridge will let you fire orders from AFL to Pi.
When will the Pi to Ami bridge be activated ?.
We had some last minute fixes to be done, will be available tomorrow morning.
also nitin, on downloading pi 1.0.0.5 from the link it is still installing pi 1.0.0.0 only, please update the download file.
Pravin, like I have mentioned in the post above, ignore what you see on top of the screen. Look at the about link under help.
Dear Nitin,
how can we change the code below to send orders automatically for different scripts, e.g if i want to send orders for Reliance and CESC futures, i want to create one strategy AFL and depending on the script it should pick up the script name from amibroker automatically, instead of having to hardcode the script name in the code below as well as the order quantity and limit price as applicable for that script.
brd.PlaceOrder (“NFO”, “NIFTY14DECFUT”,”NIFTY”,”STRATEGYNAME”, 1,50,50, 780000, 0, “L”, “NRML”, “DZ1105″,”DAY”);
Hi Pravin
It’s very simple
It all depends on from where u r getting data feeds and format of the symbol name in Ami Database.
I’ll explain for equity.
My database contains symbols of all Nifty stocks i.e CIPLA, TATMOTORS, BPCL etc
I just included the following in my AFL
Symbol = StrFormat(Name()+”-EQ”);//
What happens, if signal is generated for CIPLA,the AFL automatically create symbol as CIPLA-EQ
Normal AFL Symbol Specific;;;;
brd.PlaceOrder (“NSE”, “CIPLA-EQ”,”NIFTY”,”STRATEGYNAME”, 1,50,50, 780000, 0, “L”, “NRML”,
“DZ1105″,”DAY”);
So in place of “CIPLA-EQ” use Symbol
For All Symbols in DataBase
brd.PlaceOrder (“NSE”, Symbol ,”NIFTY”,”STRATEGYNAME”, 1,50,50, 780000, 0, “L”, “NRML”,
“DZ1105″,”DAY”);
So any signal generated on any symbol on any chart, ‘ll have that particular Trade symbol in the brd.PlaceOrder and orders ‘ll be fired to Pi.
For Qty
I’ll Explain wat I’m doing
I always want to invest 50000 per symbol ie my investment is fixed for all symbols at 50000;
So for Ex :
CIPLA ‘s mkt price is 659
Qty = ceil(50000/lastvalue(c,1)); i.e 75 Qty for CIPLA
Buyprice = Valuewhen(Buy,C);
For Each Symbol Qty ‘ll differ buy trade Value Remains same.
Just add Qty to brd.PlaceOrder as follows
brd.PlaceOrder (“NSE”, Symbol ,”NIFTY”,”STRATEGYNAME”, 1,Qty,0, Lastvalue(Buyprice,1), 0, “L”, “NRML”,
“DZ1105″,”DAY”);
For Futures, If u post ur Symbol format, if possible all Symbols and ur Investment, I’ll post AFL Code
Happy Trading
Thanks Nitin for explaining how to select symbol, however for Futures Quantity is fixed lot size and differs by symbol, so the calculation of dividing by the amount per contract will not work it will have to pick up the lot size as per the symbol e.g Cipla is 250 lot size and Reliance might be 500, we cannot fix this in the afl to any one size, or can pi bridge understand if we say 1 lot and pi will adjust the order as per lot size, please suggest.
regards
pravin
Sorry thanks choks
Hi Pravin,
I posted some code here …Pl check it….
Where Ur getting data for AmiBroker?
How many Lots Do you Trade per Symbol?
Ur Symbol format in DataBase? Ex ICICIBANK or ICICIBANK-EQ or ICICIBANK-I or ICICIBANK15JANFUT
How many Symbols U want To Trade? Ex 20 or 30 etc
Ur AFL based on Which Time Frame?
Last important Question,,,
Till What Date U Trade current month Contract?
Ex if Current month Contract Expires on 29 Jan 15 ,,,,Till Wat date u Trade This Contract?
Post Ur Replies I will code it….
If u post ur Snapshot of amibroker with symbols Tab visible in the Left…It ‘ll Better for me to Code…..
In Pi Bridge, no need to mention Lot Size i.e. 1250 or 2000 etc…
Just Qty of Lot ‘ll work Ex 1 or 2 etc….
HI Chocks
any way to convert Amibroker afl to trade script code for bcktesting in Zerodha PI
Hi Fadil,
No Software or apps is available for converting afl to TradeScript….
Even if someone has such apps, it ‘ll not convert it fully…
Bcoz , AFL is more advanced Coding than Tradescript…..All AFL functions Cann’t be converted into tradescript…….
tradescript is basic coding language to get idea about Algo or Auto trading……..
As mentioned by Nitin…. Once You got Basic Idea on charting, Coding and Algos, U hav to move to Professional Charting softwares like Amibroker…..
Moreover
Why U want to convert ur AFL to TradeScript?
U Can Backtest it in the Ami itself, which has More option to backtest……If U hav any Specific Reason pl Post it
Happy Trading
hi choks,
i’m using GDFL, the amibroker symbol is in format “cipla-I” for current month contract, whereas in ZT it is CIPLA29JANFUT , we will need to convert the symbol name to Zt format.
thanks for all the help once more.
Hi Pravin,
If u r subscribed for GDFL dataplan,then U might hav GDFL trading Plugin enabled which has function called symbol Mapper..U might hav known…It’s a csv file placed in C:\program files\Amibroker\Formulas\GDFL-NEST\GFDL_NEST_Symbol_Mapper.csv.Just open it , in col A enter the symbol in Amibroker i.e CIPLA-I and in col B enter the respective trd symbol i.e CIPLA29JANFUT…Likewise u add all symbols in database leave the first row or header and save it in the same file format i.e.csv
then
Just Copy the Below Code and Paste at the end of your AFL i.e. before
_SECTION_END();
When U Copy Paste from ZConnect, the Double Quotation mark will Change in AFL, So ReType all Double Quotation Marks after copy Paste. and Change the Client ID parameters with Urs…
That’s all U hav to do..Whenever the buy/sell signal generated on chart, it’ll automatically compare the symbol on chart in csv file and respective trade symbol ‘ll be added to the brd.Placeorder Just in the parametr window set ur Order Type , lot size etc…it’ll work for all symbol in database…
///——————————————–\\\\\
ClientId = “DP0012″;//Change As per Your client ID
Symbol = StrFormat(Name()+”-EQ”);
QYT = Param(“Lot Size?”,1,1,25,1);
Exch =ParamList(“Select Exch?”, “NFO|BFO|NSE|BSE|CDS|MCX” );
PType = ParamList(“Product Type?”, “MIS|NRML|CNC” );
OType = ParamList(“Order Type?”, “L|MKT|SL|SL-M” );
OT_SNM = “Use Symbol Mapper Dictionary”;
OT_SN =”NOTHING”;
GFDL_OT_SM(OT_SNM,OT_SN);
BuyP = LastValue(ValueWhen(Buy,C),1);
ShortP = LastValue(ValueWhen(Short,C),1);
SellP = LastValue(ValueWhen(Sell,C),1);
CoverP = LastValue(ValueWhen(Cover,C),1);
Checkone=Nz(StaticVarGet(“Check”),0);
Checktwo = LastValue(BarIndex(),1);
OrdCond=LastValue(Buy) OR LastValue(Short) OR LastValue(Sell) OR LastValue(Cover);
Brd = Null;
if(OrdCond AND CheckOne != CheckTwo)
{
brd = CreateStaticObject(“pibridge.Bridge”);
if(LastValue(Buy))
{
brd.PlaceOrder (Exch, OT_FSN ,Symbol,”MyAFL”, 1,Qty,0, BuyP, 0, OType, PType, ClientId,”DAY”);
}
if(LastValue(Sell))
{
brd.PlaceOrder (Exch, OT_FSN,Symbol,”MyAFL”, 2,Qty,0, SellP, 0, OType,PType, ClientId,”DAY”);
}
if(LastValue(Cover))
{
brd.PlaceOrder (Exch, OT_FSN,Symbol,”MyAFL”, 1,Qty,0, CoverP, 0, OType, PType, ClientId,”DAY”);
}
if(LastValue(Short))
{
brd.PlaceOrder (Exch, OT_FSN,Symbol,”MyAFL”, 2,Qty,0, ShortP, 0, OType,PType, ClientId,”DAY”);
}
StaticVarSet(“Check”,CheckTwo );
}
Reset = Ref(Buy,-1) OR Ref(Sell,-1) OR Ref(Short,-1) OR Ref(Cover,-1);
if(LastValue(Reset))
{
StaticVarRemove(“check”);
}
Alert = Buy OR Short OR Cover OR Sell;
AlertIf(Alert,”SOUND C:\\Windows\\Media\\Notify.wav”, “Audio alert”, 0 );
thanks Choks, will try it out and let you know
After going through one of the video presentation in youtube taking about the P1 Bridge, for me it looks like it can read the Amibroker chart and punch the orders, was it completely automated? means do i need to click on submit on the order or it just takes it?
Hi nithin
is bracket order avail on PI ? also
when wil be the final launch of PI ?
No Rahul, BO not as of now. Final release should be in the next 3 to 4 weeks.
sir
in ur knowledge any method to covert AFL file to a trade script format ?
You will have to rewrite the code Fadil. So you will need to learn the syntax for tradescript.
Where can I learn tradescript ??
Under Pi> Help, you can see a Tradescript help. Takes u to the user manual. Also check out all the queries answered on tradescript on Zconnect and Tradingqna.
In Pie the tradescript help has information only about the codes of tradescript, but I want to make a strategy program for semi automated trading, where can I learn that ??
Check this on algoZ that we had on ZT before, works very similar.
sir can i use amibroker AFL in PI for back test ?
No Fadil, on Pi you can use tradescript to backtest. You can backtest AFL only within Amibroker and not on Pi.
Hi Nithin sir, how to get the offer from neotrade analytics for data feed?.
Connect with them (you can reach out to [email protected]), and give your Zerodha client ID.
Hi nithin
I have a personal wish can u recommend few AFL {I’ve seen AFL library upload above} which would be the best as well as accurate for day tradere
Dont forget to recommend
Thanks in advance
Rahul, don’t think there is anything like the best or most accurate in this business. I guess you have to backtest and adapt, the list of codes is just to help you get started. Even if I suggest you something, it may or may not work, don’t want to be responsible for that. One of the reasons we as a business have stayed away from suggesting what to buy/sell.
Hi nithin
can u add few demo video detailed PI bridge ?
Aju, there is a video that shows how to enable the bridge and use it. If you are asking for different AFL’s, you will have to give it a shot yourself.
sir
is PI bridge for amibroker mean give PI datafeed to amibroker ?
sir can i use amibroker AFL in PI for back test ?
plse reply
Fadil, the bridge is for you to fire orders from AFL to Pi. No, you can’t use Pi to give datafeed. You can backtest using AFL on Amibroker itself.
Any one have AFL for pair trading/arbitrage trading? Please one when i get..I plan to do with Pi Bridge
Thanks for this much awaited feature. Is there any Api to place cover orders? Something like brd.placeCoverOrder that will accept stop loss as an additional argument? If not currently available, can I expect to see it in the near future?
Not for now, but yeah, interesting suggestion, let me bounce it off our tech team.
Can we place cover order from amibroker ??
Raj, not possible currently.
That last link just made my day. My hard disc crashed yesterday. Re-installed everything today but all the AFLs were lost. Thanks!
pExchange – Does this support “NSE” also ( I mean equity) ? I can see only NFO option in the doc above
Yes, NSE and BSE also, updated the post.
Halo Nithin Witch is Working Best Charting Platform ( Amibroker / Ninjatrader / Metatarader ) For PI Bridge ? Thank You
Rajesh, for now we only the Bridge for Ami live. I guess Ami is better as you have so many users to help you out with AFL’s.
I prefer Ninjatrader. It is free, supports free NSE feeds from yahoo finance, allows adding extra indicators(even add custom code), backtest, and also run Monte Carlo simulation. I request Zerodha to come up with Pi bridge for Ninjatrader platform. I will be happy to pay for Pi bridge for Ninjatrader.
Yes Abhijit, we should have it soon.
Nithin,
Its been more than 2 years now and all users including myself are waiting until now for the NinjaTrader Pi Bridge.
Please can you update us all on the progress and by when can we expected it to be released to all.
Regards,
Parag
Can you share ur method of getting free feeds to NT from yahoo. R u talking abt intraday data or eod feed?
Regards
Aniruddha
Hi Nithin,
one more great news, hope to see the MT4 bridge soon :), any timeframes Nithin ?
Hi Nithin,
Could you please provide more details on Pi bridge for MT4 any timeline please?
1. sometimes the buy sell signals are generated as the candle is still forming. So do they generate alerts? How to handle this?
2. What do i do if i want to trade only at high/low of the signal candles?
3. Can u shed some light on multiple strategies? How to go about it? Open multiple charts in tile mode?