2017.02.24 01:20 AM
2017.02.24 02:46 AM
2017.02.26 09:50 PM
So you want stock which have Buy row fol all days from monday to friday?Below query gives that result:dt:2017.02.20+til 5select from tbl where BS=`B, ({all dt in x};Date)fby Stockid
2017.02.26 10:29 PM
2017.02.24 03:30 AM
2017.02.26 09:51 PM
Below should work for you, and there'll be many more ways too//dummy dataq)a:([]s:1 2 3 1 1 3 1 2 1 3;t:`$'"BBSBBBBSBB";d:raze 2#'2017.01.31+20+til 5)q)select distinct s by `week$d from a where s in where 5=count each d group s,(d mod 7) in 2+til 5d | s----------| -2017.02.20| 1//join on another weekq)a,:update d+7 from aq)select where 5=count each group s by `week$d from a where (d mod 7) in 2+til 5,t=`Bd | s----------| -2017.02.20| 12017.02.27| 1//insert some Bs for stock id 2 for days where it had no buy signal in the first weekq)a,:([]s:4#2;t:4#`B;d:2017.02.21+til 4) q)select where 5=count each group s by `week$d from a where (d mod 7) in 2+til 5,t=`Bd | s----------| ---2017.02.20| 1 22017.02.27| ,1HTH,Sean
2017.02.27 01:08 AM
EMEA
Tel: +44 (0)28 3025 2242
AMERICAS
Tel: +1 (212) 447 6700
APAC
Tel: +61 (0)2 9236 5700
KX. All Rights Reserved.
KX and kdb+ are registered trademarks of KX Systems, Inc., a subsidiary of FD Technologies plc.