QuantNomad

Multiple Screeners with Alerts

I already published few version of my custom screeners. Unfortunately, because of TradingView's security function call limit you can't use more than 40 stocks in 1 screener.
Fortunately, you can compute multiple values in your function and screen few indicators at once.
In this script I show how you can compute 5 indicators at the same time for 40 instruments. I display then in different labels.
Every label consist of list of instruments satisfying current indicator conditions and a value for it. It can be absolute value as for RSI or -1/1 representing Bullish / Bearish event.
Also you can create 1 alert with result of all screeners inside.

In this example I took 5 indicators with following conditions:
  • RSI - "RSI < 30" or "RSI > 70"
  • TSI - "TSI < -30" or "RSI >30"
  • ADX - "ADX > 40"
  • MACD - "MACD Bullish Cross" or "MACD Bearish Cross" (1 and -1 in screener)
  • AO - "AO Crosses 0 UP" or "AO Crosses 0 DOWN" (1 and -1 in screener)

Params

  • - bars_apart - this parameter define how may bars apart you labels are on your chart. If you see labels overlapping, increase this number.
  • - Parameters for all used indicators
  • - 40 symbol inputs for instruments you want to use in this screener

Alerts

You can create an alert from it easily by selecting screener name from the list and then selecting "Any alert() function call".
No additional configuration is required, message and alert on close is generated in the code.
You should better change default name for your alert. Sometimes because of big amount of inputs you might receive an error.

Disclaimer
Please remember that past performance may not be indicative of future results.
Due to various factors, including changing market conditions, the strategy may no longer perform as good as in historical backtesting.
This post and the script don’t provide any financial advice.
Mã nguồn mở

Với tinh thần của TradingView, tác giả đã xuất bản tập lệnh theo mã nguồn mở, vì thế trader có thể dễ dàng hiểu và tùy chỉnh được. Bạn có thể sử dụng miễn phí, hoặc tùy chỉnh lại mã đã được cấp phép bởi Quy tắc Chung. Bạn có thể sử dụng nó trên biểu đồ.

Bạn muốn sử dụng tập lệnh này trên biểu đồ?
Courses:
PineScript Programming: https://qntly.com/pinepro
TradingView Essential: https://qntly.com/tve

Access to Pro Indic.: https://qntly.com/proind

YouTube: https://qntly.com/youtube
Discord: https://qntly.com/discord
Telegram: https://qntly.com/tel

Bình luận

wowo so great thanks alot ,,, any tf i can use ?
+1 Phản hồi
QuantNomad naba_naif
@naba_naif, Hi, it works on any timeframe you apply it on. So basically it takes a timeframe of your main chart.
+1 Phản hồi
Hi QuantNomad,
is it possible to have a conditional alert in TV, so for instance if macd is >=0, then could we screen these hits against a second condition. I was hoping something could be coded in the forex screeener , but doesnt seem to be the case. so what you show could be useful, but i really want conditional alerts

thanks a lot
Phản hồi
QuantNomad Interzona
@Interzona, if you want few conditions you can compute separate screeners and then join with "and" operator, or you can implement complex conditions in the function.
Phản hồi
I got this error while trying to keep screener for RSI and MACD only,
"The function 'crossunder' should be called on each calculation for consistency. It is recommended to extract the call from the ternary operator or from the scope? "
Phản hồi
@QuantNomad - How can i make the Labels larger, so that i can see the actual values for each of the 40 tickers and the indicators?
Thanks
Phản hồi
QuantNomad gaz_0001
@gaz_0001, try to use different size parameters in label.new
Phản hồi
Amazing script, thanks for sharing! I am trying to modify the conditions. I want to use EMAS in 2 timeframes. I replaced the AO with these lines of code

screenerFunc() =>

//
//ao = sma(hl2, ao_fast_len) - sma(hl2, ao_slow_len)
out1 = ema(close, 10)
out2 = ema(close, 20)
out3 = ema(close, 50)
out4 = ema(close, 100)
out5 = ema(close, 200)

out1_30 = security(syminfo.tickerid, "30", out1)
out2_30 = security(syminfo.tickerid, "30", out2)
out3_30 = security(syminfo.tickerid, "30", out3)
out4_30 = security(syminfo.tickerid, "30", out4)
out5_30 = security(syminfo.tickerid, "30", out5)

long= (out1 > out2 and out2 > out3 and out3 > out4 and out4 > out5) and (out1_30 > out2_30 and out2_30 > out3_30)
short= (out1 < out2 and out2 < out3 and out3 < out4 and out4 < out5) and (out1_30 < out2_30 and out2_30 < out3_30)

cond = long ? 1 : short ? -1 :0
//ao_cond = cross(ao, 0)

//ao_value = crossover( ao, 0) ? 1 :
// crossunder(ao, 0) ? -1 :
// 0



But I get this error: Syntax error: Tuple lengths are different! lvalue length is 2 rvalue length is 1.
Could you help me solve it?
Phản hồi
QuantNomad mincho1010
@mincho1010, first of all you have issue with number of variables you output from function and number if variables you assign.
also I don't think that calling a security finction from function works
Phản hồi
Trang chủ Bộ lọc cổ phiếu Bộ lọc Forex Bộ lọc Tiền điện tử Lịch kinh tế Giới thiệu Tính năng Biểu đồ Trả phí Giới thiệu bạn Quy tắc Áp dụng Trung tâm Trợ giúp Giải pháp cho Website & Nhà môi giới Widget Giải pháp biểu đồ Thư viện Biểu đồ Lightweight Blog & Tin tức Twitter