EA’s for auto buy/sell signals – Pi

May 11, 2015
Expert advisors


EA’s or Expert Advisors as they are popularly known especially in the meta trader community are programs that allow automation of analytic processes. What this means is that you can convert your trading strategy into a code/program, backtest it to see if it had earned money in the past, and take profitable strategies live as expert advisors. You can have multiple expert advisors running at the same time, and the EA will do the job of spotting and alerting you with any buy or sell signal that is generated.

With Pi, we have introduced the concept of expert advisors for the first time on an Indian trading platform. The next time you trade or take someone else’s advise, make sure to first backtest them, it is one of the first steps to take towards trading success.

The programming language used on Pi is called TradeScript, 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. TradeScript is good for traders who don’t know programming, and for those who are looking at it as a stepping stone to get started with backtesting or having programs (EA’s) spot trading opportunities. But for professional traders out there who are adept at coding and run complex trading strategies, TradeScript will not fit the bill. For the professional programmers we have Pi bridge through which you can fire in orders from almost any source.


Initiating backtest window

The backtest option is available under the alerts menu on Pi. You can select the contract/scrip to backtest as shown in the image below.


Selecting a contract for backtesting

Coding and Backtesting


Coding & Backtesting

  1. Your buy code in TradeScript. The example above is for an exponential moving average strategy, so Close>EMA (close,50) which means buy when closing is above 50 candle exponential moving average.
  2. Similarly click on Sell and mention the code Close<EMA (close,50).
  3. Define the periodicity of the candle and how long you want to backtest it for using Bar history. In the example above it is a 50-minute EMA, so periodicity is Minute and Bar interval is 1. I am backtesting for the last 30,000 candles and hence mention the same in Bar history.
  4. Select if you also want to see a backtest chart with all the signals plotted. If you are backtesting more than 20,000 candles it is best to not plot the chart, depending on how powerful your system is, it can crash. Since I am backtesting 30,000 candles in my example, I have kept this unticked. (See the below image on how a backtest chart would look.)
  5. Click on Back Test. All the processing is happening at your machine, so the more powerful your machine is, the faster you will see the backtest results.
  6. All the results with individual trades will be mentioned in this box. In the example above, there have been 1920 trades with 1554 losing and 366 winning in the last 30,000 minutes. Even though there are more losing trades, the strategy is still net profitable (without considering costs) as it has made 8782.5 points in the last 1900 trades.

If you are backtesting smaller number of candles, you can also initiate the chart. Usually the indicators on a backtest chart are plotted separately, this can be dragged and dropped to the main candle panel as show below.


Backtest Chart. left click on the blue EMA line, drag the white square box to the main candle panel.


Backtest chart, same strategy with 3000 candles.

Expert Advisors or EA’s

Now that you are satisfied with the backtest results, you can create your EA.

Creating EA


Creating Expert Advisor

  1. Click on “Create new Expert Advisor” under the main menu Artificial Intelligence.
  2. Give your EA a name, and if you want give it a description and/or message like I have done in the image above for the EA that I have named EMA Cross.
  3. Copy paste the same code from your backtest window for buy/sell respectively.
  4. Click on Save, this will create your EA – EMA Cross.

Taking the EA live


Taking EA live

  1. Open the chart of whichever scrip you want to apply the EA to. I have opened a Nifty future 1-minute chart (the same contract that I had backtested).
  2. Clicking on Apply Expert Advisor under the Artificial Intelligence menu opens up the Expert Advisor box. From the entire list, tick on the EA that you want to take live. We have given a bunch of public EA’s to help you get started. If you want to take only the EMA Cross live, tick on the box next to it.
  3. You will be able to see the description that we had entered earlier. You can also see that you are the owner of this EA, and it is not a public EA.
  4. Click on Apply to take the EA live. You will now start getting buy/sell signals based on this EA.
  5. To disable EA’s, untick and apply.
  6. You should also see this EA icon as shown below once you apply. You can also have multiple EA’s run on single/multiple charts at the same time which is humanly not possible as shown below. I have taken 6 EA’s live on Nifty at the same time.

After taking EA live – the EA icon

Generated Alerts by the EA


Generated alerts

  1. Click on Generated Alerts under the Alerts menu to initiate the window as shown above.
  2. All the EA’s, whenever generating a buy/sell signal, they get logged on this window with their names clearly mentioned.
  3. If you wish to execute an order based on this signal, click on the Buy/Sell box.
  4. You can change the quantity/price on the buy/sell order form.
  5. You can enable/disable sound alerts for Expert Advisors as shown below.
  6. Generated alerts can only be executed manually by clicking on Buy/Sell on the Generated Alerts page.

Enable/Disable Sound alerts

TradeScript Help

You can find the TradeScript user manual under the Help menu on Pi. We have also given over 30 public EA’s to help you get started on Pi. If you have any queries on coding a new EA, you can visit this section on Tradingqna. We also have built our Expert Advisor page, where we will soon have over 100 public EA’s with code.

Consensus – multiple EA’s

Another really cool feature with EA’s is the Consensus Report. You can use multiple EA’s and get a consensus report using all of them on how bullish or bearish a particular scrip currently is. Click on Run Consensus Report, select either single or multiple EA’s, and click on apply to see a consensus report like the one shown below.


Consensus report using EA’s

Video tutorial


Happy Trading,

Nithin Kamath

Founder & CEO @ Zerodha, team working towards breaking all barriers that I personally faced as a retail trader for over a decade. Love playing poker, basketball, and guitar. Getting body fat % in single digit is the next personal endeavor :) .


  1. manju says:

    Wud be great if you list all the Amibroker snippet equivalents for TradeScript. For example, the previous candle is defined as Ref( L , -1) whereas here its slightly different i think.

  2. stock hunter says:

    Hi Nithin, I checked Edit expert advisor option but there is no “Apply”menu..Please check the screen shot for your reference

  3. vivek says:

    Awesome work zerodha for the 100 EAs list (https://zerodha.com/expert-advisors)…..am just lost for words

    “We have also given over 30 public EAs to help you get started on Pi.”
    where are those EAs?

  4. Sushovan says:

    Why not put a option to convert this page as a printable format ? That way I can take a printout instead of opening the page everytime I need to refer.

  5. ST says:

    New version is crashing too much. If i open more than one chart it crashes,from morning till now it happened 6 times.

  6. santana pereira says:

    hI nithin,
    I have three queries
    1) In Sharekhan or Geojit when any new updates are available, we have to click in their platform
    software itself. And your software is updated to latest.
    I phone to your support team to update my Pi latest v1.0.0.6, he says I have to write to
    your it@zerodha.com, Which delays the matter ?
    2) Also another doubt is the code language used in Zerodha platform and Pi platform is same ?
    Since your Pi is your latest, can I see the link or all codes done in Pi platform. Then only I can decide to go for BRIDGE connect to AMIBROKER.
    3) the alerts generated in Pi platform cannot be transfered to SMS or email, to avoid near the computer whole day.?
    Yours sincerely,

    • 1. The latest release of Pi has the option “Check for updates” in the help menu.
      2. You can see quite a few sample tradescript codes here. But this is different from AFL used on amibroker, so a little confused on what you are asking.
      3. Not possible for now.

  7. krunesh says:

    When I click to open chart, it stops working. it is happening again and again.

  8. dvr says:

    Hi nitin,
    I want to do this backtest using spot prices, but data source is available for future prices. Is there any way to backtest our code with spot prices?

    • Yes dvr, while backtesting instead of choosing Futures, choose spot. Currently there is historical data for the top 200 stocks, and Nifty/Banknifty spot indices.

      • dvr says:

        Thanks nitin, I think i can’t see the spot option as my account is only enabled by FnO trading only.

        • ah right, so you have to either open a new demat, or send us a client master proof from any other demat that you hold. This can be mapped, after which you will start seeing spot prices as well.

  9. Arun Kamath says:

    Hope you add ichimoku EA as well

  10. R.K says:

    Hi Nithin,

    I recently opened a a/c with Zerodha, whats the historical data available in Pi, as i could see candle only from 1-Jan-2015 in Bank nifty , and if that is the limit right now, when can we get complete data. thank you

    • R.K, if you are opening futures historical data, you will be able to see it only from when the contract came into existence. So May futures, you can see only from Feb end. If you open spot/index charts, you can see intraday from last 7 to 8 months, historical upto 5 years for top 200 stocks, Nifty and Banknifty.

  11. Saket says:

    Couple of quick questions:

    (1)Can I automate the trade execution part as well? Meaning if certain conditions are met automatically execute buy/sell of a script(without any manual intervention).

    (2)If above setting is possible, please confirm that once done above setting can be switched ‘on’ until I manually deactivate same.

    I need to take the human emotions completely out of trading.


    • The facility is there on the platform to automate trade execution, but we can’t offer as the exchanges in India don’t allow retail automation of trading strategies.

      • Prateek Jhunjhunwala says:

        So an individual trader in India cannot do automated trading, even if he puts more than Rs 2 lacs in his trading account? Any other options which he could explore?

  12. vivek says:

    in the image above(http://zerodha.com/z-connect/wp-content/uploads/2015/05/back2.jpg) a backtest is being done using the 50 ema crossover. somehow i feel it cannot be so profitable as is being suggested by the backtest report(i know its not inclusive of costs. but even if costs are factored in, its still a very good outcome 8782 pts profit may reduce to maybe around 3000 pts).
    my question is: can i fully rely on the backtest report, when even such a simple strategy appears to be easily profitable?

    • Vivek, you can plot the backtest with the chart to see the buy/sell signals on the chart. You can also look at the trades that show up in the backtest report.

      • nipun says:

        I think back test report is not reliable if it computes profit using ltp.
        I have some questions about backtest report ,
        In backtest which price considered ,Is it LTP or Buy/Sell ?
        If Buy trade then it always gives seller price as displayed on live .

  13. Rahul Shah says:

    I have apply EA of 14-26 EMA crossover but I am not able to see any alert in generated alert box why is so?
    and whenever I do anything in artificial intelligence section PI got stuck.

  14. Samir says:

    Hi Nithin,
    I have 3 Questions.
    1. Why you don’t have Channel breakout indicator in Pi, it does not have to do any calculation at all.
    2. Do you have indicator for Swing trading in Pi,
    3. The Pi upgrade link is not working, every time I enter my user id and password its rejecting, also it blocks after 3 attempts.

  15. harpreet singh says:

    is there an ea for floor pivots?? if not i request you to add this simple tool to pi …

  16. khuranavikram says:

    i got sms regarding new version of Pi dated 11.5.15 but not able to find the link. Please help.


  17. Piyush says:

    I want to know the code for ADX and MACD to back test please can anyone help me.

    Thank you

  18. sohail says:

    Hello Sir,
    I am sending u these stregies. can these be coded by ur team.
    1. When 12 ema crosses above/ below 26 ema with increae in volume.
    2. When scrip breaks previous day high or previous day low with increase in volume
    3. When scrip is +5% or -5% with increase in volume.
    Does ur software indicates intraday new highs and lows made by the srips.
    Is ur brokerage is same for low volume traders or ocassional traders

  19. charan says:


    My charts are not loading in PI it says unable to “connect to the data server should be soon” . I am not able trade because of this. whom should i contact for this???


    • Charan, we had sent an email/SMS asking to update Pi with the latest patch available on Q. Go to q.zerodha.com, download the latest patch that you see under Pi menu. Run this patch, it should start working.

  20. Kiran says:

    Hello Nithin,
    I opened my account at zerodha on nov last year. Since then I have been quite satisfied with the service. But off late I am having some tough experiences from the support team. I really feel I should bring it to your notice, so posting it here. If you could get back to me, I can clarify.

  21. Paras says:

    Hello Nithin,

    I am facing lot of problems while trading through current zerodha web portal, i am eagerly waiting for using KITE. So can you please let me know when we are planning to launch KITE.


  22. Honest krishna says:

    Can you generate best trade signals out of using many of these proven strategies and send to the terminal of clients as buy or sell orders with defined risk ratios. You can provide a option to pre select risk (quantity) of different levels and upon selecting the same, quantity should auto appear in the order. It should generate by default bracket order. It should be for top 200 cash liquid stocks, liquid futures,highly traded options, Nifty and nifty options also.
    We believe any recommendation with certain degree of faith, and we have full faith in you systems. This will provide lot of comfort for the clients. You should build expert team to get best trades using all these. For clients who are not pro in technical this will be like heaven. And also no need for clients to invest in costly hardware.

  23. akhil says:

    please dont get into investment advisory services market is flooded with those , the only reason i and a lot of other people came here was because of your low cost if you expand into those areas i beleive you wont be able to sustain your low cost
    please a lot of indians only require the basics email statements optional mobile alerts i believe nse does that free of cost for trade confimations //and no hidden charges especially no hidden charges if you charge only what you advertise people will be loyal to you other wise if they see there money drained without prior notification they will instantly switch over

    • Yep, we haven’t done advisory for last 5 years, and don’t intend to get into doing that in the future as well.

      • Pritam says:

        Yes i agree , just concentrate on the scaling to large number of retail clients , no need for stock research etc , only need to get better in improving the technology part like adding more features to mobile app etc .

  24. ashokn4ever says:

    Dear Nithin,
    Do you have any Mutual Fund Assistance with Zerodha?

  25. Gopi says:

    pi will fire the orders, then what is the use of amibroker?

    • The programming language on Pi called tradescript is not as advanced as AFL (amibroker formula language). So if it is any complex strategy, you will need to use AFL.

  26. Gopi says:

    Hai Nithin Sir,

    1) can we code in trade script about know the status of the order placed, and on order completion only place another order(placing orders with condition).?

    2) is their any database connection or file support in pi, to record order number, order status, and values if any for that order.?

    3) how amibroker know the order is completed or in pending.?

    4) is the trail version of amibroker software sufficient to do intraday.?

    5) is pi itself sufficient to fully automate the trading terminal of dealer.?

    6) is their enquiry about order status available in pi(TS) or need support of ami(AFL).?

    7) for pi based semi automation do i need to subscribe datafeeds.?

    8) pi is not installing on my system. my OS date expired, is it the reason?

    9) do you offering any API for pi based automation?

    10) is Trade Script will allow to code for BO, AMO, and Basket Orders?

    Please Answer my Queries here. Dont reply with contatc tsiva or any other?

    • Gopi, I can answer only those which are general queries, anything specific to your account you will still have to send an email to tsiva@zerodha.com 🙂
      1. No, you can’t fetch order status using Tradescript.
      2. Currently no, but we will soon have it for people using Pi bridge.
      3. As of now not possible, people who fire orders using Ami and Pi bridge are doing it as market orders.
      4. Yes
      5. Yes, but we are still not letting this happen.
      6. Using AFL you should be able to fetch order details using Pi bridge soon.
      7. Semi automation on Pi using tradescript – you don’t need datafeeds as it is already available on Pi. If you are semi-atuomating through AFL, you will need data feeds to run Amibroker.
      8. Possible, you need to send an email to tsiva@zerodha.com
      9. The bridge itself can be used for automation.
      10. No

  27. Jay says:


    I humbly request you that first you give a proper training your team (Those who are giving a demo on Pi). I am new customer of zerodha and I installed Pi. I thought clear some of my questions by arranging a demo. Unfortunately the person who gave a demo does not have a sufficient knowledge on Pi. I was really disappointed. Please setup a separate team only for demo. or else you create a video and publish in youtube. I know most my question were answered in z-connect blog page comments section. But I should go all the comments to find an answer. It is very time consuming. so please consolidate all the questions which is posted here and create a youtube video with answers.


    • Yes Jay, we are putting up videos and we will train the team on this as well.

      • Pyush says:

        Yes Nitin please, Because even i faced the same problem but slowly learning from Z-connect, most of the time even support team cant help on those……..

        I know the effort you are putting and making it investor friendly so the the profit can be earned for both but when these new things comes in market for first time, you just cant leave the investors and traders just like that, this is a great opportunity for you as today in india more new and new young investors and traders are coming make the use of it.

        Hope you will work on it and hope you are really doing good.

        Thank you
        Take care
        Keep smiling

  28. How to download Pi? Where to click for download?

  29. Vivek says:

    Hi Nitin,

    I am long term investor, though i would like try this automation thing.
    Why this restriction of active trader to get PI?


    • Vivek, huge amount of resources required to run Pi.So every instance of person using Pi, we will be spending more on the resources. Even if you are not trading, and have atleast 10k in your account, it is considered active.

      • Vivek says:

        So i see this as if i am going to make profit i will become active automatically, else will not use and will free up resources. I do not want my money to sit ideal like minimum balance of bank a/c :), though i have reasonable holding of equity in demat.

        Should not holding be criteria too for PI?

  30. Bharath says:

    I am using MT4 based strategy can i link MT4 to PI or NEST Trader (ZT)? If yes please let me know more information.

  31. biju says:

    waiting for fully automated trading

  32. dd0847 says:

    hi nitin,
    1st time saw a glimpse of pi; though seemed flashy and easy to use, I was unable to access several very basic components;
    1. is DEMA(double EMA), TEMA(triple EMA) provided in the backend? If no, is it possible for me to edit the library and compile it with my own extended set of formulas?
    2. When I ‘Apply exper advisor’ with ‘MACD histogram’ as the choice, no buy/sell indicators of any kind like arrow is present;(I am trying to see how things work at the end of day after market hours)
    please help

    does login to zconnet, tradingQ&A all different?so many logins and so many passwords…. sigh.. :((((

    • 1. You can add upto 10 indicators, so you can add multiple EMA’s individually. You can’t currently create your own indicators.
      2. When you apply expert advisors whenever an alert is generated it shows up on generated alerts window, you will also hear a beep.

  33. Harshal says:

    Hiii Nithin,

    as i tried to trade with help of EA in Pi. But it is very difficult to trade as a lot of buy/sell signals are generated after a minute. so it is hard to trade. if one strategy gives buy signal, next minute it gives sell signal. it is very confusing.
    plz help me out

  34. santana pereira says:

    My trading ID DS5660
    I have gone to your Pi video link and have queries as under:
    1) Is the coding language same for Z-platform and Pi platform ?
    2) Is coding in Pi platform is limited for average and not for professional.?
    3) Can you send me the video link or examples of strategies coding already done for AFL amibroker platform.
    4) What are the aproximate charges for coding, bridge connect and data per month.

    Thanking you for early reply.

    Yours trully,

  35. Sudheer says:

    Need your kind help with the TradeScript code –

    Am trying to backtest the code while combining Stochastic (40,1,1,SIMPLE) and RSI (CLOSE,14) indicators. Pi very well displays the indicator (as shown the attached image) on the chart, but the backtest results throws an error message stating ‘%k slowing periods’ argument of SOPD is invalid. When the Stochastic(40,1,1,SIMPLE) indicator works on a chart, why doesn’t the same parameters work with the TradeScript?

    Please help!

  36. algogeek says:

    The values entered for stochastic is wrong, for stochastic
    Recommended Parameters
    % K Periods: 9
    % K Slowing Periods: 3
    % D Periods: 9
    MA Type: SIMPLE

    SOPK(9, 3, 9, SIMPLE) AND RSI(CLOSE, 14)

    • Sudheer says:

      Thank you for your response. I understand that 9,3,9,SIMPLE are the recommended parameters for Stochastic.
      However, I should be able to provide the custom setting for my strategy to work. The custom settings 40,1,1,SIMPLE have been working very well for me (which I use in my charts). I wanted to code the same for the system to generate the alerts. Please let me know if it is possible to use these settings in the code?

  37. algogeek says:


    you can not use 40 in parameters in stochastic, use 9,3,9 or some lesser values than 40

  38. sandeep says:

    Dear Sir,
    I am new to zerodha.I want to know that Can we create special codes for a particular stock. i.g. I have a strategy for any share that if that stocks goes up I should sell.

    With regards,

  39. Sravan says:

    1. How to reference the long price in back testing exit long script. If I want to test strategy where I exit long if some condition is satisfied or there is loss of 40 points from buy price, how do i code it in exit long script.i.e how to put stoploss in the backtesting script.
    2. While backtesting index futures, I can only select current futures and expired charts are not available. Backtesting against near month futures makes sense since volumes will be more in near month i,e if i want to test june future, it should use may future to test last month since volumes will be there and april future 2 months before instead of testing june future in may and april since trading activity happens there.
    To conclude availability of index data against near month futures across the months would be very helpful.

    • 1. In the backtest, you have buy, buy exit, sell, sell exit options. If you want to backtest with different conditions for profit booking of buy and sell entry, then you will need to run backtest twice, once for buy strategy and use Sell and sell exit for Profit and SL. Similarly backtest on your sell strategy separately.
      2. Yes best backtest on the underlying rather than the futures since there is no continuous futures data on Pi yet. If your strategy includes volume data, then yeah doing this on index spot will not be possible. We are working on giving continuous future charts in Pi, but this will take some time.

      • sravan says:

        Hi nitin,
        Thanks for the quick reply.
        I want to know how to code exit on loss of say x points in the script.
        Search is not working in the code referrnce document.

  40. Abhijeet says:

    As currently there are 30 EAs on website and as you said that Zwerodha is planning to launch about 100 EA’s in next few days.

    One suggestion here, Is it possible to suggest most popular or most used EA if user selects the particular stock for EA?

    For eg.
    Like if I select stock “tata steel” and for the same stock 100 people are using “Bearish Meeting Line (Short trades)” , 80 people are using “Three White Soldiers and Black Crows” and 50 people are using “Commodity Channel Index (CCI)” from past 7 days.

    So while creating new EA on users side is it possible to list those EA as per their popularity / use for that particular stock (in above case “tata steel” )?

    • hmmm.. we can’t track which user is using what EA. EA’s run locally on the client machine.

      • Abhijeet says:

        you can add facility to share individual EA’s to public if user is interested to help others! Also it will be helpful for all zerodha Pi users to know how other people are making profits, its win win situation for trader – Zerodha – other traders!

        Also with this facility more and more Zerodha users start getting interest in trading regularly

  41. fazlur rehman says:

    I am surprised buy the delay you are taking in adding super trend and pivot points. Since long you are promising to add in next release of pi but that next release didn’t come yet which is very irritating ………

    • Fazlur, we have received over a 100 new indicator requests. We will work on that, but first we are working on ensuring that everything else around the platform is optimized.

  42. prabhu says:

    Hi Nithin ji,

    I have an AFL indicator (purchased from some vendors) that shows arrows for buy and sell in amibroker chart, but i am not sure whether it will be able to connect with PI.

    can i connect the amiborker indicator arrow to place a order in PI, issue is that i don’t have the code of AFL.


    • Yes Prabhu, you can get the AFL to fire orders directly into Pi using Pi bridge. Check this. If you are subscribing data from neotrade analytics for amibroker, they will help you out in coding the AFL also. They have built a utility, if you drag and drop on a chart on Ami, it fires orders into Pi. Speak to them.

  43. Debajit says:

    I just start using PI from last month and found very helpful for new commerce who start writing script. I have two questions here:
    1) Is there any way in EA code I can add buy/sale exit also like in back test module.
    2) Once any buy or sale signal generate can draw stop loss & Target line automatic in chart based on
    trade price.

    • 1. Debajit, you can run two separate Expert advisors. So one to Buy and Buy exit (in sell, enter your buy exit code), and similarly a separate EA to Sell and Sell exit.
      2. No, not possible.

  44. prabhakar says:

    i am using pi it is good but only one market watch is there can it be possible to make multiple watchlist

  45. Ashok Jain says:

    Dear Nithin,

    I am not expert in technicals viewing of charts , but i want your algorithmic based trading to help me in getting buy and sell signal time to time . This it seem your EA does. Is this correct what i have understood from your website.

  46. mehtachandru says:

    Dear Nitin ,

    a) I liked your buy and sell in the same pop up it is easy to quickly to trade on zerodha .

    i have a two questions

    a) does your software support historical indicators of over 1 to 2 years . What i mean is resistance points or lines drawn by us / saved by us in the system which act as horizontal line indicator and are very useful to us to show that the stock is at a particular resistance zone that may move up or down.When i try doing this it does not save for the next day .

    b) is it possible to add the nse nifty as an overlay over a existing stock . This could be helpful instead of toggling around.

    I look forward to your response.

  47. Ramkumar says:

    The question raised by Sravan on (31/5) has not been answered. I also badly need to know how do it. I searched ref. doc and I couldn’t find way to do it. To refresh memory, the problem is “how to access entry price in exit long/short section?”. This will help us in doing things like putting a stop loss.

  48. Vishal says:

    Not sure if this a right place for this feature.
    It happens that that I’m +10000 in morning and -10000 by afternoon. Is it possible to square off all positions when the net profit moves down to +3000 from +10000.

  49. Ramkumar says:

    Thanks for the reply. Is it possible to plan for this feature in future? I think this is very essential feature for back testing. In this forum I need not stress enough the importance of stoploss.
    I have seen other software doing this. for example Ameritrade trading software. There is a simple check box for stop loss. if u enable it u can put stop either as % or absolute terms.


  50. sunil says:

    For fully automated trading in Equity we need dealers terminal.

    is it same rules for commodity trading? some peoples said we can trade fully automatically in commodity.

  51. Krishna says:

    Hello Nithin,

    I have recently enrolled with Zerodha. Trying to learn PI and the scripts.

    For the default EAs, I could find scripts for Buy & Sell. How do I determine scripts for Exit Long & Exit Short?


  52. Krishna says:

    Somehow attachment is not going through! Please let me know your email id, I can send it to yous separately.

  53. Ritesh says:

    Can Zerodha request for historical TICK data for NSE from day 1 of online trading (historical intraday bhavcopy) and integrate it within their system, including Pi? It will be great! Much better than all your customers chasing the much needed historical data out on the internet.

    • We are slowly increasing our database. Tick data is not possible, it will be 1 min OHLC data. Daily tick data will be between 20 to 30 GB just for NSE, and it is not practical to store historical data base of ticks and stream it via internet

  54. SathishJ says:

    Hi Nithin,
    From Day 1 I entered Zerodha, I am not able to trade using any of your Desktop, Web, Z5 platforms. Only i am fighting with your Mobile Trader application an d it works fine now.But, i would love to use your Web, Z5, Pi platforms to trade.Please help me. No good answer from your support team.

  55. vivek says:

    hi nitin,

    i’h started trading in pi, so far so good. need some help with EA’s to start with and then algo trading, i do have a strategy, need some help putting and back testing it in EA’s. Thanks.

  56. Arun Kamath says:

    Can we have stats of the EAs. i.e. best time frames, stocks, % winners etc

  57. Arun Kumar says:

    I am using PI, and its just excellent

  58. Sudarshan says:

    L6 = ((C-(H-L)*1.09))
    i want overllay this pivot on price chart , like we can overlay avg in amibroker ?

  59. Sudarshan says:


  60. Haribabu says:

    I am using PI. it is good.

    Kindly add available Margin to be displayed on top always so that it will be easier.

  61. Haribabu says:

    in PI

    please provide a feature of Pivot points as given in the below link.


  62. cbhumiya says:

    Hi Nitin,

    In the scanner settings the periodicity cannot be set to ‘day’. So it is not possible to compare a current value to the previous day close. Can this ‘day’ periodicity setting allowed by pi.


  63. hello sir ]

    please tell me how to write long exit code

    let say when crude oil crosses its EMA either I sell/buy and as soon as it covers 2 points i want to exit

    Example crude oil CMP 3700 EMA 10 crosses above i initiated buy and when it reaches 3702 i want to exit my position wants to scalp it

  64. cbhumiya says:

    Hi Nitin,

    In the scanner settings the periodicity cannot be set to ‘day’. So it is not possible to compare a current value to the previous day close. Can this ‘day’ periodicity setting allowed by pi.


    • Will forward to the tech team.

      • champak says:

        thanks 🙂

      • champak says:

        Hi Nitin,

        I think that there has been no action from your technical team on my previous query in which I had pointed out that the scanner settings cannot be set to a day. I also find that in scanner settings, if “periodicity” is kept in “minutes” and the “bar interval” kept more than “10” the scanner gives a message about the “maximum number of bars possible” and does not allow the scanner to be set. I believe that if I want a few number of candles then the scanner should allow me to use the settings mentioned above.

      • champak says:

        I want to set the periodicity as ‘minutes’ and bar interval as ’30’ in the scanner and pi is not allowing this to be set.

  65. P RAJENDRA KUMAR says:

    Hello sir,

    After studying all the indicators very very simple stratergy , what i feel, placing buy and sell signal when crossover between price line and 20 days EMA under algo trading

    Kindly advice

  66. lakshman says:

    Sir kindly make some arrangements so that we can known which stocks, commodity going above/below 50/100/200/300 emas like on by default or acting as support/resistance on eod data so that we filter stocks n chose which is highly bullish/bearish stocks and some pattrens like doji hammers inverted hammers n on on on hope even you will do this soon

  67. Sandip says:

    Is it possible to have options in EA like in Back testing….. Buy….Exit Buy….Sell….Exit Sell?
    As currently we cannot use it for OPTIONS if we want to just Buy Options and then Sell.
    As it is just Buy and Sell, it generates Sell(Short) Signals which I doesn’t want to go for

  68. parvati says:


    When I code my strategy and backtest it on PI, it sometimes says that the script generates error, but when I take a closer look, there is no error at all. Also the tool does not say in which line the tool sees an error if any. This is very frustrating when debugging. Please let me know if there are better ways to tackle such situations.


  69. MEHUL PARMAR says:


  70. Robin says:

    Hi Nithin,
    My strategy to trade in stocks in cash market is to buy on EMA (9,21) CROSSOVER and book a small profit or to exit on EMA (21,9) CROSSOVER.
    I have back tested it on pi on 15 min charts. I would like to Apply Expert Advisors everyday on all the NIFTY 50 stocks at the same time so as to utilise the opportunity as and when arises.
    1) Is this possible on pi?
    2) To Apply Expert Advisors, the chart of the security is to be opened. ……Can the chart be closed after applying EA ?….if the charts can be closed after applying EA, than EA can be applied to any number of securities…..Right?
    3) How many charts can be opened at a time ?

  71. Robin says:

    Hi Nithin,
    I was back testing on NIFTY FUTURES (current month) and saw that the data is from 4 May 2015….I realised that the data will be available from the time the contract have started.
    Hence I back tested on CNX NIFTY….by selecting NSE and then INDICES….but saw that even this data is available from 2 Feb 2015. (Both EOD & intraday).
    Is there any other way I can back test data for NIFTY for a longer duration?

  72. Robin says:

    Hi Nithin,
    The comment I just posted is awaiting moderation. It must be because of the links I have given in the comment (links to tradingqna). Please have a look at the comment.
    Thanks in advance for your time.

  73. Dan says:

    Hello, i am going to open an account very soon.I just came across a site which offers Zerodha club membership in which we get different technical softwares and training like Amibroker and Metatrade etc. Any difference if i open account through that site?

  74. vishal@09 says:

    Hi Zerodha team, I am facing to understand why backtesting in my pi software is behaving erratic. I used simple input such as below:

    after applying this on 30 min infy chart, backtest gave entry at te start of each 30 min candle bar, how to back test this strategy. I have snap shot but not able to attach.

    Pls help, bye vishal

    • vishal@09 says:

      there was typo in above query, the used code in backtesting was:


    • Vishal, can you click on check for latest updates on Pi under the help menu. Update the version of Pi and try again. Few cases where the last update hasn’t happened correctly some issues with backtesting.

  75. Sandip says:

    If I write Sell and Exit Sell script. Its says No result and Please write at least Buy or Sell Script
    But if I write some Buy script for same Profile, Keeping the same Sell and Exit sell script it generates Short Sell and Exit Sell signals

  76. Dhiraj Sharma says:

    Can I backtest pivot breakouts? How to generate signals for pivot breakouts?

  77. vinodkumar says:

    sir when i applied expert advisers buy and sell signals are generated and shown in generated alert window however it is not appeared in live chart how can i show EA signals in chart

  78. peter says:

    EA. When applying two EA script on a chart. I am getting signals as EA triggered. But quite confusing which EA strategy is triggered. for Eg.
    1. LRI and EMA Sometimes I get erroneous message when LRI triggered it says as EMA is triggered( in the source window of alerts).Any way I can adjust my mind , but I think You have to look into it.
    2. I reported a problem (send email to siva also) when a strategy is triggered we have to wait for the candle to close for generating another alert( buy or cell). If the alert sounded as a buy and the same candle goes below the price there is no alert. and a buy alert remains there , but virtually it is a sell. cannot really trust on EA.

    • Peter, you can name your EA by the strategy. So in the generated alerts window, it will show you which EA generated the alert.
      In technical analysis, trades are usually taken at the close of candle. But we are working on it to give the user an option to choose how he wants an alert, at the close or the way you want. Give it a few more days.

  79. Robin says:

    Hi Nithin,
    I am in love with Zerodha. I have traded with 2 other brokers earlier, but Zerodha is miles ahead of them…. in technology and also in service….I love the positive and helping attitude of ur team.
    I have a doubt regarding the accuracy of back testing results. I back tested a very simple EMA crossover strategy on NIFTY Futures for 60 days and CNX NIFTY for 120 days period. I tried with different candle stick period (10, 15, 20 min). I was surprised to see a profit of (after charges) Rs.12,000 for one lot . That was for 60 days. For 120 days on CNX NIFTY, I got a profit of (after charges) Rs.23,000. Ofcourse, there were differences for different candle stick periods…. but on an average, this was the result. Even if we take a 10% error/deviation, the profits are too good to be true.

    • Robin, last 4 months had two or three 500 point moves in one direction when EMA’s work very well. So possible, but do check if your code is right.

      • Robin says:

        Thanks for ur time and ur reply.
        1) For backtesting intraday charts (5,10,15,20,30 mins), the maximum duration allowed is only 120 days (4 months)….. which is toooo less to get an idea of the profitability of any strategy. Please increase it to at least 1 year (365 days)….preferred will be for 2 years.
        2) Also, please u[date data for CNX NIFTY for similar duration.

  80. Robin says:

    Hi Nithin,
    For backtesting intraday charts (5,10,15,20,30 mins), the maximum duration allowed is only 120 days (4 months)….. which is toooo less to get an idea of the profitability of any strategy.
    Please increase it to at least 1 year (365 days)….preferred will be for 2 or 3 years.
    Pi is so power packed…… but without data it is weak.
    It is like having a Ferrari…but no fuel to drive it ! 🙂
    Pls, take it up on a priority basis.

  81. Robin says:

    Hi Nithin,
    Sorry, I am bugging u too much.
    I have a request. This request can be fulfilled by making a very small modification on Pi.
    On Pi, when an order is executed, there is an announcement which can be heard very well even from the next room….which is excellent.
    BUT, when an Expert Adviser is triggered, there is only a SINGLE beep and a pop up. If I am in front of the monitor at that time and not engaged in any thing else, then it serves the purpose. But, if I am even little away from the monitor or in the next room or even in front of the computer watching some business channel, it is easy to miss the alert.
    Hence, my request is to make the beep … 4 or 5 times continuously. (an option can be given to the client if he wants single beep or multiple beep)
    Hope this suggestion is useful and can be implemented.

    • peter says:

      I don’t know whether it is recommended. Locate C:\zerodha\pi\res. there is a wav file named “ExpertAdvisorSellAlert”. If you know how to edit wave file try it and make it multiple alert. Try to save the edited file in same name and preserve original file. It works.

  82. peter says:

    EA ‘strategy with previous and current candle’ – It prompts for a buy and generated alerts shows a sell.Please verify.

  83. RATHEESH says:

    do you providing nest default option strategies for fully automated algotrading…? if using please send a mail to me or call me on 9744618132

  84. peter says:

    A request , Can you add buttons on EA page-Select all/unselect all.

  85. Sandip says:

    Hi Nitin,

    I have been asked to upgrade my Internet to Broadband when I last reported issues with signal not generating as per condition when I take it live. Now I have upgraded to 2 Mbps Wired broadband which consistently gives me above 1.5 Mbps even after that the signals generated in live environment and in Back testing are different.

    Please help

  86. Robin says:

    Hi Nithin,
    I have sent a mail to you…….. Please, please, please go thru the mail. I am sure, other traders would have faced this problem in EA generated signals on Pi after the recent changes made.

    Thank you.

  87. Deepak says:

    Is there an option to backtest with the ability to provide a profit target in percentage as exit trade?

  88. Manu says:

    I am trying to back test strategy , it gives the backtest result but the chart is blank and the backtesting screen also hangs. When I try to close the chart window it says “chart is in use”. Please correct my code if it has some mistakes. I am testing on 1 minute nifty futures for 1 day data.
    For Buy
    For SELL:
    The problem seems to be with REF(MACDHIST,2) as when I remove this term it works fine but I require it for my signal generation.

  89. Manu says:

    In the above post the code is not complete, the correct code is
    “For Buy
    For SELL:

  90. Manu says:

    I don’t know why some of the code is removed when I post the message.
    In words the strategy for MACDHIST is
    For Buy:
    (MACDHIST should be greater than zero and previous days MACDHIST should be less than zero ) OR ( previous days MACDHIST should be greater than zero and 2 days back MACDHIST should be less than zero )
    ( MACDHIST should be less than zero and previous days MACDHIST should be more than zero ) OR ( previous days MACDHIST should be less than zero and 2 days back MACDHIST should be more than zero )

  91. Arshad says:

    Hi Nithin,

    Current version of PI has set backtest limit to last 120 days only. Will this be increased in next version? 120 days is very restrictive limit for backtest , it should be minimum of 1-2 years.


    • Arshad the limit of 120 days is on intraday candles only, that is like 50,000 candles of 1 min data. The daily candles can be backtested upto 5 years. But yes, we will increase the intraday data as well.

      • Arshad says:

        Hi Nithin,

        Agreed for intraday 1, 2, 5 mins candles of 1or 2 yr there will be easily 50,000 candles or more which will put load on server. But the number of 1hr, 2hr , 4 hr intraday candles will be much lesser for 1yr or 2yrs. So I think you could still provide 1hour or 2 hours charts for 1 to 2 years.

        The reason I say is because there are a lot of positional strategies which use 1hr, 2 hr charts but carry over the trade overnight. Backtesting these for 1 year will give more confidence as opposed to just 120 days.


  92. gaurav says:

    was away from trading for sometime
    installed the updated pi today, it works really

    happy to see many improvements ,runs well, is fast and ezee to use as always

    ((i have traded with the costliest brokerage where they promise you the moon and charge you the solar system.they give you a dedicated adviser -whose job is to make sure you keep bringing in money . i was tired of buggy platform, clueless customer care and very very high charges .its like dealing with a government office :even with such high charges they refuse to provide you a proper charting -you can easily guess the name ))

    no one matches zerodha in terms of user friendliness , and the way u people take care of every query every request is great keep up the good work

  93. Uma says:

    Why don’t expert advisors generate buy sell signals on the chart itself? Also, is there a way to apply expert advisor to all open charts at the least?

  94. Ishwar M. says:


    The TREND function does not work in combination with the EMA. For example:
    TREND(EMA(CLOSE, 50), 2) = UP returns no trades.

    I have the latest patch of Pi. This issue happens only for TREND with EMA. TREND with MACD or RSI works fine.

    Could you please look into this?


  95. Ishwar M. says:


    One query regarding the Risk to Reward ratio shown in the Back Test report. Could you please tell me how this is calculated? As I can’t seem to arrive at that number. For example, I have the below data generated in the back test report:

    Total number of trades: 27
    Number of profitable trades: 12
    Number of losing trade: 15
    Total profit: 73.6
    Total loss: -39.2
    Percent profit: 46.739%
    Largest profit: 15.85
    Largest loss: -5.9
    Risk to reward ratio: 0.234

    So, how to arrive at this Risk to reward ratio of 0.234 from the above data? Or is any more data required for calculating this?


    • You will need more data. You will need profit/loss on every single trade.

      • Ishwar M. says:

        Ah ok.

        Nithin, one feature request related to EAs in general. If I leave the EAs running on my computer, can the generated alerts be sent as notifications to Kite? This way we can execute the buy / sell at the right time with Kite on mobile even when we are not around the computer. Or do you already have some plans of being able to Apply EAs directly on the mobile through the android app that is coming up or in Kite itself?

  96. Badri says:

    Can a single EA script be used to run on all F&O scripts for parallel scans and generate alerts for multiple matches in Pi?

  97. Ramesh says:

    The EA seems to be useful for only the intraday traders. I would like to use the scanner on all stocks (Closing price) so that I can identify buy and sell opportunities for short term trading. Is it already available? Am I missing something?

  98. RAJ says:

    Is it possible for me to apply an EA to a chart and get it stored in the system so that EA is active all the time and will show a signal moment i open pie ;if yes where can i see a list of all my active EAs or should i buy amibroker or other software . I am not very good at coding though.

  99. Anil says:


    I need some sort of setup as below

    A screener or alert kind of system which can scan over all the NSE stocks during live trading and when ever my strategy is fulfilled ( something like say EMA Crossover happened ), I need to get all the stocks for which the strategy is fulfilled.

    For example: For EMA Crossover of (20,60). I need to know the stocks in NSE for which EMA crossover happened during live trading in 1-minute time frame.

    It would be great if my above requirement can be fulfilled with Pi. Please let me know the possible solution if any.

    Looking forward to hear from you.


    • Anil says:

      I just want the pop-up message or alert with the stock name?

      Also I would like to know how reliable is it to use multiple scanners during live trading in PI?

      When I write the EMA Crossover logic in scanner, will it alert or pop-up message when the crossover happens during live trading?

  100. Tejas Desai says:

    HI Nitin,

    PI is good platform for zerodha trader , But I am not able to do simple scanning in PI . I want to scan those stock which are trading below there opening price , Please help me on this in PI

    Tejas Desai

    • Venu Madhav says:

      On Pi go to Alerts –> Scanner –>Click on New Scanner –> Give it a name –> Condition = LAST Select the periodicity, bar interval and days –> Click on Add Symbols to add the symbols on which you want to scan the given criteria. You can see the Added symbols in the ‘Added Symbols’ dropdown –> Click on Ok –> Click on Load. This will run the scanner and give you the list of scrips which meets your criteria.

  101. rahul says:

    i am new in zerodha trading
    plz bataiye ki ye backtest kya hai and reply in hindi

    • Venu Madhav says:

      बॅक टेस्टिंग से आप यह पता लगा पाओगे यदि आपका ट्रेडिंग स्ट्रॅटजी कामयाब रहा है की नही.

      अगर आपके पास कोई ट्रेडिंग स्ट्रॅटजी है तो उसको आप पिछले कई दिनों के चार्ट पे टेस्ट कर सकते है. आपको पहले के चार्ट पे बाइ सेल सिग्नल जेनरेट होगा. आप यह भी पता लगा पाओगे की आपकी स्ट्रॅटजी से कितने ट्रेड्स निकले,उसमे कितने लाभदायक थे और कितने नुक़सानदायक थे. इससे आप अंदाज़ा लगा पाओगे यदि आपको फ्यूचर में वो स्ट्रॅटजी का उपयोग करना है की नही

  102. rahul says:

    thanks for reply sir

  103. rahul says:

    sir jab b mai bracket order place karta hu to order reject kyo ho jata hai rms: client not enable on product
    aise aata hai

  104. rahul says:

    and sir ye scanner kya chij hai????

  105. rahul says:

    kya bracket order modify ho sakte hai?

  106. rohit D says:

    Hi Nithin,

    If i have 35 scrips in my watch list n if I have a strategy coded then is it possible that I get buy sell signal on all 35 scrips in real time n rather not just on a scrip whose chart is on my screen.
    please let me know about this.

    thank you

  107. Rahul says:


    I have one query that suppose If I have enabled one strategy on pi as well as I am not in front of my laptop and laptop is shut down…..Can i get those alerts on my registered mobile number so once i get alert i could place orders through mobile app or through kite….

  108. Rohit says:


    This is a great software. However, I can see that the trades are to be entered manually by clicking buttons. Is there any option for automatic buy and sell orders?

  109. Ankur Dahama says:

    I have to scan stocks that are crossing its “Previous Day High” . Previous provide code for the scanner.
    Thank You

  110. Vivek says:

    Why there is a difference in the back testing alerts and alerts generated at real time? I can see too many alerts getting generated at real time but in back testing there are very few.

    Thank you.

    • It probably has got to do with the code. Can you post the code u r backtesting.

      • Vivek says:

        The script that I’m using is the Expert Advisor inbuilt script ‘ADX,MACD, stachastic and RSI in combination’:

        BUY script-
        ADX(14) > 20 and DIP(14) > 20 AND RSI(CLOSE, 14) > 40 AND REF(MACDSignal(13, 26, 9, SIMPLE), 1) < REF(MACD(13, 26, 9, SIMPLE), 1) AND MACDSignal(13, 26, 9, SIMPLE) 20 and DIN(14) > 20 AND RSI(CLOSE, 14) REF(MACD(13, 26, 9, SIMPLE), 1) AND MACDSignal(13, 26, 9, SIMPLE) > MACD(13, 26, 9, SIMPLE)

        • Vivek says:

          The script that I’m using is the Expert Advisor inbuilt script ‘ADX,MACD, stachastic and RSI in combination’:

          BUY script-
          ADX(14) > 20 and DIP(14) > 20 AND RSI(CLOSE, 14) > 40 AND REF(MACDSignal(13, 26, 9, SIMPLE), 1) < REF(MACD(13, 26, 9, SIMPLE), 1) AND MACDSignal(13, 26, 9, SIMPLE) 20 and DIN(14) > 20 AND RSI(CLOSE, 14) REF(MACD(13, 26, 9, SIMPLE), 1) AND MACDSignal(13, 26, 9, SIMPLE) > MACD(13, 26, 9, SIMPLE)

          Please ignore the previous scripts that I posted.

          • Vivek says:

            The script that I’m using is the Expert Advisor inbuilt script ‘ADX,MACD, stachastic and RSI in combination’:

            BUY script-
            ADX(14) > 20 and DIP(14) > 20 AND RSI(CLOSE, 14) > 40 AND REF(MACDSignal(13, 26, 9, SIMPLE), 1) < REF(MACD(13, 26, 9, SIMPLE), 1) AND MACDSignal(13, 26, 9, SIMPLE) < MACD(13, 26, 9, SIMPLE)

            • Vivek says:

              The script that I’m using is the Expert Advisor inbuilt script ‘ADX,MACD, stachastic and RSI in combination’:

              Sell script :
              ADX(14) > 20 and DIN(14) > 20 AND RSI(CLOSE, 14) REF(MACD(13, 26, 9, SIMPLE), 1) AND MACDSignal(13, 26, 9, SIMPLE) > MACD(13, 26, 9, SIMPLE)

              I had to post it multiple times as the entire script was not getting posted.

  111. Anoop says:


    If i have selected RSI or some other indicator in a cg=hart how do i remove the same from chart without closing it ?

  112. Sridhar Rao says:

    Hello , This is Sridhar here from Mumbai. I want to backtest this strategy of Shorting a Near Call Option 600 points away out of money from the Nifty Spot Price on Expiry date. I want to find wether Nifty has breached this 600 points mark in the last 2 years & what is the success ratio of this strategy

  113. Dark Trader says:

    hI, what would be the code for CCI 50 CROSSOVER SMA 20 of CCI50


  114. Mehmudd says:


    Possible to backtest multiple strategies at once? I mean combination of 2 or 3 strategies.

    I tried simply pasting two strategies one after one in buy and sell scripts sections of backtest. It was throwing some error. Is there any way to carry out that?

    For ex: I tried BB strategy and RSI, it was throwing error. Please find the print screen attached.

  115. YOGESH N says:

    SIR, backtest is a very good tool to use that can prevent getting huge lose.. thanks to you..
    Can you please give me one code that can help me for better trade.
    i usually trade nifty future and options please give me code for this one.

  116. Rohit D says:

    Hi Nithin,

    can u please tell me if is it possible to use scanner function for getting buy sell signal from a code
    on 25 scrips or more in real time?
    n please make a video about scanner function for youtube.


  117. Preetam says:

    Sir , if I am using an indicator (studies) on kite which is not available on Pi, is the following possible

    1) audio notification that a buy or sell order is generated on the laptop.
    2) message on my mobile incase I dont have access to the laptop.

    Preetam Salwan

  118. Huma says:

    M getting error message : error in script, for scanner. But this same code runs smoothly in backtesting and EA. So how can I use this code in scanner – I want to scan a list of symbols for intraday.

  119. DK2769 says:

    Hi Nitin,

    Firstly I should thank you for the well planned execution of your firm. I am very much happy about the PI EA, Keep up the good work.

    I know none of the strategy works in stock market if there is a surprise news like for example RATECUT…!!!

    Can you please take out some time and advice which script will be best for day traders in the area of…


    I would be proud and happy If I do the same in KITE. Also I would like to thankyou for an idea about opentrade.

    Kundan Prasad

  120. ANKUR KUSHWAHA says:

    Currently facing issues regarding Backtesting. Please tell me where i am doing wrong.

  121. Krishnaveni says:

    in my zerodha pi -> artificial intelligence -> apply EA showing blank popup box and while creating new EA it is showing error as “The request failedwith HTTP status 417: Expectation failed”..pl help me out

  122. Sidharth Kumar says:

    Is it possible for EA alerts to directly open a BO dialogue box rather than the usual MIS/CO ?

  123. acedubai says:

    I want the EA to open orders at every bar open in the direction i specify in the EA. The number of orders also will be specified by me in the EA. But before the next order is opened at the next bar open, EA should secure the previous order with a stop loss at cost. Is this doable?
    Are there any 3rd party programmers who can programme this for me?

  124. vishal salunkhe says:

    Hi nithin ,
    I have modifieid heiken ashi excel formula
    can I customise in pi heiken ashi
    if yes ,then how to customise ??
    I also attach yes bank daily modified heiken ashi chart

  125. vishal salunkhe says:

    file not attach due error

  126. vishal salunkhe says:

    hi nithin just check this modified heiken ashi daily candle with pi heiken ashi . last candle is of 2nd march 2016.

  127. vishal salunkhe says:

    hi nithin just check this modified heiken ashi daily candle with pi heiken ashi . last candle is of 2nd march 2016.
    this modified heiken ashi gives clear trend …

  128. Praveen says:

    Hi All,

    I have one query regarding automating trading

    1st thing, I work only with “Cover Order” for better leverage.

    Can I create an EA in Pi with following situation?

    Lets say currently LTP is 2500


    If price reaches 2520, my EA should execute a “Cover Order” with specified SL (I am also aware that the cover orders are market orders, hence exact 2520 may not be achieved, but that is fine, even if EA can execute a cover order automatically at/around 2520, it sufficient)

    Exit: EA should perform the closing of open “Cover Order” at a specified level

  129. Sahaj says:

    Can any one please tell me best automatic buy sell signal provider please? It is my request to you.

  130. A Das says:

    from where we can get the manual / list of built-in functions of AFL ?

  131. jai says:

    Does the backtesting a script not consider MIS? If i run through a script for more that 2 days, sometime it shows open position on 1st day and the closing it out another day.

  132. Sanjib says:

    Every time i use backtest there shows a alert “(‘Your script generated an error’) script generated no trades..make sure that atleast buy or sell script are typed in.”But i already copy and paste the script.

    • algogeek says:

      when we backtest a script for certain historical data, the buy and sell signals generates only when the condition meet, so, if no pattern matches it will show error script generated no trades, try with high liquid stocks/futures like hdfcbank, nifty with more historical data and check if signals are generating.

  133. pranjal rajput says:

    Can expert advisor code consider other scrips while generating the buy/sell ?

    Can we create custom EAs in other language (java,python) which have access to methods of TradeScript.
    Example java code – if( MACD(“INFY”,13, 26, 9, SIMPLE) < X && myJavaMethod()==true )
    This has 2 features, the value of "X" are not hardcoded and myJavaMethod can contain java code that can have custom made logic specific to my own trading strategies/methods.

  134. Vijay Krishnan says:

    I want to write a script that would apply an EA over all NSE Stocks and write out the output to a text file. How do I achieve this? How can I loop through all the NSE Stocks? I am currently manually backtesting one stock at a time against an EA. It’s taking around a week to identify stocks for delivery based buying. Please do let me know

  135. Rohin says:

    hey.. kuddos Nithin,for providing broad spectrum of EAs 🙂 I wanted to know if there is way where i can backtest strategies for longer interval of time say like over period of year

  136. santana says:

    Hi Nithin,
    Many companies/brokers have started fully algotrading feature on VPS server.

    Are you planning to start like that.

    Peoples have strategies for fully algotrading.

    kindly reply.


  137. Vineet A says:

    1. While going through Tradescript strategies provided, I noticed that the candle stick pattern in Buy/Sell signal have been derived using the reference value of OHLC, which makes me wonder, does Pi’s expert advisors supports the candlestick pattern constant as given in Tradescript pdf for eg. can I use CP() = BULLISH_ENGULFING_LINE instead of those references in Pi’s EA?
    2. Suppose my strategy requires the following condition : (Morningstar OR Dozi) AND MACD Up Trend. How can I go about it?

  138. gopi says:

    Hi , Am i missing something??
    I applied the EA and what i get is only alerts(under alerts–>generated alerts) , but dont get any buy/sell icon on the actual live chart ..
    my requirment is very simple , i need my own customization indicator to be displayed in the chart . just like when i apply study , i can see that indicator on my chart .
    hope i explained with east , please help me

  139. AHSAN says:

    hi nittin,

    i want to know that what is the use of go live button in create alert option. is it auto trading button according to our script or somthing else

    • Venu says:

      No, there’s no auto trading permitted on the retail trading platform. By clicking on Go live, alerts start getting generated.

      • Shabeer says:

        Hi venu

        But is that generated alert buy/sell button really working ? I am facing problem for a week now that only first alert button works but rest of the alerts order being rejected with error message ” client order Id already exist ”
        Means if you enter long or short by an alert you will have to exit manually , even if there is an exit alert that button will not work !
        I had raised several tickets now and they are working on it , hope a solution soon
        Is that really a technical error ? Or it’s only with me ?
        Even after reinstalling Pi 3 times and tried it on an other PC
        Can you suggest something from your expertise ? As I am missing so many trading opportunities !

    • Shabeer says:

      Hi Ahsan
      I would like to know , are you using Pi EA and are those buy/sell working for you.
      I mean every generated alerts one by one working for you iwithout any trouble ?

      • AHSAN says:

        hi sabeer ,
        i will let you know by tommarrow i will test everything then i will talk to you
        thanks anyway.

  140. MANUS says:

    In your Pi software if I tick one EA from Artificial Intelligence drop down menu, what happens? Whenever the conditions match buy sell arrow erupts or sound alert comes? Or none? How to use your artificial intelligence on live chart for profitable trading please?

  141. sunil says:

    Hie Experts.

    I`m trying to write a script but not able to convert into running script
    my idea is


    Two moving average
    Set A = WWS(CLOSE,5)
    set B = WWS(CLOSE,15)
    buy when
    crossover(A,B) and
    sell when

    now i want to introduce stochastic momentum index also in above formula , what i understant from manual is
    below formula

    Stochastic momemtum index
    SMID(14, 2, 3, 9, WMA, WMA) > 40 OR SMIK(14, 2, 3, 9, WMA, WMA) > 40

    but dont know how to combine this with above crossover

    any help with be grateful


  142. Jose says:

    Hi Nithin,
    Can I use EA for positional trades? or is it only for intraday trades.

  143. ravi says:


    How do i check for a script which enters as soon as a price is broken on the up side ( down side for shorts ) . Currently all the scripts seem to work only on the candle close basis.


  144. nagesh says:

    Do we have scanner for supertrend like it shud show scripts which are belw r abve supertrend at the eod or during the day.

  145. Vivek says:

    hI Nithin ji,

    Please correct this script,

    last< ema20

    ema20 <psar

    this is for scanner, how to choose 5 mtf and 15 mtf on scanner ?

    • algogeek says:

      For the above condition

      LAST < EMA(CLOSE,20)

      EMA(CLOSE,20)<PSAR(0.02, 0.2)

      you can also post code related queries on tradingqna.com

  146. Raam says:

    Is there an option to execute the Auto Buy/Sell signals generated, without user intervention?

  147. Wajid says:

    Back test with 120 days is hardly useful.
    When will the limit be increased ? it is still 120 days..

    • Siva says:

      120 days of back-testing for intraday data gives facility to back-test up-to 60,000 1 minute candles. One can do backtesting on daily candles for last 10 years.

  148. ashvini hajare says:

    hi ! I am using supertrend for my trading . I am trying to use code for this indicator. Can you help me to code this & is it applicable on pi charts ? Also I want to know whether is it possible to code multiple indicators in different time frame ?

  149. Arvind says:

    Hi Nithin,
    What are the system requirements to automate the trade ? Also, is it required to be online or offline also we can automate?


  150. Murugesh says:

    Hello sir any huge buying or selling is there ??

  151. Omkar says:

    Is there any procedure to register my own technical indicator which offered automatic signal. Where shud I GO ?

  152. kusum lata says:

    sir will you introduce buying or selling on limit price in Bracket order. if we want to buy 3000 share in intraday in any script it buys on different prices which fails our strategy.

  153. Srivida says:

    Hi Nithin
    Want to start with thanking you for all your and your team’s efforts on zer0dha. BIG FAN…
    I have written a few strategies on PI and have backtested them. The strategies involved EMA 10, EMA 30 and EMA 50 in one way or other. I have copied them to EA and have applied them on charts too. All went well. My question is this:
    If I open a 10 minute chart for a script at 915 am and apply a EA with EMA 50, will the EA wait for 50 10 minute candles to passby for the day before generating an alert or is the EA applied on running candles no matter the day? IOW, will my EA start generating alerts (if they are applicable) from the first candle of the day itself or will it wait for sometime for some kind of validation?
    A reply is greatly appreciated.

    • It will depend on the chart you are looking at. It will be based on the data on the chart. If your chart has 50 10 min candles, it will start getting signals immediately, if not it will wait for the time period to complete.

      • Srivida says:

        Thanks for your reply Mr.Kamath. PI doesn’t allow me to see more candles than that is generated during the market hours. IOW, I can see only the candles that are pertinent to the trading day in PI when I open a chart. How I fix it? I need my alerts / EAs to be effective with the running candles.

  154. Bharat says:

    i just new join and try to understand Create New Expert Advise. I have create new advise name as “Test 1”
    i have applied it on one particular stock . but after close the chart by default Ea strategy also close for that stock. i have to create repeatedly if chart is close and open .
    Is there any solution whenever i open chart my created expert advise will be continue.
    And also i want apply my created strategy to all stocks without open each stock charts.

  155. waqar says:

    is metastock language works on your software…?

  156. kusum lata says:

    can we increase market watch from 5 to 8.

  157. Rohit says:

    Hi Nithin,

    Is it possible in PI –
    A scanner query like –

    1) Give me the list of stocks from my watchlist who’s Weighted closing & Typical Price say 30 is about to cross over in say – 15 mins timeframe ?

    2) Give me the list of shocks from my marketwatch whose CMP is breaking up or down the price defined by me.

  158. Monojit Roy says:

    Hello Kamath/Team,

    I am great admirer of you. You folks did a great job which is commendable.
    Today I am posting one query –

    I have downloaded MT5. Can I bridge NEST with it to trigger AUTO BUY/SELL orders. Also help me how can I open NSE futures/cash segment in MT5.

    The supertrend charts are really quick and human error is something that is losing the business. Please help me.

  159. Sudhish says:

    Will generated alert execute the alerts automatically, will it just signals when alert becomes true. Also can anyone explain how to edit or delete generated alerts in PI

    • Just give buy/sell alerts. You can edit it by clicking on the same screen where you see all expert advisors. See the image with title “After taking EA live – the EA icon”

  160. omprakash says:

    Hi my id is DO0042.Omprakash. Can you please tell the formula for how wti crude oil in dollar is converted to mcx crude oil. eg: Current price is $46.71 and how this price is calculated in mcx crude oil the formula.

  161. Satya Prakash Chaudhary says:

    Regarding Back Test:
    It is seen that when I put a Script/EA for the back test, it generated orders at the CLOSE price of the CANDLES instead of actual moment the script conditions are met.

    Why it is like that?

    Whether the script generates alerts in same way when LIVE in Market?

    Kindly explain the logic of working of EA in LIVE market.


    • Siva says:

      It is because if the conditions are met same signal can be generated any number of times during the candle formation and it does not make any sense, also few times the conditions might get satisfied during the formation of candle but were not after the completion of the candle. The same in live markets.

  162. Ashish says:

    hello team,

    I’m just unable to “stop backtest” since it’s keep on opening new tab. can you please explain how to stop that? also each new tab unable to close since its giving me error message “The chart is currently in use”. please help on this issue.

  163. Raja Rajan says:

    Just uninstall PI and its components completely and then reinstall PI again

  164. Mohan says:

    How to program an EA for stochastic? Do anyone have the script?

  165. Priyank Saxena says:

    Back testing strategy doesn’t works with ICHIMOKU indicator, whenever I backtest on one stock so it keep on back testing the same stock, it doesn’t allow me to change the stock for another backtest. And whenever I press stop backtesting it opens another graph of same previous script, and this keeps on going till I logout and again log in to the Pi.

    Please look in to the issue.

  166. Vinay says:

    i need code for below startegy to apply as ALERT in PI for selectred scripts .

    1) BUY SIGNAL:

    a) 13 EMA crossover 34 EMA from below oving upwards..
    b) Parabolic SAR is below candle .
    c) stochastic ( 10,3,3) is above 50 .


    a) 13 EMA crossover 34 EMA from above moving below.
    b) Parabolic SAR is above candle .
    c) stochastic ( 10,3,3) is below 50 .

  167. sr says:

    pi is no doubt one of the best trading platforms i have seen so so far
    but there scope for improvement.
    on immediate terms can you add an alert feature in charts/stocks when it crosses certain level
    and xabcd cypher and Elliott patterns in charts
    currently have to use tradingview alongside pi in multi-screen setup

  168. Arka says:

    Dear Team,

    Firstly, highly impressed with how far Zerodha has come and wish you luck for the future.
    Onto the query,

    I tried the Bollinger Bands EA code from the Zerodha site: https://zerodha.com/expert-advisors/code/bollinger-bands-trading-system

    I applied this to Spicejet stock with a periodicty of MINUTES , Bar Intervals 30 and Days 30. Following is the o/p without the ratios:

    Total number of trades: 1
    Average number of trades per month: 3
    Number of profitable trades: 1
    Number of losing trades: 0
    Total profit: 4.2000
    Total loss: -0.1500
    Percent profit: 96.429%
    Largest profit: 2.3500
    Largest loss: -0.1500
    18-07-2016 14:45:00,LONG,62.9500
    27-07-2016 11:15:00,SHORT,64.8000
    02-08-2016 14:45:00,LONG,62.4500

    I am unable to completely understand this data.
    1. It says total trades 1 but there are 3 trade points
    2. How is 96% profit calculated?
    3. Total number of losing trades is 0 yet there’s a loss amount
    4. Does the algo consider squaring off at the EOD for respective trade?

    Thanks and Regards,

    P.S. Are there any online resources to learn TradeScript?

  169. S RAJASHEKAR says:

    I need a code for the following strategy
    Crossover of moving averages and MACD

    SMA 26 EMA13 WMA 9 AND MACD 26.13,9

  170. Arka says:

    Hi my comment has been awaiting moderation since Aug 8. Could you please look into this?

  171. Sudhish says:

    Can you please advise how I can write script to scan all scrips at end of day on daily chart to give me alerts ?

    for eg -:

    At the end of day I would like scan all scrips to find the scrips which Satisfies


    How would I do it ?

    • algogeek says:

      Create scripted alerts , scanners or Expert Advisors only works in live markets on intraday charts with live ticks based on last traded price, it will not give any alerts on after market hours, if you want to check the signals on daily basis with day candles you can use backtest and check with historical data.

  172. MR says:

    Could you please provide the trascript setup on Pi for the following code:

    MACD 12,26,9
    CCI 10,-100,100
    RSI 14,70,30

  173. Bhushan Kela says:

    Hi Sir,
    I want to know about the Expert advisor in live markets for the following strategy.

    It should scan the market watch or entire market alongwith Futures for OPEN = HIGH and OPEN = LOW condition.
    Is it possible. Please let me know.

    Bhushan Kela

  174. Jyoti says:

    Being a beginner, it would be helpful if you could make some video clips of EAs’ & quant topic there is lot of things to remember and your presentation quite complicated, hope you will do the needful.

  175. ANUJ says:

    Why cant zerodha add a windows to select the data from this date to this dat e.g 2/02/16 to 02/06/16.max. range of four month will not breach. software will work properly…….and backtesting can be done also on any range of date.

  176. Pradeep says:

    Dear Nithin / Any Expert,
    Can you please provide details about the trend() function. I would like to know these details about this function: 1. How many previous candles does this function consider to decide about the trend? 2. Does it help in quickly getting the trend change? 3. Or is this useful only the determine the already prevailing trend?


  177. Krishna says:

    Hi ,

    I need to know, is EA can be integrate with mobile version of kite.

  178. DEBOJYOTY DATTA says:

    Ichimoku Cloud Trading Strategy Given on your site backtest failed

    Buy script

    SET C = (SMA(HIGH,9)+SMA(LOW,9))/2
    SET D = (SMA(HIGH,26)+SMA(LOW,26))/2
    SET A = (C+D)/2
    SET B = (SMA(HIGH,52)+SMA(LOW,52))/2

    Sell script

    SET C = (SMA(HIGH,9)+SMA(LOW,9))/2
    SET D = (SMA(HIGH,26)+SMA(LOW,26))/2
    SET A = (C+D)/2
    SET B = (SMA(HIGH,52)+SMA(LOW,52))/2

  179. Himanshu says:

    Is there any way to optimizing indicators values (like in Amibroker) in zerodha Pi. I would love to do backtest while optimizing my indicators value for certain stocks. Thanks

  180. sunil tyagi says:

    please provide supertrend in expert advisor.

  181. Prashant says:

    Hi nitin,
    I have two queries regarding EA’S
    1) Can one EA be used on multiple charts during market hours ?
    2) if yes then, can the settings be used next day , so that we don’t have to do them again ?

    Thanks in advance

  182. Prashant says:

    Great….. Thanks for the prompt reply..


  183. Prashant says:

    Hi zerodha team,

    One input for pi :
    Every trader has his liking for one or more EA’s which is used by him on daily basis for trading. So it will be of great help if EA’s are included in chart template so that can be used very easily.
    Pl. Include this in future releases if possible.

    Best regards,

  184. harish mehta says:

    sir, can u speck in hindi ? sir, this pi softwear is very use fully but, i dont no this softwear using guide so pls , give me provide buy or sell automatic signal demo request, i have all ready zerodha customer so, pls help me use this softwear knowladge i all ready new user thank

  185. PRAMOD says:

    Just wanted to know how many days Intra day (ex. 5, 15,30,60 minutes) historic charts that we can view in your Pi software.
    Is it displaying intraday Charts for > 30 days ?

  186. Bipin says:

    Hi All,

    I have 2 questions. How can i save the out put value of Average true Range in to a variable and similarly how can i capture the Super Trend Value in to a variable. Please share the formula for the same

    Thanks in Advance


  187. Arjun Singh says:

    Sir, What’s the difference between creating scripted alerts and creating expert advisors? As I see, in creating scripted alerts there’s an extra option to write exit long and exit short strategy, but in creating EA, one can only write buy and Sell script. Does the scripted alerts generate buy, sell and exit trade(long/Short) signals?

  188. srinivas says:

    sir, i am new to pi. while playing around software pi, i noticed that the results generated in back test (buy/sell signals) i.e., the green arrow and red arrow are not plotted on the graph. do i have to enable/disable any option so see the signals. please reply soon dear.

  189. BHushan says:

    Can you pls share ea for GMMA

  190. AKD says:

    Hi! I’m new to Zerodha “PI”.
    Does it possible to use PI “Scanner” (PI>Alerts>Scanner>New Scanner) to scan & short various Stocks based on their EOD Data (as EOD scanner)? Because, I’m getting only “Minute” & “Hour” options in “Periodicity” drop down menu! Is there any alternative option?
    If “Yes”, then requesting you to kindly let me know the procedure.
    If “No”, then requesting you to kindly incorporate the “EOD” scanning facility in to “PI”, which will be a great help to us & make the system near completed.
    Wish to have a prompt reply from your end as always.
    Thanks in advance.

    • algogeek says:

      In Pi, the scanner feature works only in the live market hours as it scan or check based on last traded price of the given conditions to the list of stocks, currently in scanner there is only minute and hour time frame and no end of the day candle time frame as scanner will not work after market hours.
      We Will pass on your feedback.

  191. Pritish says:

    Trying backtesting and noticed on many results where it shows loss but percent profit is 0%. Is this an error or expected? Can post more examples if required.

    E.g. EMA – DI crossover applied on BANKNIFTY DEC FUT 3 minute 10 day, results in:

    Total number of trades: 2
    Number of losing trades: 2
    Total loss: -528.5000
    Percent profit: 0%

    • algogeek says:

      As per the above regarding profit / loss it is calculated with values given in the summary.Also,for last trade it is difference of the closing price of the chart data and last signal in summary section. you can check it in detail in back-testing summary section.

  192. RIYAS says:

    back testing with my strategy showing buy sell signal properly and profitable trades but i applied the same strategy in scripted alert on live market it shows extra buy sell signals and trade end up in loss, why it happening how i can solve it.
    when am checking the graph after market back testing graph and live market graph not matching

    • siva says:

      Create scripted alerts refers with current running candle, as repainting of candle happens you may get some more/false signals, repainting happens in every charting platform, to avoid this you can refer to previous candle or trade on only after close of the candle.

  193. Srikanta Kumar Naik says:

    Sir, i need Supertrend code for expert advisor. Please give.

  194. Taneja says:

    Hi Nithin & Siva,

    Being marketing partner of Zerodha , I would like to help my referrals for algo trading however as per my experience , other than a good platform for trading i see lots of missing points which should be at one place in proper procedure. AS of now please help me to get these queries resolved

    1.) Full step-by-step procedure to do fully automatic trading. ( it would be using Pi , kite or separate terminal ? As after reading many post on Zconnect and FAQs and tradingqna , all is messed up ……. Dealer terminal is required, Amibroker plugin, Kite data and APIs……. Algo approval , Exact fee ? any fee for data or software ? for AP need to register for NSE/BSE separately ? , Can you please consolidate all at one palce and explain using what a trader can do with different products …for fully automatic trading

    2.) In Pi while testing out some strategies for backtesting , there are lots of stocks to select then how we can select multiple stocks in one run for a strategy . it’s very time consuming to select one by one and testing it out as we need to fine tune the strategy as well so it’ll take much more time !!

    3.) For a single stock we backtest and change the parameters in strategy to get good result buy there are lots of factors in backtest result report that I know their meaning (Definition) but don’t know their affect on performance , so it would be good if your expert team can provide more detailed explanation with examples which strategy should be considered good or bad with risk,reward, sharpe ratio and so on.

    4.) I feel for backtesting there should be more data as it would include all type of mkt data (uptrend, downtrend and sideways). Generally 4-5 months mkt would be in same trend then backtesting results are very favorable . Is it possible to backtest any strategy with Kite API with full historic data?

    5.) Do you have any plan to share other strategy to traders same like OpenTrade ?


    • 1. If a client is declaring that he is automating trades, he needs to become an AP on the exchange, get approvals for the strategy. Either Kite connect API’s or Pi bridge will work. If strategy involves BSE, then yeah that as well.
      2. If you are trying to do this for automation, suggest you try backtesting on Amibroker. Pi is just a good starting point.
      3. All the details of this is available on google. Lots of information on these ratios.
      4. Yes, you can use Kite API to backtest.
      5. Hmm.. no plans as such.

  195. vinod says:

    Sir, please add Supertrend code for expert advisor. so that it can be available for trading.

  196. NAVEEN SAROHA says:


  197. shashank shekher says:

    How to scan multiple stocks for supertrend crossovers and correspondingly generate alert on the pi screen?

  198. sandip says:

    hello sir, while creating tradescipt EA for backtesting what function to use for supertrend?
    I used ST,STR,SUPERTREND, but it was showing undefined function.

    Buy script:
    TREND(SUPERTREND(15, 5), 5) = UP

    Buy script:
    TREND(SUPERTREND(15, 5), 5) = DOWN.

  199. dipesh dadhich says:

    Hi sir,
    while trying backtesting in zerodha pi, i applied buy and sell code of EMA that shown above in the article and start backtest. Everything goes fine but the chart doesn’t show any buy and sell arrow. i tried backing on nifty dec future on one minute periodicity with 1 bar interval for 30 days.
    Please help me out on this as I’m eager to study backtesting.
    Thank you.

  200. mehathab says:

    how we use multi time-frames for same (one) script.
    and could I get ea for my own strategy
    thank you

    • Venu says:

      There’s no option to use multi time frames on a single chart. Also EA or tradescript works with OHLC values and timeframe cannot be set through code, one will have to change/set chart time frame manually.

  201. Nishanth K says:

    How to plot backtest chart? I can see one green and red arrow on the corner but nothing other than that. NO help document as well. My trade script generated at least 20 trades but i couldn’t see any single arrow out there.

  202. dipesh dadhich says:

    Hi sir,
    while trying backtesting in zerodha pi, i applied buy and sell code of EMA that shown above in the article and start backtest. Everything goes fine but the chart doesn’t show any buy and sell arrow. i tried backing on nifty dec future on one minute periodicity with 1 bar interval for 30 days.
    Please help me out on this as I’m eager to study backtesting.
    Thank you.

  203. Kiran says:

    Is there are strategy available for Renkos using EAs ? Renkos with PSAR or EMS crossover etc ?

  204. Arjun Singh says:

    I have a query, consider I have also coded the Exit Long and Exit Short script with the buy and sell script, will pi generate the exit trade button(signal) in the generated alert window? Or will it only generate buy and sell signal?

  205. Arjun Singh says:

    Suppose, an EA gave my buy signal and I placed the trade according to it. After some time the same EA gave me sell signal on the same instrument and I placed the sell order, at this time will the long trade be automatically closed by pi/EA or do I have to manually close it (after entering sell order).

  206. saurabh says:

    Started trading recently with Zerodha and satisfied with the platform and services. I am trying to backtest intraday MIS strategy with Pi but getting some weird results. The buy and sell occurs only when conditions are fulfilled but I want to exit on day end or some exit conditions (even exit long and exit short conditions seems to be fishy) . Can someone please help me with this.It would be great if some example with buy & sell script is provided.

  207. Arjun Singh says:

    Can I run multiple EA on multiple instruments at a single time, without opening their chart.

  208. Ganesh says:


    Can I get a code for setting up an alert system whereby:
    1) Price breaks the VWAP line (both upside & downside)
    2) MACD bullish and bearish crossovers


  209. dipesh dadhich says:

    Hi sir,
    while trying backtesting in zerodha pi, i applied buy and sell code of EMA that shown above in the article and start backtest. Everything goes fine but the chart doesn’t show any buy and sell arrow. i tried backing on nifty dec future on one minute periodicity with 1 bar interval for 30 days.
    Please help me out on this as I’m eager to study backtesting.
    Thank you.
    This is the 3rd time I’m asking this ques. please rply..

  210. Arjun Singh says:

    I have a query, the EA i wrote keeps giving me buy/sell signal again and again whenever a new candle forms and the condition is true, “even when I am already in trade and had placed an order”. How to stop this?

    • algogeek says:

      In EA alerts will be generated when the condition matches with LTP , the buy & sell signals also due to repainting of current candle, also verify your script and try to use it on close of the candle. you can post code related queries in tradingqna.com

  211. Ajay says:

    Is it possible to generate automatic trades using moving averages on Pi or other zerodha software.

Post a comment