Several whole books has been written on stock trend identification.
So, I can do little contribution here.
Later, chances are that other high qualified members will give you their valuable justifications and ideas.
Before they come, it could be worthy to clarify some points. I assume you don't like definitions, but unfortunately I love them.
General speaking we could define it as: Pattern of gradual change in a condition over time.
In this case, the current
general direction of movement for prices or rates.
Investopedia give us another definition: The
general direction of a market or of the price of an asset. Trends
can vary in length from short, to intermediate, to long term.
Enough definitions.
Regardless of how one defines it, the target of trend trading is the same, namely, join the move early and hold the position until the trend ends.
So, how can we identify a trend?
Some identify trends as a deviation from a range as indicated by Bollinger Band. For others, a trend occurs when prices are contained by an upward or downward sloping x-period simple moving average (SMA).
No doubt, the simplest identifiers of trend direction are higher lows in an uptrend and lower highs in a downtrend.
Now, we have a little of theory background.
Let's talk about identification mechanisms.
Identify a trend is pretty simple. Just take a look to the chart and you'll see immediately the trend or the lack of it. Why it is so easy? Because our brain is probably the most advanced and perfect mechanism of pattern recognition.
How do you distinguish among the other humans beings around you? Your brain execute a pattern recognition process on them with a velocity and accuracy that no computer over the world can achieve.
Now, you want to do the same with a little of programming, or even better with one or two predefined indicators.
Good luck!!! Don't forget to write a book when you finish.
IMHO, you can't do it.
You can try some approaches, but you will never get something consistent. Tiny deviations will confuse your system. You brain can make allowance of thousands of tiny deviations and variables, but an algorithm... difficult. Let's go back to the definitions above for a second.
Did you realize that I stressed in red the word
general?
It isn't easy task to synthesize general and changing concepts into a set of defined rules.
You can use some kind of indicator to help you to identify trends, but it will be you who finally decide.
Anyway, more info here :
This article and more available at Investopedia.com