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
Remover dos scripts favoritos Adicionar aos scripts favoritos
Join the Discord Server for more info about the published tools.
a Discord bot for Charting (TradingView and Heatmaps) is available

🟣 If you like any of my Invite-Only Tools, let me know 😆
thank you KryptoNight!
you are genius.
Thank you very much for this. been struggling to put one myself :).
I run the script as a test and it did not "shoot" an alert.
I then out a plotshape lines to see if the "early Buy/early Sell" would trigger but they did not.
Amm I using it incorrectly and if so how do you use it?
Thank you
@aaahopper, Hi,
you can test the script as it is. Add to chart > create alert > wait.
TradingView allows continuous alerts (the option is "Every Time"), but for simple conditions.
For scripts, the current TradingView limitation is that it can fire once per interval (the option is "Once Per Bar").
aaahopper KryptoNight
@KryptoNight, Thank you

I'm collating a list of useful functions if you fancy adding any..
KryptoNight syrinxflunki
@syrinxflunki, nice!
Início Rastreador de Fundamentos Rastreador Forex Rastreador de criptomoedas Calendário econômico Como Funciona Recursos gráficos Preços Indique um amigo Regras da Casa Central de Ajuda Soluções para sites e corretoras Widgets Soluções em Gráficos Biblioteca de Gráficos Lightweight Blog & Notícias Twitter
Perfil Configurações de perfil Conta e cobrança Indique um amigo Meus Tíquetes de Suporte Central de Ajuda Ideias Publicadas Seguidores Seguindo Mensagens Privadas Conversa Deslogar