Is it possible to use an "ON/OFF" boolean input like
AlertsOnOff = input (title="Alerts ON/OFF", type=input.bool, defval=false)
To conditionally have alert like
alert("This is an Alert Message", alert.freq_once_per_bar_close)
activated or de-activated(default) in a Tradingview strategy
Yes. See here in their blog post about alerts with dynamic messages.
It details that it is appropriate to use different alerts within if
blocks. So you could easily do
AlertsOnOff = input (title="Alerts ON/OFF", type=input.bool, defval=false)
if AlertsOnOff
alert("This is an Alert Message", alert.freq_once_per_bar_close)
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.