Please help with this code. It is coming up with errors
// Parameters
lookbackPeriod = 10
// Number of bars to look back for pivot highs and lows
// Variables to store pivot points
pivotHighPrice = 0
pivotLowPrice = 0
// Find Pivot High (downtrend)
for i = 1 to LookbackPeriod do
if high[i] > high[i+1] and high[i] > high[i-1] then
pivotHighPrice = high[i]
break
endif
next
// Find Pivot Low (uptrend)
for i = 1 to LookbackPeriod do
if low[i] < low[i+1] and low[i] < low[i-1] then
pivotLowPrice = low[i]
break
endif
next
// DeMark Trendline Logic
// For Uptrend: connecting pivot low to subsequent lower low
if pivotLowPrice= 0 then
lineUp =DRAWLINE(pivotLowPrice, Date[pivotLowBar], low, Date[0])
endif
// For Downtrend: connecting pivot high to subsequent higher high
if pivotHighPrice = 0 then
lineDown = DRAWLINE(pivotHighPrice, Date[pivotHighBar], high, Date[0])
endif
RETURN lineUp AS “DeMark Up Trendline”, lineDown AS “DeMark Down Trendline”