Looking for some advice on a scalable tickscript-based solution!
The script is to fire an alert when change in a stock goes above or below that of its corresponding index.
|t1||12||S2 above IDX|
|t1||13||S2 below IDX|
|t3||14||S1 above IDX|
|t4||12||S1 below IDX|
I managed to come up with a tickscript that does the job given an index and a stock.
- Two batch queries – one to get the latest value of index and the other to get the latest value of stock
- Join the results
- Check the value and generate an alert.
However, it’s not clear to me how this can be extended to a dynamic number of stocks.
Join doesn’t seem to be an option. I tried to see if
combine can work, but
query|last|combine is causing the Kapacitor to crash (unable to see what the error is though).
Any pointers/tips on how to go about this are appreciated!