If you find my works useful, please consider a donation
In true TradingView spirit, the author of this script has published it open-source, so traders can understand and verify it. Cheers to the author! You may use it for free, but reuse of this code in a publication is governed by House Rules. You can favorite it to use it on a chart.
sellcondition = iff(not na(high), iff(highestbars(mb) == -lb, true, false), false)
buycondition = iff(not na(low), iff(lowestbars(mb) == -lb, true, false), false)
alertcondition(buycondition, title='Pivot HL Signal', message='Pivot HL Buy Signal')
alertcondition(sellcondition, title='Pivot HL Sell Signal', message='Pivot HL Sell Signal')