function and indicator for stock trading