How to calculate the stage increase of the stock?

has the following requirements:

set N minutes to monitor the rise or fall of a stock by X% within N minutes, then notify the user.

how is it more efficient?

the stupidest way to achieve the above demand is to calculate whether the increase is a hit based on the current price tracing the highest or lowest price in the first N minutes.

but I feel that this algorithm is not efficient. Is there a better algorithm?

Dec.20,2021
MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1e4c5f3-654c2.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1e4c5f3-654c2.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?