Please help. Indicator not working

let lastLow = null;
let lastHigh = null;

function onData(data) {
if (!lastLow) {
lastLow = data.low;
lastHigh = data.high;
return;
}

if (data.low > lastLow) {
chart.setBackgroundColor(“green”);
} else if (data.high < lastHigh) {
chart.setBackgroundColor(“red”);
}

lastLow = data.low;
lastHigh = data.high;
}