TradingView
QuantNomad
14 apr 2021 12:25

Multiple Screeners with Alerts 

Bitcoin / TetherUSBinance

Descrizione

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.
Commenti
Sidb18
thanks for the script. I want to add a condition which scans for stocks where RSI > 70, ADX > 40 and TSI > 30. How do i do that. Thanks in adv.
kohairone
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? "
Stypto_Algo
Hi sir, I modified this script in order to use 2 labels instead of one. I am having an issue with the alert functionality. Even when the script doesn't find anything based on the conditions the alert still goes off. Is there something I'm doing wrong or is there something I can do?
JulesV
@Stypto_Algo, Hi, did you manage to find a solution to your question? I have the same issue with my custom screener. Thanks
just_naba
wowo so great thanks alot ,,, any tf i can use ?
QuantNomad
@naba_naif, Hi, it works on any timeframe you apply it on. So basically it takes a timeframe of your main chart.
JulesV
Thank you for the script! while using it with my specific indicators, I'm finding that the alerts are still firing on the bar close, even if there is no indication that they should be (empty). I've noticed @Stypto_Algo asked about a similar situation. Can someone please advise? Thank you!

// Alert message as a combination of all screeners. Send alert only if screener is not empty

alert_message = scr_label1 + "\n\n" + scr_label2 + "\n\n"

if (scr_label1 != '') or (scr_label2 != '')
alert(alert_message, freq = alert.freq_once_per_bar_close)
yasarz
Thank you so much for sharing this excellent indicator/alert mechanism. Would it be possible to change one of the 5 indicators with AlphaTrend (by KivancOzbilgic)?Could you share it in the new way I mentioned?
yns0202
hi,

I will have a request like this: it will only give me shares that will signal me in the direction of buying.

inputs:
ema1 = 55
ema2 = 89
ema3 = 144
ema4 = 233

For scanning:

1) the stock price can hit or go below ema1, but ema1 should not go below ema2.
2) stock price may touch or fall below ema2, but ema1 should not fall below ema2
3) price may touch or go below ema3, but ema1 should not go below ema2
4) price may touch or go below ema4, but ema1 should not go below ema2.

time zone "1h, 4h, D" can be selected.

I have identified two locations in the sample chart.
link:
altinsky
this code should be saved file by which extension?
Altro