Search code examples
pine-scriptpine-script-v5

How to get values of Heikin Ashi bar from a chart with candles bar?


I am using normal candles on my chart, but I want to make some calculations with Heikin Ashi bar. I would like to get the color of the previous day Heikin Ashi bar. Is that possible? Thanks


Solution

  • Tradingview user Allanster shared a open source multi timeframe(to access the daily data) heikin-ashi pinescript here:

    https://www.tradingview.com/script/HtNYMuBO-Heikin-Ashi-Source-Function/

    what you are looking for is in line 39:

    upBar = preEvalC > preEvalO
    

    boolean upBar indicates the green Heikin Ashi candle.