KryptoNight

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
Note di rilascio: improved the early alert function,
using the new built-in function for alerts, that works in both strategy() & study() scripts
Note di rilascio: test long alert
Note di rilascio: fix: now it is possible to delay the signals, use a negative value in seconds
Script open-source

Nello spirito di condivisione promosso da TradingView, l'autore (al quale vanno i nostri ringraziamenti) ha deciso di pubblicare questo script in modalità open-source, così che chiunque possa comprenderlo e testarlo. Puoi utilizzarlo gratuitamente, ma il riutilizzo del codice è subordinato al rispetto del Regolamento. Per aggiungerlo al grafico, mettilo tra i preferiti.

Vuoi usare questo script sui tuoi grafici?
Join the Discord Server for more info about the published tools.
https://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)

Commenti

Hi, thanks for sharing this script. Trying to understand why the script is affected by the Interval? For example, seems to function well at 1min, but when change to hours, the units seems to change. Thanks!
+5 Rispondi
CryptoRedneck CryptoRedneck
@CryptoRedneck oh wait, dumb question, the seconds in countdown are waiting until the next bar to close. Should have had more coffee this morning... thanks for the script @KryptoNight!
+2 Rispondi
Very nice. I have been looking for something like this. I tweaked it a little and works better without missing sometimes. Change to: earlySignal = mySignal and (time_close-timenow-earlyTime*1000)/1000<=0

This works well with once per bar. Thanks again!
+2 Rispondi
Hi can you share the script to make the alert delayed by 1 hour ? im new to script
+1 Rispondi
@hijjaz, open the indicator settings and set the time to -3600
Rispondi
hijjaz KryptoNight
@KryptoNight, not working. nothing triggered except the normal time one.
Rispondi