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
Удалить из избранных скриптов Добавить в избранные скрипты
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 😆

Комментарии

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!
+2 Ответить
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!
+1 Ответить
im trying to fire this alert 14 seconds early with "once per bar"using timeframe H1, and sometimes he fires and sometimes not, im doing something wrong or this scripts is old for my choices? @KryptoNight
Ответить
@mwstore,
The time based alerts might not always fire, unlike the bar based ones.
It also depends on your signal conditions.
Note: make sure your alerts aren't too spammy, or they'll get paused.

Test against your signals (this fires once per bar on every bar, so it's easy to test), switch to 1h chart timeframe and create the alert:
alertcondition(earlySignal_f(true,14), title='Early Signal 14s',  message='Early Signal 14s')


You can also use your signal as a backup, in case the Early Signal doesn't work:
alertcondition(earlySignal_f(mySignal,14) or mySignal, title='Early Signal 14s + backup',  message='Early Signal 14s + backup')
Ответить
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
Ответить
KryptoNight aaahopper
@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
Ответить
Brilliant...

I'm collating a list of useful functions if you fancy adding any..

https://t.co/0rZeVF9XSz
Ответить
KryptoNight syrinxflunki
@syrinxflunki, nice!
Ответить
Домой Скринер акций Скринер форекс Скринер криптовалют Экономический календарь О проекте Особенности Цены Приведи друга Правила поведения Справочный центр Решения для сайтов и брокеров Виджеты Графики TradingView для сайтов Легкая версия графиков Блог и новости Твиттер
Профиль Настройка профиля Счёт и оплата Ваши друзья Монеты Мои запросы в поддержку Справочный центр Опубликовано идей Подписчики Подписки Личные сообщения Чат Выйти