(2) Two Alerts
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © LeoTheMors

//@version=5
indicator(title='Two Alerts', shorttitle='2alerts', overlay=true)

inAlertPriceHigh = input.price(18000, 'AlertPriceHigh')
useAlertHigh = input.bool(false, 'useAlertHigh')
inAlertPriceLow = input.price(16000, 'AlertPriceLow')
useAlertLow = input.bool(false, 'useAlertLow')

plot(useAlertHigh  ? inAlertPriceHigh : na, color=color.new(color.green, 38), style=plot.style_linebr)
plot(useAlertLow  ? inAlertPriceLow : na, color=color.new(color.yellow, 38), style=plot.style_linebr)

if  (useAlertHigh and close > inAlertPriceHigh)
	alert('PriceBrokeAbove', alert.freq_once_per_bar)

if  (useAlertLow and close < inAlertPriceLow)
	alert('PriceBrokeBelow', alert.freq_once_per_bar)