Converted the script to Pine Script version 6 syntax. Replaced outdated functions like pivothigh and pivotlow with ta.pivothigh and ta.pivotlow. Updated the input and plot methods to match version 6 standards. Fixed any syntax issues related to brackets or line continuation. Let me know if this works or needs further refinements!