TradingView
KryptoNight
2019년 11월 15일 오후 11시 15분

Early/Delayed Signal Function 

Bitcoin / US Dollar Perpetual Inverse Swap ContractBitMEX

설명

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

릴리즈 노트

improved the early alert function,
using the new built-in function for alerts, that works in both strategy() & study() scripts

릴리즈 노트

test long alert

릴리즈 노트

fix: now it is possible to delay the signals, use a negative value in seconds
코멘트
CryptoRedneck
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!
CryptoRedneck
@partner_track_4 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!
DirtbikesMM
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!
Schijzo
Hi can you share the script to make the alert delayed by 1 hour ? im new to script
KryptoNight
@hijjaz, open the indicator settings and set the time to -3600
Schijzo
@KryptoNight, not working. nothing triggered except the normal time one.
더보기