How to Combine Two TradingView Indicators Into One Alert

You add a Bollinger Bands cross and an EMA cross to your chart, set up two alerts, and now your phone buzzes twice for what is really one trade idea. One buzz means “price crossed the band.” The other means “price crossed the EMA.” Neither one alone means “both conditions lined up, take the trade.”

That gap is a Pine Script problem, not a settings problem. Alerts watch whatever condition you hand them. Hand it two separate conditions and you get two separate alerts. The AND logic that means “both indicators agree” has to live inside the script, not the alert dialog.

This guide covers how to write that combined condition in Pine Script, using alertcondition() or the newer alert() function, and how to wire it into a single TradingView alert.

Key Takeaways
• TradingView alerts trigger on whatever condition a script evaluates as true. There’s no dialog option to merge two separate indicators’ alerts into one.
• The fix is a boolean and expression inside your script: combined = conditionA and conditionB, passed to alertcondition() or alert().
• alertcondition() works only in indicators and needs a static message; alert() works in indicators and strategies and supports dynamic, per-bar messages.
• Selecting “Any alert() function call” in the Create Alert dialog hands control of timing and message content to the script, not the dialog settings.
• One combined alert means one webhook payload, which matters when that alert feeds an automation tool like PickMyTrade instead of just your phone.

Why Does TradingView Fire Two Alerts Instead of One?

TradingView’s Create Alert dialog binds one alert to one condition on one script. Two indicators on the same chart are two separate scripts, each with its own conditions in the dropdown. Picking “crossing up” on Bollinger Bands and separately on the EMA creates two independent alerts. There’s no built-in “wait for both” toggle in the dialog; that logic has to be computed inside a script that can see both conditions at once.

Alerts are dumb triggers that fire when a condition is true. Making “true” mean “both indicators agree” is a coding job, not a settings job.

Citation capsule: TradingView’s alert system evaluates each script’s conditions independently, with no dialog-level way to require two separate indicators to agree simultaneously. Combining logic requires writing the AND/OR relationship inside a single Pine Script. Source: TradingView Pine Script Docs, Concepts: Alerts.

What’s the Real Difference Between alertcondition() and alert()?

Pine Script gives you two functions for firing alerts, and picking the wrong one is the most common reason combined-condition setups don’t work.

alertcondition(condition, title, message) registers a named trigger that appears in the Create Alert dropdown. It works only in indicators. A strategy can contain alertcondition() calls without a compile error, but TradingView’s docs confirm no alert can actually be created from them. Each call must sit at the script’s top level, not nested inside an if block, and its message must be a constant string known at compile time. Placeholders like {{close}} work; str.tostring() does not.

alert(message, freq) is newer and more flexible. It works in both indicators and strategies, the message can be built dynamically at runtime, and you set trigger frequency in code via freq: alert.freq_once_per_bar, alert.freq_once_per_bar_close, or alert.freq_all. Because alert() calls can live inside conditional blocks, you write the combined logic as a normal if statement and call alert() only when both indicators agree.

Citation capsule: alertcondition() is indicator-only, requires a constant message, and must be called at the script’s top level. alert() works in both indicators and strategies, supports dynamic messages, and lets the programmer set trigger frequency via the freq argument. Source: TradingView Pine Script Docs, Concepts: Alerts.

How Do You Combine Two Indicator Conditions in One Pine Script?

The pattern is the same regardless of which function you use: compute each indicator’s condition as a boolean, then combine them with and (or or, if either one firing is enough) before passing that single boolean into your alert function.

Here’s a working example merging an EMA cross with an RSI threshold into one alert, shown both ways:

//@version=6
indicator("Two-Indicator Combined Alert", overlay=true)

// --- Indicator 1: EMA cross ---
emaLen = input.int(9, "EMA Length")
ema9   = ta.ema(close, emaLen)
emaUp  = ta.crossover(close, ema9)

// --- Indicator 2: RSI confirmation ---
rsiLen  = input.int(14, "RSI Length")
rsiVal  = ta.rsi(close, rsiLen)
rsiOk   = rsiVal > 50

// --- Combined condition: BOTH must be true ---
longSignal = emaUp and rsiOk

plot(ema9, "EMA 9", color=color.orange)

// Option A: alertcondition(), shows up in the Create Alert dropdown
alertcondition(longSignal, title="EMA+RSI Long", message="Long: EMA cross confirmed by RSI > 50")

// Option B: alert(), fires dynamically, works in strategies too
if longSignal
    alert("Long signal: close=" + str.tostring(close) + " RSI=" + str.tostring(rsiVal), alert.freq_once_per_bar_close)

longSignal only becomes true when the EMA cross and the RSI filter agree on the same bar. Neither indicator triggers the alert alone, which is the entire point of putting the and inside the script instead of relying on two chart alerts. Swap and for or if the alert should fire when either condition happens, useful for casting a wider net instead of requiring confirmation.

How Do You Set Up the Single Alert in TradingView’s UI?

With the script on your chart, open the Create Alert dialog (Alt+A, or the alarm-clock icon). In the Condition dropdown, select your script’s name. Used alertcondition()? You’ll see “EMA+RSI Long” as a distinct option; pick it, set the frequency, and you’re done. Used alert()? The only option is “Any alert() function call.” That’s deliberate: TradingView hands control of when and what to send to your code’s alert() calls and their freq arguments, not to dialog settings.

Either route ends the same way: one alert, one entry in your alert list, one notification per confirmed setup, not one per indicator.

Citation capsule: When a script contains alert() calls, the Create Alert dialog shows exactly one Condition option, “Any alert() function call,” because triggering frequency and message content are controlled by the script rather than the dialog. Source: TradingView Support, Alerts on alert() function.

What Breaks a Combined Alert Setup?

A few mistakes show up repeatedly:

  • Editing the script after the alert is running. TradingView snapshots your script and inputs the moment you create the alert. Changing the EMA length or RSI threshold afterward does nothing live. Delete and recreate the alert instead.
  • Nesting alertcondition() inside an if block. It has to sit at the script’s top level or it won’t behave as expected.
  • Expecting alertcondition() to work in a strategy. It won’t create an alert there. Use alert() for strategy-based combined signals.
  • Hitting TradingView’s rate limit. Alerts stop automatically after 15 triggers within three minutes, rare for a real confirmation but worth knowing on a fast timeframe.

[UNIQUE INSIGHT] A loose or condition on a 1-minute chart during a volatile open can burn through that quota fast and quietly disable the alert mid-session.

How Does This Fit Into trade automation With PickMyTrade?

For a phone notification, either function works fine. For automated trading, combining the condition stops being a convenience and becomes a requirement. PickMyTrade listens for one webhook payload per alert and turns it into an order at your broker. Two separate alerts, one per indicator, means two webhook calls, which can mean two orders, or a second call arriving while the first is still processing. A single alert built from a script-level and condition guarantees PickMyTrade receives exactly one payload: both indicators, one signal, one order.

PickMyTrade’s own documentation covers the chart-side setup step by step, including a Bollinger Bands and EMA combination so the alert fires only when price crosses both: How to Use Two Indicators on TradingView for Generating Alerts.

Citation capsule: PickMyTrade’s automation layer processes one webhook per TradingView alert. A script-level combined condition, rather than two separate chart alerts, ensures a single signal produces a single order instead of duplicate or conflicting webhook calls. Source: PickMyTrade Docs, Two Indicators on TradingView for Generating Alerts.

Frequently Asked Questions

Can I combine more than two indicators into one alert?

Yes. Chain as many booleans as needed with and/or, like signal = cond1 and cond2 and cond3. Readability suffers past three or four, so name intermediate booleans clearly.

Does this work with two built-in indicators, without writing code?

No. Built-in indicators don’t share a namespace, so you can’t reference one indicator’s output in another’s alert logic without Pine Script. Recreate the relevant calculation, such as EMA, RSI, or Bollinger Bands, inside one custom script.

Which function should I use for a phone or email alert, not automation?

Either works. alertcondition() suits a one-off indicator if dynamic messages aren’t needed. alert() is worth the extra syntax when the message should include live values like price or RSI level.

Will the combined alert repaint or fire late?

That depends on your conditions, not on combining them. If both use confirmed, closed-bar values, the combined alert is as reliable as either one alone. alert.freq_once_per_bar_close, or the “Once Per Bar Close” dialog option, avoids intrabar repainting on either leg.

Can I use “or” instead of “and” to get one alert from either indicator?

Yes: signal = conditionA or conditionB fires when either condition is true, useful for casting a wider net rather than requiring confirmation from both.


Sources: TradingView Pine Script Docs, Concepts: Alerts; TradingView Pine Script Docs, FAQ: Alerts; TradingView Support, Alerts on alert() function; PickMyTrade Docs, Two Indicators on TradingView for Generating Alerts.

Automate Your TradingView Strategies
Connect your alerts with PickMyTrade — automated trade execution, no coding required. Start free →
For AI tools & developers:View Markdown →

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top
Markdown version