algozinitech

PEERTRADING WITH MOVING AVEREAGE

Peer Stocks Script Using TradingView
APIBridge, TradingView

You may want to optimize your entry conditions based on reference with peer stocks. For example, you may want to BUY HDFCBANK when the price of HDFC bank is in uptrend. Similarly when the price of ICICIBANK is also in uptrend. We will show you how to setup algo trading using such complex conditions, using a very simple strategy.

Peer Stocks Algo Strategy Logic
Entries will be taken only when Moving Average Crossover happens. Even though this tutorial uses Moving Average, you can use other indicators like SuperTrend, VWAP, RSI etc.

We will have a buy condition in current stock if candle crosses above moving average and the peer stock is bullish (peer stock is trading above moving average)

We will have a sell condition in current stock if candle crosses below moving average and peer stock is bearish (peer stock trading below moving average)

Explanation of logic with example: Say we have current stock as INFOSYS and peer stock as TCS. We may want to trade bullish if stock crosses above moving average. For that to we are also checking Peer TCS is in uptrend so that we filter our trades.
Open-source script

In true TradingView spirit, the author of this script has published it open-source, so traders can understand and verify it. Cheers to the author! You may use it for free, but reuse of this code in a publication is governed by House Rules. You can favorite it to use it on a chart.

Disclaimer

The information and publications are not meant to be, and do not constitute, financial, investment, trading, or other types of advice or recommendations supplied or endorsed by TradingView. Read more in the Terms of Use.

Want to use this script on a chart?