Pine Script Entry And Close On Same Bar Causing Error Uncaught Error

Pine Script Entry And Close On Same Bar Causing Error Uncaught Error