I am trying to identify candle which crosses TC or BC of CPR but the code is not giving correct result. I can see the TC and BC values are correct but the candle which is suppose to cross the TC or BC is not shown. Any help appreciated
strategy("CPR Strategy",overlay=true)
//study("Simple label", "", true)
wLow = security(syminfo.tickerid, 'W', low)
wClose = security(syminfo.tickerid, 'W', close)
wHigh = security(syminfo.tickerid, 'W', high)
wPivot = (wHigh + wClose + wLow)/3
wBC = (wHigh + wLow)/2
wTC = (wPivot - wBC) + wPivot
if wTC < wBC
wTC :=(wHigh + wLow)/2
wBC := (wPivot - wBC) + wPivot
plot(wBC,"CPR BC",color=color.green)
plot(wTC,"CPR TC",color=color.orange)
if high >= wBC and close <= wBC and open < close
strategy.entry("Sell", strategy.short)
if high <= wTC and close >= wTC
strategy.entry("SBuy", strategy.long)