Timesincesignal or Barstrue

Dear Team,

I write several script to scan past 60 days that condition occur.
If occur then show the symbol.
But it seems go wrong.
Please help to correct , thank you.

A1 = Highesthigh(BARS=60) / LOWESTLOW(BARS=60) > 1.3;

B1 = MA(VOL(), BARS=20, CALC=Close) > 500000;

C1 = CLOSE() > 20 and CLOSE() > MA(BARS=200) and MA(BARS=50) > MA(BARS=200);

D1 = CLOSE() < HIGHESTHIGH(BACKTYPE=Days, BARS=60, INCBAR=True, EQUAL=True, )*0.99;

E1 = CLOSE() > HIGHESTHIGH(BACKTYPE=Days, BARS=60, INCBAR=True, EQUAL=True, )*0.85;

F1 = A1 and B1 and C1 and D1 and E1;

G1 = TIMESINCESIGNAL(F1, UNIT=Bars)<10;

G1

Hi Donald,

I think the issue is with the G1 condition where you have <10 instead of <60.

Hi Darren,

I change to 60. But the result still show symbol that below $20.

Please help to check, thanks

One method I do to verify Boolean logic is to put the script into a Watchlist, duplicate the script in columns and set each Boolean parameter to be returned. This helps me rationalize where I might have made a mistake.

I ran your script and it does work for me. If you’re having an issue with the CLOSE() > 20 not seeming to work, try forcing the Time to “Day”:
CLOSE(Day(PERIODAMOUNT=1)) > 20

2 Likes

Hi Donald,

It could be that at the time of the signal the price was above 20, but has since moved below. Do you have an example? If you put the script in a Show Bar to display the F1 signal on a chart does it display when > 20?

Hi Darren,

It works when i use below method to scan

For your reference:


OK thanks. I’m not sure why that would be the case, but if you make the last line G1 and CLOSE()>20 then it will work as expected.