This is an interesting question. If I understand it correctly, you would like to use API to set alerts which pop up on TWS when the condition is met. That could actually be useful.
I don't see anything in the API that can do that. The closest that I can see is to create a Conditional Order...