reverse aj aka find the next element after a time

I frequently face the need to find the next element (bid/ask/trade) after an event/signal. I was wondering if there is a reverse aj trick which i am missing.
currently I use a hackish approach where I subtract time from a large/eod time and then do an aj which I think gives me the needful. Has some one tried anything similar, wanted to confirm also if my approach is sound.

Regards

Usually I define ajr to be exactly aj but with binr instead of bin

|

From: naveen sharma

Sent: Monday, May 30, 2016 21:13

To: Kdb+ Personal Developers

Reply To: personal-kdbplus@googlegroups.com

Subject: [personal kdb+] reverse aj aka find the next element after a time

|

I frequently face the need to find the next element (bid/ask/trade) after an event/signal. I was wondering if there is a reverse aj trick which i am missing.
currently I use a hackish approach where I subtract time from a large/eod time and then do an aj which I think gives me the needful. Has some one tried anything similar, wanted to confirm also if my approach is sound.

Regards


Submitted via Google Groups

thanks! that’s a much better approach imo

Hi David, 

need a little more help, I tried doing the below but it gives an error saying “/”

Is there any escaping or low level changes I need to do?

ajr: {.Q.ft[{d:x_z;$[&/j:-1<i:(x#z)binr x#y;y,'d i;+.[+.Q.ff[y]d;(!+d;j);:;.+d i j:&j]]}[x,();;0!z]]y}

prefix with k)

k)ajr:{ ..