Most popular Expert Advisors for Zerodha Pi

Zerodha is an Indian discount broker gaining massive popularity in last few years. It is known for its innovative trading platforms and customer centric business model. Pi is an electronic trading platform offered from Zerodha which allows you to code and backtest your strategies, and also place the order to exchange. It’s distinguished itself through its rich look and feel as well as myriad of unique features. Read our review on Pi trading platform here. Through Pi, Zerodha has also introduced expert advisors feature for Indian stock market. Expert Advisors are nothing but computerized programs which spots and signals the most probable trading opportunities. They are similar to Amibroker AFL’s but are very simpler than that. Expert Advisors are written using Tradescript programming language. This language is very useful for traders who don’t know programming and looking for an initial thrust to start writing their own algorithmic codes. Through expert advisors you can also backtest your trading system on the past data to find the most efficient setup. The idea behind this article is to go through some of the most popular expert advisors for Zerodha Pi. These EA’s have been complied from different sources and tested on variety of securities and markets.

Zerodha Pi Expert Advisors: Video Tutorial

Here is the video tutorial for Zerodha Pi Expert Advisors from their official youtube channel

Most popular Expert Advisors for Zerodha Pi

Below are some of the most popular expert advisors for Zerodha Pi. We highly recommend to do paper trading before applying these strategies in live market.

3-15 EMA Crossover

It is a trend following strategy which generates trades when crossover happens between fast moving average and slow moving average. Though it is very simple, yet it generates some very profitable trades. A buy signal is generated when the 3 period exponential moving average crosses the 15 period moving average. Likewise a sell in generated when the 15 period exponential moving average crosses the 3 period moving average.

//Buy Script

//Sell Script

MACD Momentum System

This strategy uses the combination of MACD and EMA to find the prevailing trend of stock. Buy signal is generated when both MACD and EMA confirms uptrend, while Sell signal is generated when on vice versa

//Buy Script
TREND(MACD(13, 26, 9, SIMPLE), 5) = UP

//Sell Script
TREND(MACD(13, 26, 9, SIMPLE), 5) = DOWN

RSI and ADX Trading strategy

This strategy uses RSI and ADX combination to find Buy/Sell opportunities. As a general rule, when RSI crosses an upper limit it indicates a Sell signal, while if it crosses lower limit it indicates Buy signal. But in this strategy, we are going to do the opposite i.e. Buy when RSI crosses upper limit and Sell when RSI crosses lower limit. ADX would be used as a trend identifier while taking Buy/Sell decisions. This strategy is very profitable in 1 minute timeframe for Nifty futures. Read the detailed backtest report here.

//Buy Script
RSI(CLOSE, 17) >= 75 AND 
ADX(14) > 25 

//Sell Script
RSI(CLOSE, 17) <= 25 AND 
ADX(14) > 25

MACD and RSI Trading system

This strategy generates Buy signal when MACDSignal crosses over MACD and RSI is greater than 30. While it generates Sell signal when MACD crosses over MACDSignal and RSI is less than 70.

//Buy Script
SET A = MACDSignal(12, 26, 10, SIMPLE)
SET B = MACD(13, 26, 9, SIMPLE)

//Sell Script
SET A = MACDSignal(13, 26, 9, SIMPLE)
SET B = MACD(12, 26, 10, SIMPLE)

Ichimoku Cloud Trading Strategy

The Ichimoku Cloud Trading Strategy involves calculating a set of averages and comparing them with the current market price to identify the trading signals. The indicator is slightly complex since it involves multiple averages. The expert advisor makes the necessary calculation as per the Ichimoku Cloud and translates the same into a buy or sell signal.

//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

Compiled Download Link

Please see the below link to download most popular expert advisors for Zerodha Pi. Please apply it in your Pi terminal and backtest on your favorite securities. Let us know in comments section if you face any issues.

Related Posts


  1. Excellent Article, Wanted to ask if an Afl Code can be added to EXPERT ADVISOR.?

    and can we automate the trade on a specific EXPERT ADVISOR?

    • Hi Harshit,
      No, we cannot add AFL code to expert advisor. And even complete automation is not allowed as per exchange rules.

  2. Admin
    Can you please provide me solution related to Amibroker.
    I have database of BSE scrips and managed to get their full name and same added to Amibroker symbols. When I go through the symbols it displays the BSE code along with its Full name but when i carry out backtest it just display BSE code only. Is there any way so that I can get full name along with code in backtest/scanner/explorer results?
    Kindly help.

  3. Please create a script for ORB and DBB or guide how can i create one.

  4. Intraday Open High Low Trading System can i use this option in trade script language as expert advisor if yes please suggest me the programming languade

  5. Hi,
    Some of the scripts do not produce any buy or sell signal.
    Whereas I can it in the chart. For example “RSI and ADX Trading strategy” is straightforward and simple. Still it does not work.
    //Buy Script:
    RSI(CLOSE, 17) >= 75 AND ADX(14) > 25
    //Sell Script
    RSI(CLOSE, 17) 25

  6. Hi , nice article but can u code some strategy using multiple timeframe here ?

    • Hi Chandra,

      Its not possible currently. Please check Amibroker for multi-timeframe coding.

Leave a Reply

Your email address will not be published.