Custom Screener with Alerts V2 [QuantNomad]

TradingView just recently announced the alert() function that allows you to create dynamic alerts from both strategies and studies.
So I decided to update custom screener I published before. It was based on alerts from orders in strategies, that was the only way to create dynamic alerts in PineScript at that point.
With the alert() function code become cleaner and more readable.

It works for up to 40 symbols at the same time.
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 I set up in the code.

I created as an example a screener that tracks both overbought ( RSI > 70) and oversold stocks ( RSI < 30).
To create your own screener you have to change only screenerFunc().
By design it should output 2 values:
  • cond - True/False Boolean variable. Should this instrument be displayed in the screener?
  • value - Additional numeric value you can display in your screener. I display RSI level for selected stocks for example.

Link to the old screener:

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 đồ?
Pine Programming: https://qntly.com/pineprog
Advanc. Pine Use-Cases: https://qntly.com/advpine

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

500 xu
Phản hồi
kakola PineCoders
@PineCoders, Would there be any advantage in replacing the repainting security() with the PineCoder's f_security() function here?
Phản hồi
@kakola, no because the alert it self does not repaint -> freq = alert.freq_once_per_bar_close
and because // This will keep screener only for the last bar label.delete(lab_l)
+1 Phản hồi

When I am trying to use this script, it's giving an error while creating an alert on pop up and then not saving it.
Error is "Alert Saving failed. Please, try again."

Tried it number of times, but nothing works.

Appreciate if you can guide me.

+4 Phản hồi
QuantNomad DeepMPans
@DeepMPans, Change the name for it, with all symbols in params it is too long
+1 Phản hồi
@QuantNomad, The close within the screenerFunc() has a local scope. I would expected this function to take the close value at end of each bar period. The alerts generated are taking the close at point in time on the bar.

is it possible to have the close value used for RSI at end of each bar.

please advise. Thanks.
Phản hồi
This is useful, thanks!.

Is there a way we could capture events like crossover(rsi, 60). Alerts needs to be generated when the crossover happens.
Phản hồi
QuantNomad financialBird25472
@financialBird25472, yep, you have to edit alert frequency to "all". But this way you might receive quite a lot of alerts and on close, you might not see the signals you got in these alerts.
Phản hồi
Hello, thank u for ur contribution to this community!
I find this really helpful as u make it simple with this neat scripting

Also, is it possible to make the alerts are separate for each ticker?
For example:
if (cond for s01 == true)
alert('Cond for s01 is true, buy!', freq = alert.freq_once_per_bar_close )

If its yes, can u give me an example how to do that?
Phản hồi
Hello, is it possible to make a screener that warns by means of an alarm when an asset reaches x price? Example: If Eth reaches 1500 and BTC reaches 25000, etc. And rewrite the code with the new levels that one wants to give to each asset within a list of 40
Phản hồi