Skip to content

52-Week High Breakout Scanner + TradingView Workflow

NiftyTechFinds — 52-Week High Breakout Scanner & TradingView Guide
NiftyTechFinds Trading Guide

WordPress-safe version: styling is isolated so your site theme does not hide the guide text.

52-Week High Breakout Scanner + TradingView Workflow

Use Chartink to narrow the Nifty 500 universe, then use TradingView to inspect the setup, calculate position size and manage the trade. This guide removes promotional/affiliate-style material and keeps the practical workflow.

Nifty 500
Scanner universe in the supplied Chartink logic.
1.5×
Minimum current volume versus 50-day average.
3:1
Target framework at 3× ATR, before actual trade costs.
Educational use: This is a technical-analysis workflow, not personalized investment advice. A scanner result is a candidate for review, not an automatic buy signal. Check the live chart, liquidity, corporate actions, news, market conditions and your own risk limits before trading.

1. Chartink: Find the breakout candidates

Chartink’s Custom Scan page supports filters for indicators, stock attributes, offsets, comparisons and grouped conditions. The supplied scan is designed to look for liquid Nifty 500 stocks that are above their moving averages and breaking a recent multi-month high. citeturn483021search13turn483021search6

1

Open the scanner

Open Chartink → Screener → Custom Scan. Paste the complete scan block below into the scan editor. The current Chartink Custom Scan interface exposes indicator/formula inputs and fields such as Close, Volume, SMA and Max. citeturn483021search13

2

Paste the complete code

Use the whole block. Do not remove individual and conditions unless you intentionally want to change the strategy.

Chartink scanner code
( {nifty500} )
and ( latest close > 50 )
and ( latest sma( volume, 20 ) * latest close >= 50000000 )
and ( latest close > latest sma( close, 50 ) )
and ( latest close > latest sma( close, 200 ) )
and ( latest sma( close, 50 ) > 5 days ago sma( close, 50 ) )
and ( latest sma( close, 200 ) > 5 days ago sma( close, 200 ) )
and ( latest volume >= 1.5 * latest sma( volume, 50 ) )
and ( latest close >= 1 day ago max( 250, 1 day ago high ) )
and ( 1 day ago close < 1 day ago max( 250, 1 day ago high ) )
and ( latest atr( 14 ) >= latest close * 0.015 )
and ( latest atr( 14 ) <= latest close * 0.05 )

What each filter is doing

FilterPurpose
Nifty 500Limits the scan to the supplied Nifty 500 universe.
Close > ₹50Removes very low-priced shares from the candidate list.
20D average volume × price ≥ ₹5 croreUses traded-value style liquidity screening.
Close > 50 DMARequires medium-term price strength.
Close > 200 DMARequires the price to remain above the long-term average.
50 DMA rising50 DMA is higher than it was five trading days earlier.
200 DMA rising200 DMA is higher than it was five trading days earlier.
Volume ≥ 1.5 × 50D averageLooks for a meaningful volume expansion.
Fresh breakoutToday’s close is at/above the prior reference high while yesterday’s close was below it.
ATR 1.5%–5%Filters for a moderate amount of daily movement.
Important: Run the scan after the market session used by your process has closed, so the daily candle and volume are final. The original material specified after 3:30 PM; treat that as the source workflow rather than a universal market rule.
3

Review the result list

Do not trade every result. Open the strongest candidates one by one in TradingView and continue with the validation steps below.

2. TradingView: Apply the Pine Script

TradingView’s Pine Editor is used to create, edit and test scripts. Current TradingView documentation says you can open the Pine Editor from the chart and create a new indicator from the editor’s Open menu. citeturn483021search0turn483021search1

1

Open the candidate stock

Open the same stock on TradingView. Use the daily timeframe when following the daily breakout workflow.

2

Open Pine Editor

Open the Pine editor from the chart. Choose New indicator, delete the template code and paste the complete script below. citeturn483021search0turn483021search1

3

Save and add to chart

Save the script, then use Add to chart. TradingView documents both saving and adding the current script to a chart from Pine Editor. citeturn483021search1

TradingView Pine Script v6
//@version=6
indicator("NiftyTechFinds — Fresh 52wk Breakout", overlay=true, max_bars_back=500)

// === INPUTS ===
capital = input.float(200000, "Your Capital (Rs)")
risk_pct = input.float(1.0, "Risk % per trade") / 100
atr_len = input.int(14, "ATR Length")

// === INDICATORS ===
atr = ta.atr(atr_len)
sma50 = ta.sma(close, 50)
sma200 = ta.sma(close, 200)
ema10 = ta.ema(close, 10)
vol_50 = ta.sma(volume, 50)
high_52 = ta.highest(high, 252)

// === CONDITIONS ===
trend_ok = close > sma200 and close > sma50 and sma50 > sma200
fresh_break = close >= high_52[1] and close[1] < high_52[1]
vol_ok = volume >= vol_50 * 1.5
move_ok = close > close[1] * 1.005
liq_ok = volume * close > 50000000
price_ok = close > 50

breakout = trend_ok and fresh_break and vol_ok and move_ok and liq_ok and price_ok

// === LEVELS ===
entry = close * 1.001
candle_low = low
swing_low = ta.lowest(low, 5)
sl = math.max(candle_low, swing_low) * 0.995

sl_dist = entry - sl
sl_pct = sl_dist / entry * 100

t1 = entry + 1.5 * atr
t2 = entry + 3.0 * atr

rr = sl_dist > 0 ? (t1 - entry) / sl_dist : 0
rr2 = sl_dist > 0 ? (t2 - entry) / sl_dist : 0

qty = sl_dist > 0 ? math.floor((capital * risk_pct) / sl_dist) : 0
qty_half = math.floor(qty / 2)

// === PLOTS ===
plot(sma50, "50 DMA", color=color.blue, linewidth=1)
plot(sma200, "200 DMA", color=color.red, linewidth=2)
plot(ema10, "10 EMA", color=color.orange, linewidth=1)

// === SIGNAL ===
plotshape(breakout, title="Fresh 52wk Breakout", location=location.belowbar,
     style=shape.triangleup, color=color.new(color.green, 0), size=size.normal, text="BREAK")

// === DRAW LEVELS ON SIGNAL ===
if breakout
    line.new(bar_index, sl, bar_index + 15, sl, color=color.red, width=2, style=line.style_dashed)
    line.new(bar_index, t1, bar_index + 15, t1, color=color.green, width=2, style=line.style_dashed)
    line.new(bar_index, t2, bar_index + 15, t2, color=color.teal, width=2, style=line.style_dashed)
    line.new(bar_index, entry, bar_index + 15, entry, color=color.blue, width=1, style=line.style_dashed)

    label.new(bar_index + 1, sl,
         "SL: Rs." + str.tostring(math.round(sl, 2)) +
         " (-" + str.tostring(math.round(sl_pct, 1)) + "%)",
         color=color.red, textcolor=color.white, style=label.style_label_left, size=size.small)

    label.new(bar_index + 1, t1,
         "T1: Rs." + str.tostring(math.round(t1, 2)) +
         " | R:R " + str.tostring(math.round(rr, 2)) + ":1 | Sell 50%",
         color=color.green, textcolor=color.white, style=label.style_label_left, size=size.small)

    label.new(bar_index + 1, t2,
         "T2: Rs." + str.tostring(math.round(t2, 2)) +
         " | R:R " + str.tostring(math.round(rr2, 2)) + ":1 | Sell 50%",
         color=color.teal, textcolor=color.white, style=label.style_label_left, size=size.small)

    entry_label = "Entry: Rs." + str.tostring(math.round(entry, 2)) +
         " | Qty: " + str.tostring(qty) +
         " (T1: " + str.tostring(qty_half) +
         " + T2: " + str.tostring(qty - qty_half) + ")"

    label.new(bar_index + 1, entry, entry_label,
         color=color.blue, textcolor=color.white, style=label.style_label_left, size=size.small)

// === TRAILING EXIT — 2 consecutive closes below 10-EMA ===
trail_exit = close < ema10 and close[1] < ema10[1]

plotshape(trail_exit, title="Trail Exit", location=location.abovebar,
     style=shape.xcross, color=color.new(color.red, 0), size=size.small, text="EXIT")

// === TIME STOP — 15 trading days ===
var int signal_bar = na

if breakout
    signal_bar := bar_index

time_stop_hit = not na(signal_bar) and (bar_index - signal_bar) == 15

plotshape(time_stop_hit, title="Time Stop", location=location.abovebar,
     style=shape.diamond, color=color.new(color.orange, 0), size=size.small, text="15D")

// === INFO TABLE ===
var table tbl = table.new(position.top_right, 2, 9,
     bgcolor=color.new(color.white, 10), border_width=1,
     border_color=color.gray, frame_width=1, frame_color=color.gray)

if barstate.islast
    sl_col = sl_pct <= 8 ? color.green : sl_pct <= 12 ? color.orange : color.red
    rr_col = rr >= 2 ? color.green : rr >= 1.5 ? color.lime : rr >= 1 ? color.orange : color.red
    rr2_col = rr2 >= 3 ? color.green : rr2 >= 2 ? color.lime : rr2 >= 1 ? color.orange : color.red

    table.cell(tbl, 0, 0, "Signal", text_color=color.gray, bgcolor=color.new(color.gray, 88))
    table.cell(tbl, 1, 0, breakout ? "FRESH BREAKOUT" : "Watching",
         text_color=breakout ? color.green : color.gray,
         bgcolor=color.new(breakout ? color.green : color.gray, 85))

    table.cell(tbl, 0, 1, "Entry", text_color=color.gray, bgcolor=color.new(color.gray, 92))
    table.cell(tbl, 1, 1, "Rs." + str.tostring(math.round(entry, 2)),
         text_color=color.blue, bgcolor=color.new(color.blue, 92))

    table.cell(tbl, 0, 2, "Stop Loss", text_color=color.gray, bgcolor=color.new(color.gray, 92))
    table.cell(tbl, 1, 2, "Rs." + str.tostring(math.round(sl, 2)) +
         " (-" + str.tostring(math.round(sl_pct, 1)) + "%)",
         text_color=sl_col, bgcolor=color.new(sl_col, 92))

    table.cell(tbl, 0, 3, "T1 — Sell 50%", text_color=color.gray, bgcolor=color.new(color.gray, 92))
    table.cell(tbl, 1, 3, "Rs." + str.tostring(math.round(t1, 2)),
         text_color=color.green, bgcolor=color.new(color.green, 92))

    table.cell(tbl, 0, 4, "T2 — Sell 50%", text_color=color.gray, bgcolor=color.new(color.gray, 92))
    table.cell(tbl, 1, 4, "Rs." + str.tostring(math.round(t2, 2)),
         text_color=color.teal, bgcolor=color.new(color.teal, 92))

    table.cell(tbl, 0, 5, "R:R at T1", text_color=color.gray, bgcolor=color.new(color.gray, 92))
    table.cell(tbl, 1, 5, str.tostring(math.round(rr, 2)) + ":1",
         text_color=rr_col, bgcolor=color.new(rr_col, 85))

    table.cell(tbl, 0, 6, "R:R at T2", text_color=color.gray, bgcolor=color.new(color.gray, 92))
    table.cell(tbl, 1, 6, str.tostring(math.round(rr2, 2)) + ":1",
         text_color=rr2_col, bgcolor=color.new(rr2_col, 85))

    table.cell(tbl, 0, 7, "Qty (1% risk)", text_color=color.gray, bgcolor=color.new(color.gray, 92))
    table.cell(tbl, 1, 7, str.tostring(qty) + " shares (" +
         str.tostring(qty_half) + "+" + str.tostring(qty - qty_half) + ")",
         text_color=color.purple, bgcolor=color.new(color.purple, 92))

    table.cell(tbl, 0, 8, "SL width", text_color=color.gray, bgcolor=color.new(color.gray, 92))
    table.cell(tbl, 1, 8, str.tostring(math.round(sl_pct, 1)) + "% " +
         (sl_pct <= 8 ? "Good" : sl_pct <= 12 ? "OK" : "Wide-skip"),
         text_color=sl_col, bgcolor=color.new(sl_col, 85))

// === ALERTS ===
alertcondition(breakout, title="Fresh 52wk Breakout",
     message="FRESH BREAKOUT: {{ticker}} — check Entry/SL/T1/T2 on chart.")

alertcondition(trail_exit, title="Trail Exit",
     message="EXIT: {{ticker}} — 2 closes below 10-EMA.")

alertcondition(time_stop_hit, title="Time Stop 15D",
     message="TIME STOP: {{ticker}} — 15 days done. Exit if no progress.")

What should appear on the chart?

BREAK
Fresh breakout condition detected.
Entry / SL
Estimated entry and stop-loss levels are drawn on the signal.
T1 / T2
ATR-based target levels are displayed.

How the script calculates the trade plan

ItemSource formulaInterpretation
EntryClose × 1.001Uses a small buffer above the signal close.
Stop lossMax(current low, 5-bar swing low) × 0.995Places the stop below the selected low level.
T1Entry + 1.5 × ATR(14)First profit level.
T2Entry + 3.0 × ATR(14)Second profit level.
Position size(Capital × Risk %) ÷ stop distanceAttempts to size the trade from a fixed rupee risk budget.
Trail exit2 consecutive closes below 10 EMASignals a full exit condition.
Time stop15 bars after the signalFlags a time-based exit if the setup does not progress.

3. Complete user workflow

4. Final trade-quality checks

CheckSource workflowAction
Breakout signalFresh breakout on current candleConfirm it is still the setup you are evaluating.
Stop width≤ 8% was the original preferred filterPrefer a manageable stop distance only if it fits your risk plan.
T1 R:R≥ 1.5 was the original green/lime thresholdReject or reassess weak reward-to-risk setups.
Position size1% risk exampleChange capital/risk inputs to match your own plan.
Market contextNot encoded fully in the scannerReview index trend, sector strength, earnings/events and broad market conditions.
Do not confuse a scan match with confirmation. The scanner identifies technical conditions. It does not guarantee follow-through, execution price, liquidity, or profitability.

5. Alerts in TradingView

The supplied Pine script includes three alertcondition() triggers: breakout, trail exit and 15-day time stop. TradingView allows custom Pine scripts with alertcondition() to appear as selectable conditions in the Create Alert dialog. citeturn483021search8turn483021search12

1

Create an alert

After adding the script to the chart, open TradingView’s alert dialog and select the script in the condition list.

2

Select the specific condition

Choose the breakout, trail-exit or time-stop condition that you want to monitor.

3

Choose the trigger frequency carefully

For a daily swing workflow, review the alert trigger settings and prefer bar-close confirmation where appropriate to your process. TradingView documents multiple trigger options, including once per bar close. citeturn483021search10

6. Common problems

Chartink says the scan is invalid.

Paste the entire block again. Make sure the parentheses, and operators and indicator syntax remain unchanged. Chartink’s Scanner User Guide explains the components and filter behavior used in custom scans. citeturn483021search6

I cannot find Pine Editor.

Open a TradingView chart and use the Pine icon/editor area. TradingView’s current help describes Pine Editor as the main tool for creating, editing and testing Pine scripts. citeturn483021search1

The Pine script shows different candidates than Chartink.

This can happen because the two supplied pieces of code are not mathematically identical. The Chartink scan uses separate moving-average slope tests and ATR bounds, while the supplied Pine script also includes a 50-DMA-above-200-DMA trend condition and a 0.5% minimum move condition. Treat the Chartink scan as the discovery filter and TradingView as the second-stage validation tool unless you deliberately synchronize their formulas.

Why does the guide say 250-day in Chartink and 252-day in Pine?

The supplied Chartink line uses a 250-period maximum reference, while the supplied Pine code uses 252 periods. They are close but not identical. Keep this intentional when reproducing the supplied material, or standardize the lookback if you later want exact one-to-one matching.