Buy Sell Signal Indicator

Best buy and sell indicator for TradingView: compare the rules

No buy/sell indicator is best for every market. Compare TradingView signal rules, repainting and delay, then test editable Pine Script on the same data.

Understanding Buy Sell Signal Indicator

A buy and sell indicator marks bars where its programmed conditions are met. A buy arrow can mean a long setup; a sell arrow may mean a short setup or an exit, depending on the script. No single indicator is best across all markets and timeframes. Start with rules you can inspect, choose when a signal becomes final, and compare candidates under the same entry, exit and cost assumptions.

Why It Matters

An arrow is not an executed trade or proof of an edge. A signal can remain fixed after the bar closes and still lose money. This guide compares simple rule families and provides editable examples, not a performance ranking. No comparative trading experiment was run for this page. The examples are educational and are not investment advice.

Choose a signal model by its rule and failure mode

The comparison below describes mechanics, not measured returns. Parameters change the behavior of every model. Compare a simple baseline before adding filters; fewer signals do not automatically mean better signals.

CandidateWhat creates a signalConfirmation and delayWhat to check in the same sample
EMA crossoverA fast EMA crosses a slower EMA.Smoothing delays some turns; a close-confirmed version waits for the bar to finish. There is no fixed bar-count delay.Count repeated crosses in sideways periods and late entries after large moves. Source access depends on the publication.
Supertrend direction changePrice causes an ATR-based trend band to change direction.ATR length, multiplier and bar-close confirmation affect timing.Count direction flips in ranges. Check which band price the script actually uses and whether its source is available.
Range breakoutPrice closes beyond a defined prior range.The lookback defines the range; confirmation waits until the breakout bar closes.Count breaks that return inside the range. Ensure the range excludes the current bar and does not use future bars.
EMA crossover with trend and volume filtersThe crossover also requires price on the matching side of a trend EMA and volume above a threshold.Filters can reject a crossover entirely rather than deliver it later.Count losing signals removed and winning signals missed. Missing volume blocks signals in the example below.

What a 100% accuracy claim leaves out

A historical sample can contain only winning trades, but that does not establish future accuracy. Ask what counts as a win, whether open losing positions are excluded, which dates were selected and whether costs are included. A high win rate alone says nothing about the size of losses.

  • Transparency: record the entry, exit, position sizing and reversal rules. Source code lets you inspect those rules; it does not prove profitability.
  • Repainting: distinguish a changing open-bar signal from a marker drawn back onto an earlier bar. Compare live records with the reloaded chart.
  • Future data: lookahead_on can leak future higher-timeframe values if the expression is not properly offset. The documented confirmed-HTF pattern combines a prior-bar expression with lookahead_on; lookahead_off alone is not a universal repainting fix.
  • Costs and selection: keep commissions, slippage, dates and chart type fixed. Reserve an untouched period instead of repeatedly optimizing the same sample.

Editable Pine Script v6 buy/sell indicator

This example requires an EMA crossover, agreement with a trend EMA, sufficient volume and a confirmed chart bar. Both alert methods use the same conditions as the arrows. The ATR dots are reference prices on signal bars, not trailing stops or orders. The code requests no other timeframe. Its EMA lines still update during an open bar; data-feed revisions can also change history. The default inputs are examples, not recommended settings.

Confirmed EMA signals with matching alertspinescript
//@version=6
indicator("Confirmed EMA Buy/Sell Example", overlay=true)

// --- Input Parameters ---
fastLength   = input.int(9, "Fast EMA Length", minval=1)
slowLength   = input.int(21, "Slow EMA Length", minval=1)
trendLength  = input.int(200, "Trend Filter EMA", minval=1)
atrPeriod    = input.int(14, "ATR Period", minval=1)
atrMult      = input.float(1.8, "ATR Stop Multiplier", minval=0.5, step=0.1)
volMult      = input.float(1.15, "Volume Spike Multiplier", minval=0.5, step=0.05)

// --- Mathematical Calculations ---
emaFast      = ta.ema(close, fastLength)
emaSlow      = ta.ema(close, slowLength)
emaMacro     = ta.ema(close, trendLength)
atrValue     = ta.atr(atrPeriod)
volAvg       = ta.sma(volume, 20)
volFilter    = volume > volAvg * volMult

// --- Trend and Crossover Logic ---
bullishCross = ta.crossover(emaFast, emaSlow)
bearishCross = ta.crossunder(emaFast, emaSlow)

bullishRegime = close > emaMacro
bearishRegime = close < emaMacro

// --- Confirmed Signal Triggers ---
// Finalize current-timeframe signals at bar close.
buySignal  = bullishCross and bullishRegime and volFilter and barstate.isconfirmed
sellSignal = bearishCross and bearishRegime and volFilter and barstate.isconfirmed

// --- Signal-bar ATR reference levels (not trailing stops) ---
var float longStop  = na
var float shortStop = na

if buySignal
    longStop := close - (atrValue * atrMult)
if sellSignal
    shortStop := close + (atrValue * atrMult)

// --- Visual Plotting ---
plot(emaFast, "Fast EMA", color=color.new(color.teal, 0), linewidth=2)
plot(emaSlow, "Slow EMA", color=color.new(color.orange, 0), linewidth=2)
plot(emaMacro, "Trend EMA", color=color.new(color.purple, 20), linewidth=2)

plotshape(buySignal, title="Buy Arrow", style=shape.triangleup,
          location=location.belowbar, color=color.green, size=size.small, text="BUY")
plotshape(sellSignal, title="Sell Arrow", style=shape.triangledown,
          location=location.abovebar, color=color.red, size=size.small, text="SELL")

plot(buySignal ? longStop : na, "Long ATR Reference", color=color.red, style=plot.style_circles, linewidth=2)
plot(sellSignal ? shortStop : na, "Short ATR Reference", color=color.red, style=plot.style_circles, linewidth=2)

// --- Native Bar-Close Alerts ---
if buySignal
    alert("BUY Signal Triggered: " + syminfo.ticker + " @ " + str.tostring(close), alert.freq_once_per_bar_close)
if sellSignal
    alert("SELL Signal Triggered: " + syminfo.ticker + " @ " + str.tostring(close), alert.freq_once_per_bar_close)

alertcondition(buySignal, "Buy Signal", "Confirmed buy signal on {{ticker}}")
alertcondition(sellSignal, "Sell Signal", "Confirmed sell signal on {{ticker}}")

Compare false signals on one unchanged data sample

Use the indicator above as a filtered candidate and a plain EMA crossover as the baseline. Freeze the exchange symbol, standard-candle timeframe, session, date range, script version and settings before reviewing outcomes. The worksheet below is a protocol, not a completed experiment.

MeasureCommon definition for both candidatesWhat to record
False signalFor a chosen horizon, for example five completed bars after a signal, classify a buy as false if the ending close is no higher than the signal close; reverse the test for a sell.False signals / all eligible signals. Exclude end-of-sample signals without a full horizon. This directional score is not a trade win rate.
Filter trade-offMatch every filtered signal to the baseline signal at the same timestamp.Baseline signals rejected, false signals removed and favorable signals missed. Keep overlapping observations in both groups or exclude them by the same rule.
Signal delayUse a common reference event, such as the unfiltered crossover, rather than a hindsight swing low.Timestamp difference for matched events; mark rejected events as absent, not delayed.
Trading outcomeApply the same order timing, exits, size and costs to both strategies.Trade count, net result, average win/loss, maximum drawdown and results on a separate holdout period.

Turn the signal rules into a strategy test

This strategy uses the indicator defaults with a fixed stop and target measured from each signal close. Commission of 0.06% and slippage of two ticks are illustrative settings to replace with your market assumptions. With default execution, an entry normally fills at the next bar open, so gaps alter the distance from the fill to the bracket. The strategy ignores signals in the current position direction; an opposite entry can reverse that position. These choices affect results independently of the arrows.

Evaluation strategy, not a published performance resultpinescript
//@version=6
strategy("EMA Buy/Sell Evaluation Example", overlay=true,
         initial_capital=10000,
         default_qty_type=strategy.percent_of_equity,
         default_qty_value=10,
         commission_type=strategy.commission.percent,
         commission_value=0.06,
         slippage=2)

// Default indicator settings; keep both scripts aligned when comparing.
fastEma  = ta.ema(close, 9)
slowEma  = ta.ema(close, 21)
trendEma = ta.ema(close, 200)
atrVal   = ta.atr(14)
volSma   = ta.sma(volume, 20)
volValid = volume > volSma * 1.15

bullishCross = ta.crossover(fastEma, slowEma)
bearishCross = ta.crossunder(fastEma, slowEma)
buyCond  = bullishCross and close > trendEma and volValid
sellCond = bearishCross and close < trendEma and volValid

// Orders are created at bar close and normally fill on the next available tick.
// Brackets use signal-bar prices, so gaps can change risk relative to the fill.
if buyCond and barstate.isconfirmed and strategy.position_size <= 0
    stopPrice   = close - (atrVal * 1.8)
    targetPrice = close + (atrVal * 2.7) // 1:1.5 distance ratio from the signal close
    strategy.entry("Long", strategy.long)
    strategy.exit("Exit Long", "Long", stop=stopPrice, limit=targetPrice)

if sellCond and barstate.isconfirmed and strategy.position_size >= 0
    stopPrice   = close + (atrVal * 1.8)
    targetPrice = close - (atrVal * 2.7)
    strategy.entry("Short", strategy.short)
    strategy.exit("Exit Short", "Short", stop=stopPrice, limit=targetPrice)

Set alerts and check live behavior

Add the indicator to the chart, open Create Alert, select the script, and choose Buy Signal or Sell Signal with Once Per Bar Close. Alternatively, choose Any alert() function call to use the coded messages. Use one route unless duplicate notifications are intentional. Recreate alerts after changing the script or inputs because running alerts retain a snapshot.

  • Observe live bars: record the symbol, timeframe, bar timestamp and alert message, then compare those signals after reloading the chart. Historical replay alone does not reconstruct every realtime update.
  • Check signal meaning: the example sell arrow is a bearish setup, not an instruction to close every long position. The strategy defines its own reversal and bracket rules.
  • Choose a use case: for intraday testing, examine session and volume behavior; for swing testing, examine overnight gaps and holding periods. Neither timeframe guarantees higher accuracy.
  • For free scripts, inspect the publication type and code before relying on the name. Paid access, source access and TradingView alert allowances are separate questions.

Using Pineify for Buy Sell Signal Indicator

Pineify Premium Scripts lists Signals & Overlays and includes Pine Script source code and tutorials. Source access is useful when you want to inspect a condition, change it, or build a strategy test from it. Review the current Premium Scripts collection for access details. The educational examples on this page are not the Signals & Overlays source and do not establish its performance.

Evaluation Workflow

Keep an unchanged copy of a script before editing it. Run the same-sample worksheet first, change one filter, and repeat the comparison with the same assumptions. Then evaluate the chosen version on a separate period and observe live alerts. Preserve the settings and trade export so another person can reproduce the comparison. A successful syntax check establishes compilation only, not trading accuracy.

Explore Pineify Premium Scripts

Review the available scripts, source access, and current purchase terms before choosing a tool.

See Pineify Premium Scripts

FAQ

Buy Sell Signal Indicator FAQs

Sources and verification

Last verified:

Educational information, not investment advice. Indicator settings and historical results do not guarantee future returns.