//@version=5
indicator("HeikenAshi", title="Study", overlay=false)
res = input("180", "Resolution", resolution)
o = request.security(syminfo.tickerid, res, open)
c = request.security(syminfo.tickerid, res, close)
h = request.security(syminfo.tickerid, res, low)
l = request.security(syminfo.tickerid, res, high)
long = c > o
short = c < o
last_long = long ? time : nz(last_long)
last_short = short ? time : nz(last_short)
long_signal = crossover(last_long, last_short)
short_signal = crossover(last_short, last_long)
plot(long_signal, "Long", color=color.green)
plot(short_signal, "Short", color=color.red)
indicator("HeikenAshi", title="Study", overlay=false)
res = input("180", "Resolution", resolution)
o = request.security(syminfo.tickerid, res, open)
c = request.security(syminfo.tickerid, res, close)
h = request.security(syminfo.tickerid, res, low)
l = request.security(syminfo.tickerid, res, high)
long = c > o
short = c < o
last_long = long ? time : nz(last_long)
last_short = short ? time : nz(last_short)
long_signal = crossover(last_long, last_short)
short_signal = crossover(last_short, last_long)
plot(long_signal, "Long", color=color.green)
plot(short_signal, "Short", color=color.red)