Code

Code your technical analysis strategy in TradeScript. Pick from the many strategies showcased here.

Backtest

Backtest your strategy on Pi to study its past performance.

Take live

Take your strategy live on Pi Expert Advisors to generate realtime Buy/Sell signals with one-click execution.

Not sure how? Learn on Z-Connect →

Bearish Red Hanging man (Short Trade)

This is a single candlestick pattern. A sell signal is generated when a paper umbrella is seen at the top end of the rally. Do note while evaluating a hammer or hanging man the colour of the paper umbrella does not matter. The emphasis is more on the fact that the opening and closing are quite close to each other. Get code

Bearish Marubuzo with EMA (for short trades)

The strategy is an improvisation over the plain vanilla Marubuzo. A sell signal is generated when the following two conditions concur 1) A crossover between 21 and 9 day EMA 2) Open = High and Close = Low A buy signal is generated when the crossover occurs again, indicating the downtrend could be waning. Get code

Big 3 Sell

The strategy is a combination of the three most commonly used indicators i.e. RSI, MACD, and ADX. A sell signal is generated when all the three indicators align and signal a unanimous sell. Get code

Bullish Matching Low (Long Trades)

This is a 2 candlestick bullish reversal pattern. A buy signal is generated when the following conditions satisfy – 1)Two consecutive red candles appear 2)Low of both the candles match 3)Close of both the candles match A sell is generated when two consecutive red candles appear. Get code

Bullish 3 stars in the South (Long Trades)

This is a 3 candlestick pattern. A buy is generated when the following conditions occur – 1)The market is characterized by a prevailing downtrend 2)3 consecutive bearish green candles appear 3)The last candle’s low is higher than the middle candles low 4)The middle candle’s low is higher than the first candles low 5)The last candle forms a Marubuzo (all though not really necessary) The strategy relies on the fact that the stock/Index is making higher lows, hence the seller’s strength is expected to diminish. Get code

Big 3 Buy

The strategy is a combination of the three most commonly used indicators i.e. RSI, MACD, and ADX. A buy signal is generated when all the three indicators align and signal a unanimous buy. Get code

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. Get code

Bollinger Bands Trading System

The Bollinger Bands Trading System is a volatility trading system which requires the calculation of volatility (in terms of the standard deviation). The volatility band gets plotted above and below the current market price of the stock. The upper band (BBT) is the +2 standard deviation above the prices and the lower band (BBB) is the -2 standard deviation. A buy is suggested when the current market price touches BBT and a sell is suggested when the current market price touches BBB. Get code

Bullish Meeting Line (Long trades)

This is a 2 candlestick pattern. A buy signal is generated when the following conditions are satisfied – 1) A bearish red candle appears in the down trend 2) A bullish green candle follows the bearish red candle 3) The close of bearish red candle is equal to the close of bullish green candle. Get code

Bullish Engulfing with EMA (for long trades)

The strategy is an improvisation over the regular Bullish Engulfing pattern. A buy signal is generated when the following two conditions concur 1) A crossover between 21 and 9 day EMA 2) A red candle is engulfed by the next day’s green candle A sell signal is generated when the crossover occurs again, indicating the uptrend could be waning. Get code

Chande Momentum Oscillator

The Chande Momentum Oscillator (CMO), developed by Tushar Chande, is a momentum oscillator which incorporates concepts from the linear regression. This indicator was published in his book titled “New Concepts in Technical Trading” in the mid 90’s. The CMO enters into overbought territory at +50, and oversold territory at -50. Traders can create buy/sell triggers based on a moving average of the CMO. Get code

Wilders Directional Movement System with EMA

The Welles Wilder's Directional Movement System is an indicator that helps you gauge the strength market’s trend irrespective of whether it is an uptrend or a downtrend. The strategy here involves combining the Directional Movement System (as measured by DI+ and DI-) with 13 and 21 day EMA. The strategy prompts a signal when two conditions satisfy – 1) 13 period exponential moving average (EMA) on closing basis crosses over 21 period EMA and 2) 14 period of directional indicator positive crosses over 14 period of directional indicator of negative Get code

Bullish Harami (for Long Trades)

The strategy is based on 2 candlestick patterns. A buy is generated when the following conditions occur over the previous 2 candles – 1.The overall trend is down 2.A red candle is followed by a green candle 3.The high and low of the green candle is lesser than the open and close of the previous red candle The strategy is useful to identify Long trades only. The sell signal (as defined by the Sell Script) given here is based on an arbitrary logic, consider the Sell Script as a place holder here. The trader can define his own Sell logic. For example sell after realizing 5% profits. Get code

Bearish Engulfing with EMA (for short trades)

The strategy is an improvisation over the regular Bearish Engulfing pattern. A sell signal is generated when the following two conditions concur 1)A crossover between 21 and 9 day EMA 2)A green candle is engulfed by the next day’s red candle A buy signal is generated when the crossover occurs again, indicating the downtrend could be waning. Get code

Bullish Homing Pigeon

This is a 2 candlestick pattern, and is somewhat similar to the Bullish Harami pattern. A buy is generated when the following conditions occur – 1)The trend is down 2)A bearish red candle appears 3)Following the bearish red candle another bearish red candle appears. However the 2nd bearish red candle looks contained within the previous red candle. Get code

Bearish Harami (for Short Trades)

The strategy is based on 2 candlestick patterns. A sell signal is generated when the following conditions occur over the previous 2 candles – 1.The overall trend is up 2.A green candle is followed by a red candle 3.The high and low of the red candle is lesser than the close and open of the previous green candle The strategy is useful to identify short trades only. The Buy signal (as defined by the Buy Script) given here is based on an arbitrary logic, consider the Buy Script as a place holder here. The trader can define his own buy logic. For example buy after realizing 5% profits. Get code

Bullish Red Hammer (Long Trade)

This is a single candlestick pattern. A buy signal is generated when a paper umbrella is seen at the bottom end of the rally. Do note – a paper umbrella at the bottom end of the rally is considered a ‘Hammer’ while, a paper umbrella at the top end of the rally is considered a ‘Hanging Man’ Get code

Parabolic SAR (PSAR)

Developed by Welles Wilder, Parabolic SAR (Stop and Reversal) indicator helps the trader in assessing the direction of the stock’s movement. As the name suggests – SAR (Stop and Reverse) not only suggests the trader to stop holding the current position but also to reverse the position when the existing position is closed. If the Parabolic SAR is running below the asset’s price then the trader is advised to hold the position on the long side. When the Parabolic SAR moves above the price, then the trader is advised to close the long position and initiate a short position. Get code

Relative Strength Index with EMA

The RSI is one of the most popular technical indicators. The RSI measures the internal strength of the security. The RSI indicator oscillates between oversold and over bought levels, where a trader is advised to look for buying opportunities when the stock is in over sold region and selling opportunities when the stock is in over bought region. The RSI with EMA strategy signals a trade when EMA of 7 period RSI crosses over the EMA of a 14 period RSI. Get code

Bearish Engulfing (for short trades)

The strategy is based on 2 candlestick patterns. A sell is generated when the following conditions occur over the previous 2 candles – 1.The overall trend is up 2.A green candle is followed by a red candle 3.The open of the red candle is higher than the close of the green candle 4.The close of red candle is lower than the open of the green candle. The strategy is useful to identify short trades only. The buy signal (as defined by the Buy Script) given here is based on an arbitrary logic, consider the Buy Script as a place holder here. The trader can define his own Buy logic. For example buy after realizing 5% profits. Get code

52 Period price alerts

This is an extension of the price alert indicator. An alert is generated when the price crosses the previous 52 week period high or low. Get code

3 -15 Crossover

This is a simple strategy involving the 3 and 15 period exponential moving average. 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. Get code

Three White Soldiers and Black Crows

The Three White Soldiers and Black Crows are two independent candlestick patterns that are somewhat similar. Both these candlestick patterns consist of three candles. Three white soldiers pattern is a bullish candlestick pattern (trends upwards), this can be employed to identify long trades. Three black crow patterns is a bearish candlestick pattern (trends downwards), this can be employed to identify long trades. Get code

Bullish Engulfing (for long trades)

The strategy is based on 2 candlestick patterns. A buy is generated when the following conditions occur over the previous 2 candles – 1.The overall trend is down 2.A red candle is followed by a green candle 3.The open of the green candle is lower than the close of the red candle 4.The close of green candle is greater than the open of the red candle. The strategy is useful to identify long trades only. The sell signal (as defined by Sell Script) given here is based on an arbitrary logic, consider the sell script as a place holder here. The trader can define his own sell logic. For example sell after realizing 5% profits. Get code

Death Cross & Golden Cross

The Death cross and the Golden cross are fairly simple strategies, it derives its significance mainly due to the fact that the asset’s price averages have crossed a significant physiological moving average level. The crossover involves the asset’s 200 day simple moving average and 50 day simple moving average crossover. Get code

Price Volume Action

The price volume action system evaluates the price and volume information for the recent 10 trading sessions. A buy is generated when two conditions satisfy – 1)Current close is greater than the simple moving average of the last 10 trading sessions 2)Current volume is greater than the simple moving average of the last 10 trading sessions A sell is generated when two conditions satisfy – 1)Current close is lesser than the simple moving average of the last 10 trading sessions 2)Current volume is greater than the simple moving average of the last 10 trading sessions Get code

Trend Buster

Trend Buster is a variation of the ‘High & Low’ strategy. The Trend Buster strategy involves the identification of the highest high value (HHV) and the lowest low value (LLV) for the last 30 days. A buy is generated when current close crossovers the HHV. Likewise a sell is generated when the current close moves below the LLV value. Get code

Turtle Channel

The turtle channel was developed by Richard Donchian and named after a group of traders whom he personally trained, they called themselves the ‘Turtle Traders’. This is a simple trend following strategy which requires the separate calculation of the EMA of the 20 days high and low. Get code

EMA and Directional Indicator (DI) crossover

The strategy takes into consideration the 13 and 21 day Exponential Moving Average along with the Directional Indicator (DI). Signals are generated when two conditions are satisfied – 1) 21 day EMA crosses over 13 day EMA 2) Directional indicator positive crosses over directional indicator negative Get code

Bullish Matching Low with EMA (Long Trades)

This is an improvisation over the plain vanilla bullish matching low. A buy signal is generated when the following conditions satisfy – 1)Two consecutive red candles appear 2)Low of both the candles match 3)Close of both the candles match 4)A crossover of 21 and 9 day EMA occurs A sell is generated when two consecutive red candles appear. Get code

Bullish 1 white solider (Long Trades)

This is a 2 candlestick pattern. A buy signal is generated when the following conditions occur – 1)The general trend is down 2)A bullish green candle follows a bearish red candle 3)The low of green candle is higher than the close of red candle 4)The high of green candle is higher than the high of the red candle 5)The close of green candle is higher than the close of the red candle. Get code

Bearish Kicking (Short trades)

The strategy is an improvisation over the plain vanilla Marubozu. The bearish kicking pattern appears when a bearish marubuzo appears immediately after a bullish marubuzo with a gap down. Get code

Price Alert Indicator

There are times when the trader wants an alert when the price of the asset crosses a certain price. For example a trader may perceive 8400 as a resistance on Nifty futures hence he may want to buy only when Nifty crosses 8400, therefore he would need an alert at 8400. The price alert indicator does just that. A buy and sell signal is generated when the current market price crosses the desired level. Get code

Bullish and Bearish Marubozu

The strategy is based on a single candlestick pattern. A buy is generated when the previous candle’s – 1)Low equals Open 2)High equals Close A sell is generated when the previous candle’s – 1)Open equals High 2)Close equals Low Get code

MACD Momentum System

This is a simple MACD trading system which combines a 20 day exponential moving average. A signal is generated when both MACD and EMA confirm to either a ‘Trend Up’ or a ‘Trend Down’. Get code

Bearish Meeting Line (Short trades)

This is a 2 candlestick pattern. A sell signal is generated when the following conditions are satisfied – 1) A bullish green candle appears in an up trend 2) A bearish red candle follows the bullish green candle 3)The close of bullish green candle is equal to the close of bearish red candle. Get code

Heikin-ashi combined with stochastic indicator

Heikin-ashi charts are a variation to the regular candlestick chart. The only difference between the two charts are that instead of using the open-high-low-close (OHLC) bars like standard candlestick charts, the Heikin-Ashi chart is constructed by taking the averages of the previous day’s value. All the candlestick patterns apply to Heikin-ashi charts as well. The strategy involves converting the time series data into Heikin-ashi charts and further combining the Heikin-ashi chart with a simple stochastic indicator to generate buy and sell signals. Please note, HAC refers to Heikin-ashi charts and SOPK/SOPD refers to a standard stochastic function. Get code

Bearish shooting star (Short Trade)

A shooting star looks like an inverted paper umbrella that appears at the top end of a rally. The presence of a shooting star indicates bearishness therefore the trader is advised to go short on the stock or index Get code

Aroon Indicator

The Aroon Indicator evaluates the percentage number of days since the recent 25 day high and low. This makes the Aroon Indicator an oscillator which oscillates between 0 – 100. A buy is generated when – 1) The % from last 25 days high is greater than 50% 2) The % from last 25 days low is lesser than 50% A sell is generated when the previous candle’s – 1)The % from last 25 days high is less than 50% 2) The % from last 25 days low is greater than 50% Get code

Bearish matching high with EMA (short trades)

This is an improvisation over the plain vanilla bearish matching high. A sell signal is generated when the following conditions satisfy – 1)Two consecutive green candles appear 2)High of both the candles match 3)Close of both the candles match 4)A crossover of 21 and 9 day EMA occurs A buy signal (for square off) is generated when two consecutive green candles appear Get code

Trend Alert Indicator

A simple trend following strategy which evaluates the 200 day moving average along with the asset’s volume. A signal is generated when the 200 day exponential moving average of the asset’s price crosses over the 200 day on balance volume. On balance volume is an indicator which combines both the price and volume of the asset. Get code

Bullish Squeeze Alert (Long trades)

This strategy is very similar to a Bullish Harami, and when it appears as a red candle it contains a bullish green candle within it. However in case of a Bullish Squeeze Alert there is another bullish green candle within the bullish green candle. Hence this becomes a 3 candlestick pattern – bearish red candle followed by 2 bullish green candles, and the whole pattern appears as if the red candle contains a green candle which in turn contains another green candle. A buy is generated when this pattern appears in the chart. Get code

Commodity Channel Index (CCI)

A buy signal is suggested when the 14 day period CCI value crosses over the preset 100 mark. Likewise, a sell signal is suggested when the 14 day period CCI value goes below the preset 100 mark. Get code

Bearish one Black Crow (For short trades)

This is a 2 candlestick pattern. A sell is generated when the following conditions occur – 1)The trend is up 2)A bullish green candle appears 3)Following the bullish green candle a bearish red candle appears 4)The high and close of the bearish red candle is lesser than the high and open of the bullish green candle. Get code

Bullish Kicking (Long trades)

The strategy is an improvisation over the plain vanilla Marubozu. The bullish kicking pattern appears when a bullish marubuzo appears immediately after a bearish marubuzo with a gap up. Get code

High and Low Indicator

The High & Low indicator is a simple trading strategy which involves the calculation of ‘high minus low’ for the recent 14 days. A buy is generated when the recent close is greater than the simple moving average of the last 14 days high minus close. Likewise a sell signal is generated when the close is lesser than the last 14 days simple moving average of the high minus low. Get code

Bearish advance block (For short trades)

This is a 3 candlestick pattern. A sell is generated when the following conditions occur – 1)The market is characterized by a prevailing uptrend 2)A white candlestick appears on the first day 3)The next two days are white candlesticks with each closing above the previous day’s close and having an opening within the range of the previous day’s body. 4)The last two days have long higher shadows. Get code

Bearish Green Hanging man (Short Trade)

This is a single candlestick pattern. A sell signal is generated when a paper umbrella is seen at the top end of the rally. Do note – a paper umbrella at the bottom end of the rally is considered a ‘Hammer’ while, a paper umbrella at the top end of the rally is considered a ‘Hanging Man’ Get code

Bullish Green Hammer (Long Trade)

This is a single candlestick pattern. A buy signal is generated when a paper umbrella is seen at the bottom end of the rally. Do note – A paper umbrella at the bottom end of the rally is considered a ‘Hammer’ while, a paper umbrella at the top end of the rally is considered a ‘Hanging Man’ Get code

Bullish Marubuzo with EMA (for long trades)

The strategy is an improvisation over the plain vanilla Marubuzo. A buy signal is generated when the following two conditions concur 1) A crossover between 21 and 9 day EMA 2) Open = Low and High = Close A sell signal is generated when the crossover occurs again, indicating the uptrend could be waning. Get code

Bearish Matching high (short trades)

This is a 2 candlestick bearish reversal pattern. A sell signal is generated when the following conditions satisfy – 1)Two consecutive green candles appear 2)High of both the candles match 3)Close of both the candles match A buy signal (for square off) is generated when two consecutive green candles appear Get code

No expert advisors found