OPEN-SOURCE SCRIPT
Updated Early/Delayed Signal Function

Early/Delayed Signal Function (before the bar close or after)
Usually, signals are considered to be valid at the bar close.
Some traders may prefer to have a chance to enter earlier.
It is of great risk, and the Strategy Tester is unable to provide consistent backtest data with regards to this.
But for those who want to integrate such a choice in their strategies, here is the Early Signal Function.
The function takes 2 parameters
- the signal that is considered valid at the bar close, of type bool
- the early time value in seconds, the time before the signal is valid, of type int
it returns a value of type bool - a New Entry Signal
The resulting conditions used for alerts would be:
- newLongCondition = earlySignal_f(myLongSignal, earlyTime)
- newShrtCondition = earlySignal_f(myShrtSignal, earlyTime)
Note: the signals can also be delayed - use a negative value for early time
Usually, signals are considered to be valid at the bar close.
Some traders may prefer to have a chance to enter earlier.
It is of great risk, and the Strategy Tester is unable to provide consistent backtest data with regards to this.
But for those who want to integrate such a choice in their strategies, here is the Early Signal Function.
The function takes 2 parameters
- the signal that is considered valid at the bar close, of type bool
- the early time value in seconds, the time before the signal is valid, of type int
it returns a value of type bool - a New Entry Signal
The resulting conditions used for alerts would be:
- newLongCondition = earlySignal_f(myLongSignal, earlyTime)
- newShrtCondition = earlySignal_f(myShrtSignal, earlyTime)
Note: the signals can also be delayed - use a negative value for early time
Release Notes
improved the early alert function,using the new built-in function for alerts, that works in both strategy() & study() scripts
Release Notes
test long alertRelease Notes
fix: now it is possible to delay the signals, use a negative value in secondsOpen-source script
In true TradingView spirit, the creator of this script has made it open-source, so that traders can review and verify its functionality. Kudos to the author! While you can use it for free, remember that republishing the code is subject to our House Rules.
For quick access on a chart, add this script to your favorites — learn more here.
Join the Discord Server for more info about the published tools.
discord.io/CryptoWorld
a Discord bot for Charting (TradingView and Heatmaps) is available
🟣 If you like any of my Invite-Only Tools, let me know
(DM or Discord for inquiries)
discord.io/CryptoWorld
a Discord bot for Charting (TradingView and Heatmaps) is available
🟣 If you like any of my Invite-Only Tools, let me know
(DM or Discord for inquiries)
Disclaimer
The information and publications are not meant to be, and do not constitute, financial, investment, trading, or other types of advice or recommendations supplied or endorsed by TradingView. Read more in the Terms of Use.
Open-source script
In true TradingView spirit, the creator of this script has made it open-source, so that traders can review and verify its functionality. Kudos to the author! While you can use it for free, remember that republishing the code is subject to our House Rules.
For quick access on a chart, add this script to your favorites — learn more here.
Join the Discord Server for more info about the published tools.
discord.io/CryptoWorld
a Discord bot for Charting (TradingView and Heatmaps) is available
🟣 If you like any of my Invite-Only Tools, let me know
(DM or Discord for inquiries)
discord.io/CryptoWorld
a Discord bot for Charting (TradingView and Heatmaps) is available
🟣 If you like any of my Invite-Only Tools, let me know
(DM or Discord for inquiries)
Disclaimer
The information and publications are not meant to be, and do not constitute, financial, investment, trading, or other types of advice or recommendations supplied or endorsed by TradingView. Read more in the Terms of Use.