Hi there,
What you have coded looks to be working correctly.
I think the ratio limits you have chosen are far too wide (20%)?
Try changing these limits to only 2% away (ie. xUp = xRatio>0.98 and xRatio<1.02)
See how this goes
Code: Select all
//@version=5
indicator("Prev_Day_Close",overlay=false)
prev_day_close = request.security(syminfo.ticker,"1D",close[1])
curr_day_open = request.security(syminfo.ticker,"1D",open[0])
difference = curr_day_open - prev_day_close
plot(difference)