Trend Tracker - database functions