0% found this document useful (0 votes)
51 views4 pages

123

This document defines a strategy that runs a custom screener on 40 stocks to calculate their RSI values. It then generates a label with the results, including any stocks over the RSI overbought level. This label is plotted and includes a #telegram hashtag to trigger alerts. A dummy strategy is also defined to generate alerts when the label is updated.

Uploaded by

Rudra
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
51 views4 pages

123

This document defines a strategy that runs a custom screener on 40 stocks to calculate their RSI values. It then generates a label with the results, including any stocks over the RSI overbought level. This label is plotted and includes a #telegram hashtag to trigger alerts. A dummy strategy is also defined to generate alerts when the label is updated.

Uploaded by

Rudra
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 4

//@version=4

strategy("Custom Screener with Alerts [QuantNomad]", shorttitle =


'AlertsScreener[QN]', overlay = false)

////////////
// INPUTS //

rsi_length = input(14, title = "RSI Length")


rsi_overbought = input(70, title = "RSI Overbought Level")

// Symbols
s01 = input('AAPL', type=input.symbol)
s02 = input('MSFT', type=input.symbol)
s03 = input('AMZN', type=input.symbol)
s04 = input('GOOGL', type=input.symbol)
s05 = input('BABA', type=input.symbol)
s06 = input('FB', type=input.symbol)
s07 = input('BRK.A', type=input.symbol)
s08 = input('V', type=input.symbol)
s09 = input('JNJ', type=input.symbol)
s10 = input('WMT', type=input.symbol)
s11 = input('TSM', type=input.symbol)
s12 = input('PG', type=input.symbol)
s13 = input('MA', type=input.symbol)
s14 = input('JPM', type=input.symbol)
s15 = input('TSLA', type=input.symbol)
s16 = input('UNH', type=input.symbol)
s17 = input('HD', type=input.symbol)
s18 = input('NVDA', type=input.symbol)
s19 = input('INTC', type=input.symbol)
s20 = input('NFLX', type=input.symbol)
s21 = input('VZ', type=input.symbol)
s22 = input('ADBE', type=input.symbol)
s23 = input('DIS', type=input.symbol)
s24 = input('T', type=input.symbol)
s25 = input('PYPL', type=input.symbol)
s26 = input('BAC', type=input.symbol)
s27 = input('NVS', type=input.symbol)
s28 = input('CSCO', type=input.symbol)
s29 = input('KO', type=input.symbol)
s30 = input('MRK', type=input.symbol)
s31 = input('PFE', type=input.symbol)
s32 = input('PEP', type=input.symbol)
s33 = input('CMCSA', type=input.symbol)
s34 = input('SAP', type=input.symbol)
s35 = input('XOM', type=input.symbol)
s36 = input('CRM', type=input.symbol)
s37 = input('ORCL', type=input.symbol)
s38 = input('TM', type=input.symbol)
s39 = input('ABBV', type=input.symbol)
s40 = input('ASML', type=input.symbol)

///////////////
// FUNCTIONS //

// Screener Function
screenerFunc() =>
rsi = rsi(close, rsi_length) // Value
cond = rsi > rsi_overbought // Condition
[rsi, cond]

// Rounding Function
roundn(x, n) =>
mult = 1
if n != 0
for i = 1 to abs(n)
mult := mult * 10

n >= 0 ? round(x * mult) / mult : round(x / mult) * mult

///////////////////////////////////////
// Running Functions for all sybmols //

[v01, c01] = security(s01, timeframe.period, screenerFunc())


[v02, c02] = security(s02, timeframe.period, screenerFunc())
[v03, c03] = security(s03, timeframe.period, screenerFunc())
[v04, c04] = security(s04, timeframe.period, screenerFunc())
[v05, c05] = security(s05, timeframe.period, screenerFunc())
[v06, c06] = security(s06, timeframe.period, screenerFunc())
[v07, c07] = security(s07, timeframe.period, screenerFunc())
[v08, c08] = security(s08, timeframe.period, screenerFunc())
[v09, c09] = security(s09, timeframe.period, screenerFunc())
[v10, c10] = security(s10, timeframe.period, screenerFunc())
[v11, c11] = security(s11, timeframe.period, screenerFunc())
[v12, c12] = security(s12, timeframe.period, screenerFunc())
[v13, c13] = security(s13, timeframe.period, screenerFunc())
[v14, c14] = security(s14, timeframe.period, screenerFunc())
[v15, c15] = security(s15, timeframe.period, screenerFunc())
[v16, c16] = security(s16, timeframe.period, screenerFunc())
[v17, c17] = security(s17, timeframe.period, screenerFunc())
[v18, c18] = security(s18, timeframe.period, screenerFunc())
[v19, c19] = security(s19, timeframe.period, screenerFunc())
[v20, c20] = security(s20, timeframe.period, screenerFunc())
[v21, c21] = security(s21, timeframe.period, screenerFunc())
[v22, c22] = security(s22, timeframe.period, screenerFunc())
[v23, c23] = security(s23, timeframe.period, screenerFunc())
[v24, c24] = security(s24, timeframe.period, screenerFunc())
[v25, c25] = security(s25, timeframe.period, screenerFunc())
[v26, c26] = security(s26, timeframe.period, screenerFunc())
[v27, c27] = security(s27, timeframe.period, screenerFunc())
[v28, c28] = security(s28, timeframe.period, screenerFunc())
[v29, c29] = security(s29, timeframe.period, screenerFunc())
[v30, c30] = security(s30, timeframe.period, screenerFunc())
[v31, c31] = security(s31, timeframe.period, screenerFunc())
[v32, c32] = security(s32, timeframe.period, screenerFunc())
[v33, c33] = security(s33, timeframe.period, screenerFunc())
[v34, c34] = security(s34, timeframe.period, screenerFunc())
[v35, c35] = security(s35, timeframe.period, screenerFunc())
[v36, c36] = security(s36, timeframe.period, screenerFunc())
[v37, c37] = security(s37, timeframe.period, screenerFunc())
[v38, c38] = security(s38, timeframe.period, screenerFunc())
[v39, c39] = security(s39, timeframe.period, screenerFunc())
[v40, c40] = security(s40, timeframe.period, screenerFunc())

////////////////////
// Screener label //

scr_label = 'Screener: \n##########\n'


scr_label := c01 ? scr_label + s01 + ' ' + tostring(roundn(v01, 3)) + '\n' :
scr_label
scr_label := c02 ? scr_label + s02 + ' ' + tostring(roundn(v02, 3)) + '\n' :
scr_label
scr_label := c03 ? scr_label + s03 + ' ' + tostring(roundn(v03, 3)) + '\n' :
scr_label
scr_label := c04 ? scr_label + s04 + ' ' + tostring(roundn(v04, 3)) + '\n' :
scr_label
scr_label := c05 ? scr_label + s05 + ' ' + tostring(roundn(v05, 3)) + '\n' :
scr_label
scr_label := c06 ? scr_label + s06 + ' ' + tostring(roundn(v06, 3)) + '\n' :
scr_label
scr_label := c07 ? scr_label + s07 + ' ' + tostring(roundn(v07, 3)) + '\n' :
scr_label
scr_label := c08 ? scr_label + s08 + ' ' + tostring(roundn(v08, 3)) + '\n' :
scr_label
scr_label := c09 ? scr_label + s09 + ' ' + tostring(roundn(v09, 3)) + '\n' :
scr_label
scr_label := c10 ? scr_label + s10 + ' ' + tostring(roundn(v10, 3)) + '\n' :
scr_label
scr_label := c11 ? scr_label + s11 + ' ' + tostring(roundn(v11, 3)) + '\n' :
scr_label
scr_label := c12 ? scr_label + s12 + ' ' + tostring(roundn(v12, 3)) + '\n' :
scr_label
scr_label := c13 ? scr_label + s13 + ' ' + tostring(roundn(v13, 3)) + '\n' :
scr_label
scr_label := c14 ? scr_label + s14 + ' ' + tostring(roundn(v14, 3)) + '\n' :
scr_label
scr_label := c15 ? scr_label + s15 + ' ' + tostring(roundn(v15, 3)) + '\n' :
scr_label
scr_label := c16 ? scr_label + s16 + ' ' + tostring(roundn(v16, 3)) + '\n' :
scr_label
scr_label := c17 ? scr_label + s17 + ' ' + tostring(roundn(v17, 3)) + '\n' :
scr_label
scr_label := c18 ? scr_label + s18 + ' ' + tostring(roundn(v18, 3)) + '\n' :
scr_label
scr_label := c19 ? scr_label + s19 + ' ' + tostring(roundn(v19, 3)) + '\n' :
scr_label
scr_label := c20 ? scr_label + s20 + ' ' + tostring(roundn(v20, 3)) + '\n' :
scr_label
scr_label := c21 ? scr_label + s21 + ' ' + tostring(roundn(v21, 3)) + '\n' :
scr_label
scr_label := c22 ? scr_label + s22 + ' ' + tostring(roundn(v22, 3)) + '\n' :
scr_label
scr_label := c23 ? scr_label + s23 + ' ' + tostring(roundn(v23, 3)) + '\n' :
scr_label
scr_label := c24 ? scr_label + s24 + ' ' + tostring(roundn(v24, 3)) + '\n' :
scr_label
scr_label := c25 ? scr_label + s25 + ' ' + tostring(roundn(v25, 3)) + '\n' :
scr_label
scr_label := c26 ? scr_label + s26 + ' ' + tostring(roundn(v26, 3)) + '\n' :
scr_label
scr_label := c27 ? scr_label + s27 + ' ' + tostring(roundn(v27, 3)) + '\n' :
scr_label
scr_label := c28 ? scr_label + s28 + ' ' + tostring(roundn(v28, 3)) + '\n' :
scr_label
scr_label := c29 ? scr_label + s29 + ' ' + tostring(roundn(v29, 3)) + '\n' :
scr_label
scr_label := c30 ? scr_label + s30 + ' ' + tostring(roundn(v30, 3)) + '\n' :
scr_label
scr_label := c31 ? scr_label + s31 + ' ' + tostring(roundn(v31, 3)) + '\n' :
scr_label
scr_label := c32 ? scr_label + s32 + ' ' + tostring(roundn(v32, 3)) + '\n' :
scr_label
scr_label := c33 ? scr_label + s33 + ' ' + tostring(roundn(v33, 3)) + '\n' :
scr_label
scr_label := c34 ? scr_label + s34 + ' ' + tostring(roundn(v34, 3)) + '\n' :
scr_label
scr_label := c35 ? scr_label + s35 + ' ' + tostring(roundn(v35, 3)) + '\n' :
scr_label
scr_label := c36 ? scr_label + s36 + ' ' + tostring(roundn(v36, 3)) + '\n' :
scr_label
scr_label := c37 ? scr_label + s37 + ' ' + tostring(roundn(v37, 3)) + '\n' :
scr_label
scr_label := c38 ? scr_label + s38 + ' ' + tostring(roundn(v38, 3)) + '\n' :
scr_label
scr_label := c39 ? scr_label + s39 + ' ' + tostring(roundn(v39, 3)) + '\n' :
scr_label
scr_label := c40 ? scr_label + s40 + ' ' + tostring(roundn(v40, 3)) + '\n' :
scr_label

// Adding #telegram hashtag for alertatron


scr_label := scr_label + "\n #telegram"

// Plot Label
lab_l = label.new(
bar_index, 0, scr_label,
color=color.gray,
textcolor=color.black,
style = label.style_labeldown,
yloc = yloc.price)

label.delete(lab_l[1])

plot(0, transp = 100)

////////////////////
// Dummy strategy //
if (time >= timestamp(year(timenow), month(timenow), dayofmonth(timenow), 00, 00))
strategy.entry("dummy_long", true, when = strategy.position_size[1] == 0 and
barstate.isconfirmed, alert_message = scr_label)
strategy.close("dummy_long", when = strategy.position_size[1] != 0 and
barstate.isconfirmed, alert_message = scr_label)

You might also like