9911939149 support@algoji.com

Heikin-Ashi Algo Trading using TradingView

The Heiken Ashi is a charting technique that can be used to read price action and understand the strength of the trend. This is similar to the traditional candlestick charts. Unlike the candlestick chart, the Heiken Ashi chart is attempting to filter out some of the market noise in an effort to better seize the market trend. Simply put, Heiken Ashi is a different way of displaying the price on our charts.

The heikinashi values are generated with a mathematical formula considering some of the previous candles values. There are two primary trade signals we can identify through the Heiken Ashi candlestick:

  • Bullish candlesticks have no wicks or very small wicks. They indicate a strong uptrend and excellent buying opportunities.
  • Small candlesticks are characterized by a small body, big upper, and lower wicks. They signal a potential reversal.

Heikin ashi is better for price action however optimum results can be obtained by using some filters like ema, rsi, volume,etc. We will demonstrate the steps to automate simple heikin-ashi strategy.

Limitations on Heikin ashi traditional charts:

  • Trading view free/pro users cant access HA charts for intraday
  • It shows wrong back testing results. When any strategy is applied on Heikin ashi  it would show best profit curve but that’s unreal because heikin ashi has so much of variation from real market price
  • It actually has chance to mislead people that heikin ashi is best always

We are going to setup an alternative heikin ashi strategy which can be applied on normal candlestick charts.

Advantages of heikin ashi strategy with normal candles over traditional:

  • The price is related to real markets and logic is related to renko block building this strategy will reduce slippages when applied on real markets
  • Trading view free users /pro users who cannot access renko charts can use this to apply renko on normal charts

Strategy Rules

Bullish trend : Bullish trade when there is a cross over with heikin ashi candle and ema +2 consecutive heikinashi bullish candles and ride the trend till stop loss is hit or trend is reversed
Bearish trend: Bearish trade when there is cross under of heikinashi value and ema + two consecutive bearish candles and ride the trend till stop loss is hit or trend is reversed

Step 1: Download the pinescript code from here.

STEP 2: Open desired chart  in trading view with normal candlestick ,select desired timeframe of the chart. Go to pine editor section , remove the default code , paste the downloaded code,save the file and add to chart.

STEP 3: Once strategy is applied on chart, click on settings to optimize parameters for your own trading.

  • Moving average type(MATYPE): Simple moving average (SMA) , Exponential moving average(EMA)
  • Moving average length(MA LENGTH): length of moving average
  • Moving average Source: source used  for moving average calculation
  • Trade intraday: check this option to make all trades based on intraday session
  • INTRADAY SESSION: this will be trade session for intraday( works only if the previous option is checked)
  • USE STOPLOSS : check this to use stoplos
  • STOP LOSS: loss amount specified in Rupees (works only if the previous option is checked) Trade Quantity: Custom Trade quantity

STEP 4: Settings Alerts for Auto Trading with APIBridge. Just paste {{strategy.order.comment}} in alert window. That’s all, you are ready to trade!

Do you want coding help to deploy your own strategy for live trading? Check our coding assistance.