Hi,
In a watchlist, I want to write a script asking if there has been a gap >15% in the last 90 days. Not sure what I am doing wrong. Please see the script below and the image attached.
//Define signal: gap > 15%.
V1 = GAP(MINSIZE=15.01, MINBAR=1, ALLOWPARTIAL=False) ;
//Ask if there has been a signal in the last 90 bars.
TIMESINCESIGNAL(V1) < 90
thank you
Hi Louis,
Rather than use the GAP function it may be easier to use the following.
//Calc Gap% between low and previous high;
GapUp=(LOW()-HIGH()[1])/HIGH()[1];
//Set Gap tolerance eg 15%;
Sig1=GapUp > 0.15;
//Did the gap occur within 90 trading days?
//Note that if an event has never happened it gets assigned a value of -1, so we also need a > 0 condition;
TIMESINCESIGNAL(Sig1)>0 and TIMESINCESIGNAL(Sig1)<90
Here’s a list of the 15 members of the S&P1500 that has had a 15% gap up within the last 90 trading days (change the last line to TIMESINCESIGNAL(Sig1, UNIT=Days) for calendar days), including $NVDA (11 days) and $META (89):

Wow is this all helpful! Thank you, Darren. Thank you.