v7: fix alertcondition to const strings; add optional dynamic alert() messages with parameters
This commit is contained in:
@@ -179,6 +179,16 @@ plotshape(finalShortSignal, title="Sell Signal", location=location.abovebar, col
|
||||
fill(plot(calcC, display=display.none), plot(upTrend, display=display.none), color=color.new(color.green, 90))
|
||||
fill(plot(calcC, display=display.none), plot(downTrend, display=display.none), color=color.new(color.red, 90))
|
||||
|
||||
// Alerts (set to Once per bar close)
|
||||
alertcondition(finalLongSignal, title="Bullmania v7 Buy", message="Buy {{ticker}} {{interval}} | Profile={{activeProfile}} ATR={{atrPeriod}} Mult={{multiplier}} | RSI TF=" + rsiTf + " <= " + str.tostring(rsiOversold))
|
||||
alertcondition(finalShortSignal, title="Bullmania v7 Sell", message="Sell {{ticker}} {{interval}} | Profile={{activeProfile}} ATR={{atrPeriod}} Mult={{multiplier}} | RSI TF=" + rsiTf + " >= " + str.tostring(rsiOverbought))
|
||||
// Alerts (set to Once per bar close) — message must be a const string
|
||||
alertcondition(finalLongSignal, title="Bullmania v7 Buy", message="Bullmania v7 Buy | RSI gate")
|
||||
alertcondition(finalShortSignal, title="Bullmania v7 Sell", message="Bullmania v7 Sell | RSI gate")
|
||||
|
||||
// Optional dynamic alert text for the "Any alert() function call" alert type
|
||||
useDynAlert = input.bool(true, "Dynamic alert text (Any alert() call)", group="Alerts", tooltip="Enable runtime alert() with detailed message. Use Alerts: 'Any alert() function call' and Once per bar close.")
|
||||
if barstate.isconfirmed and useDynAlert
|
||||
if finalLongSignal
|
||||
dynMsgL = "Buy " + syminfo.ticker + " " + timeframe.period + " | Profile=" + activeProfile + " ATR=" + str.tostring(atrPeriod) + " Mult=" + str.tostring(multiplier) + " | RSI TF=" + rsiTf + " <= " + str.tostring(rsiOversold)
|
||||
alert(dynMsgL, alert.freq_once_per_bar_close)
|
||||
if finalShortSignal
|
||||
dynMsgS = "Sell " + syminfo.ticker + " " + timeframe.period + " | Profile=" + activeProfile + " ATR=" + str.tostring(atrPeriod) + " Mult=" + str.tostring(multiplier) + " | RSI TF=" + rsiTf + " >= " + str.tostring(rsiOverbought)
|
||||
alert(dynMsgS, alert.freq_once_per_bar_close)
|
||||
|
||||
Reference in New Issue
Block a user