So the following code in Pine-script on TradingView uses the Heikin-Ashi candle-bar open
price instead of the actual real open in the strategy tester panel.
Is there a way to get the strategy tester to use the real price?
This link explains the issue further.
//@version=2
strategy("haup", overlay=true)
cci20 = cci(close, 20)
sma10 = sma(close, 10)
source = close
sourcea = open
haclose = (open + high + low + close) / 4
haopen = na(haopen[1]) ? (open + close) / 2 : (haopen[1] + haclose[1]) / 2
fromYear = year > 2016
toYear = year < 2019
longCondition = haopen < haclose
if (longCondition and fromYear and toYear)
strategy.entry("Long 1", strategy.long)
closeCondition = haopen > haclose
if (closeCondition)
strategy.close("Long 1")