Custom Screener with Alerts [QuantNomad]

Some time ago I published an example of simple custom screener in PineScript:

The only thing this screener did is created a dynamic label with screener output.
Recently TradingView announced alerts from the strategy with the possibility to add custom messages to alerts.
So using it I was able to create a bit more advanced screener which sends results as alert messages. With tools like Alertatron, you can easily redirect them to Telegram if you want.

It works for 40 symbols (limitation of the number of security calls).
To create your own screener you need to change only screenerFunc. The logic of this function is very simple, it outputs value you want to display in screener and condition based on which your screener should filter your stocks.

To create alerts for this screener create an alert from strategy and use {{strategy.order.alert_message}} as alert message.

Do you know now how to make this screener better? Let me know.

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.
从常用脚本中删除 添加到常用脚本
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


Hi QuantNomad,
Sir i want to know, how can i add a condition instead of RSI > 70,
the Condition which i want to add is blow:

Buy signal alert when "Moving average 21 crossover 28 Moving average". (in daily time frame)
sell signal alert when " crossunder (close,28 Moving average) ". (in daily time frame)
+5 回复
hello sir. hope u r good. Alert POP UP message shows all 40 symbols name, how to change this ALERT CONDITION that only that symbol POPS UP in message box that gone overbought rather than all.thanks.
QuantNomad cryptopreet
@cryptopreet, Probably there is something wrong with your screener function
cryptopreet QuantNomad
@QuantNomad, I have changed only symbols,else all script is same sir
Hi! Thanks for this great script. Really saves me a lot of time. I only have one problem. The strategy does not send alerts on the daily timeframe. It works on lower time frames like 1H. Do you have an idea how this could be solved?
According to this script, can you explain for it?

scr_label := c01 ? scr_label + s01 + ' ' + tostring(roundn(v01, 3)) + '\n' : scr_label

because i just found a way to insert more selection of stock.i am going to modify your scipt due to too many local scope.
Hey Quant!
I've been trying to do something that on the last screener was working:
- I let the screener run on a small TF like 1H, and let the customfunc run on the 1D timeframe, so I can get the daily signals as they evolve during the day.
+ e.g a 5 moving average comes above a 10 moving average

Now comes the strange part:
- but this version of the screener is only returning me the signal if I change to my daily timeframe on tradingview
- when i put back on the 1H timeframe the signal dissapears completely
- I did some studying and it seems the screener is only returning the result from closed bars (in this case, daily Bars, so Im getting the signals that I should have got the day before)
I couldnt figure out what differs your 2 screeners that make this happen, but on the last one as the day went by I could see many "confirmations" or "unconfirmations" of crossing averages, and at the end of the day before market close I can make a decision, but this one it waits until market is closed.

I tried:
+ taking off //if (time >= timestamp(year(timenow), month(timenow), dayofmonth(timenow), 00, 00))
+ taking off // and barstate.isconfirmed

and still doesnt work
QuantNomad johnjohntrades
@johnjohntrades, You mean you used daily timeframe here:

= security(s01, timeframe.period, screenerFunc())

something like

= security(s01, 'D', screenerFunc())

And you applied on the hourly chart?
johnjohntrades QuantNomad
@QuantNomad, yes, exactly!
johnjohntrades johnjohntrades
@johnjohntrades, weird right?
and when I change to the Daily on the chart, it shows the correct signal

+ just checked here, on the hourly chart, lets say the market closes at 5pm,
the 5pm screener result shows the signal. I'm guessing it is waiting for the bar on the daily timeframe to close to send me the signal, event though I got rid of "barstate.isconfirmed"
首页 股票筛选器 外汇筛选器 加密货币筛选器 财经日历 如何运作 图表功能 价格 推荐朋友 网站规则 帮助中心 网站 & 经纪商解决方案 插件 图表解决方案 轻量图表库 博客 & 新闻 Twitter
概览 个人资料设置 账户和账单 推荐朋友 代币 我的客服工单 帮助中心 已发表观点 粉丝 正在关注 私人消息 在线聊天 退出