The basic concept is to look for directional structure with higher highs and higher lows for uptrend or lower lows and lower highs for downtrend . But there are a few other characteristics that need to be measured in order to estimate accurately the type and the quality of the trend.
1. Trend smoothness - Calculate the ratio between up ticks and down ticks for the given time period. The easy alternative is to use modified RSI formula. Or you can calculate the percentage of overlapping candles.
But it's better to analyze price directly. In addition to the tick ratio, you can break down the price movements into segments by using fractals formula of N bars reversal. Then compare the sizes of impulsive segments and corrective segments. And also how deep is the deepest correction relative to the whole trend.
2. Trend angle - Measure the price change vs time. In other words, measure the speed of change. Big price change in short time vs small price change in a long time. These are the extremes on both ends of the spectrum. And everything else is in between.
3. Relative size - How large is the trend in comparison with historical trends of the same time frame. We can use ATR metrics for this.
There is also another way to approach the whole thing. You can eliminate the time component and look only at price. For this we can use range bars or renko bars. They show different picture.
And in the end, things can be a lot simpler! For example If the current price is at or near the highest price of the last N bars we assume the trend is up. Cant argue with that. And we can ignore the internal structure.
As you said, there is no right or wrong method. Just different approaches and different strategies.
The basic concept is to look for directional structure with higher highs and higher lows for uptrend or lower lows and lower highs for downtrend . But there are a few other characteristics that need to be measured in order to estimate accurately the type and the quality of the trend.
1. Trend smoothness - Calculate the ratio between up ticks and down ticks for the given time period. The easy alternative is to use modified RSI formula. Or you can calculate the percentage of overlapping candles.
But it's better to analyze price directly. In addition to the tick ratio, you can break down the price movements into segments by using fractals formula of N bars reversal. Then compare the sizes of impulsive segments and corrective segments. And also how deep is the deepest correction relative to the whole trend.
2. Trend angle - Measure the price change vs time. In other words, measure the speed of change. Big price change in short time vs small price change in a long time. These are the extremes on both ends of the spectrum. And everything else is in between.
3. Relative size - How large is the trend in comparison with historical trends of the same time frame. We can use ATR metrics for this.
There is also another way to approach the whole thing. You can eliminate the time component and look only at price. For this we can use range bars or renko bars. They show different picture.
And in the end, things can be a lot simpler! For example If the current price is at or near the highest price of the last N bars we assume the trend is up. Cant argue with that. And we can ignore the internal structure.
As you said, there is no right or wrong method. Just different approaches and different strategies.
Excellent question. In my experience developing algorithmic systems, relying solely on lagging indicators like moving averages often leads to late entry into fast-moving markets like gold.
In my current model, I combine three layers to define a trend:
- Multi- correlation analysis of the H4/H1 trend to determine the main direction even before looking for an entry into the M5.
- Dynamic volatility filters use ATR-based calculations to distinguish between a healthy trend and a "fake" uptrend.
- Price action confirmation is waiting for a specific candle close in the direction of the higher timeframe trend to confirm that momentum is indeed present.
This approach has allowed me to maintain a very low drawdown while maintaining a consistent win rate. Ultimately, it's a synergy between aligning timelines and managing risk.
Reading the breakdown of relying on higher highs and basic tick ratios to define an algorithmic trend explains exactly why so many retail systems bleed capital during institutional liquidity sweeps, a basic fractal or N-bar reversal logic is mathematically blind to real order flow and simply curve-fits past data, meaning the moment the market shifts into a complex volatility expansion, your static tick ratios will signal a trend right as the smart money is actually exiting the position. If you want to define trend computationally without lagging disastrously behind the market, you absolutely must abandon these retail illusions and start calculating dynamic volume-weighted standard deviations to track where the actual institutional delta is accumulating rather than just connecting imaginary dots on a chart
Real volumes and orderbooks on spot FX? And how do you find this?
Yeah, we only get tick volume from most FX broker-dealers─not contract (real) volume. To be clear, tick volume measures raw price movements while contract volume measures order sizes. Even at that, the tick volume is limited to the ticks of the specific broker-dealer's OTC pool. And even if the broker-dealer is connected to the global interbank market, the data is generally altered by the pool of liquidity providers prior to arrival in the retail trader's terminal. Unless the retail trader is trading 50 to 100 standard lots (as in the interbank market), "micro" ticks must be added so that retail traders can get their smaller trades meaningfully executed. The suitability of tick volume as a proxy for contract volume is a widespread and ongoing controversy. Any value of calculating delta based on tick volume is questionable, at best.
[E]ven on the stock market, on regulated exchanges......nobody knows the real order flow and real volumes these days.
Undoubtedly, that statement is jurisdictionally dependent. Regarding dark pools in the U.S.:
"Though their name might make it sound as if these venues lack transparency or oversight, both the SEC and FINRA are actively involved in the regulation of dark pools.
All trade data for listed stock transactions occurring on ATSs, including dark pools, must be submitted to a FINRA Trade Reporting Facility (TRF) and is published on the consolidated tape, an electronic system that provides real-time trade data for listed securities.
FINRA makes weekly trading information for each equity ATS publicly available after a two- to four-week delay, depending on the type of stock, in an effort to enhance transparency in that market. FINRA also publishes data for trades conducted over the counter on other venues.
Publishing this data allows market participants, investors, regulators and academics to see volume information and trends in dark pool trading on a stock-by-stock basis. It can also help firms refine their trade routing strategies to reduce costs, enhance market transparency and generally improve trading quality.
Additionally, SEC regulations generally require ATSs to be operated by FINRA member firms, subjecting them to applicable securities laws and regulations. ATSs are also subject to additional fair access requirements, and those that trade listed securities must submit disclosures regarding the nature of their trading operations via Form ATS-N. The SEC publishes those disclosures, along with a regularly updated list of ATSs, on its website."
- 2023.11.15
- www.finra.org
The basic concept is to look for directional structure with higher highs and higher lows for uptrend or lower lows and lower highs for downtrend . But there are a few other characteristics that need to be measured in order to estimate accurately the type and the quality of the trend.
1. Trend smoothness - Calculate the ratio between up ticks and down ticks for the given time period. The easy alternative is to use modified RSI formula. Or you can calculate the percentage of overlapping candles.
But it's better to analyze price directly. In addition to the tick ratio, you can break down the price movements into segments by using fractals formula of N bars reversal. Then compare the sizes of impulsive segments and corrective segments. And also how deep is the deepest correction relative to the whole trend.
2. Trend angle - Measure the price change vs time. In other words, measure the speed of change. Big price change in short time vs small price change in a long time. These are the extremes on both ends of the spectrum. And everything else is in between.
3. Relative size - How large is the trend in comparison with historical trends of the same time frame. We can use ATR metrics for this.
There is also another way to approach the whole thing. You can eliminate the time component and look only at price. For this we can use range bars or renko bars. They show different picture.
And in the end, things can be a lot simpler! For example If the current price is at or near the highest price of the last N bars we assume the trend is up. Cant argue with that. And we can ignore the internal structure.
As you said, there is no right or wrong method. Just different approaches and different strategies.
Really interesting breakdown, especially the part about trend smoothness and comparing impulsive vs corrective moves. I like the idea of keeping it simple as well with the “highest of N bars” logic, sometimes less is more. Thanks for sharing your perspective!
Reading the breakdown of relying on higher highs and basic tick ratios to define an algorithmic trend explains exactly why so many retail systems bleed capital during institutional liquidity sweeps, a basic fractal or N-bar reversal logic is mathematically blind to real order flow and simply curve-fits past data, meaning the moment the market shifts into a complex volatility expansion, your static tick ratios will signal a trend right as the smart money is actually exiting the position. If you want to define trend computationally without lagging disastrously behind the market, you absolutely must abandon these retail illusions and start calculating dynamic volume-weighted standard deviations to track where the actual institutional delta is accumulating rather than just connecting imaginary dots on a chart
Interesting point of view. I agree that many retail approaches can lag behind the market, especially in fast conditions. At the same time, accessing reliable volume/order flow data in FX can be quite challenging, so it’s always a balance between theory and what’s actually practical to implement.
Excellent question. In my experience developing algorithmic systems, relying solely on lagging indicators like moving averages often leads to late entry into fast-moving markets like gold.
In my current model, I combine three layers to define a trend:
- Multi- correlation analysis of the H4/H1 trend to determine the main direction even before looking for an entry into the M5.
- Dynamic volatility filters use ATR-based calculations to distinguish between a healthy trend and a "fake" uptrend.
- Price action confirmation is waiting for a specific candle close in the direction of the higher timeframe trend to confirm that momentum is indeed present.
This approach has allowed me to maintain a very low drawdown while maintaining a consistent win rate. Ultimately, it's a synergy between aligning timelines and managing risk.
That’s a very clean approach. I like the combination of higher timeframe direction with a volatility filter and price action confirmation, makes a lot of sense from both a logic and risk perspective. Thanks for sharing!
Good discussion regarding volume and order flow. It really highlights the limitations we have in FX compared to other markets, and how important it is to adapt strategies to the available data. Thankyou all for your response! :)
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Hello everyone,
I’m curious to hear how different developers in the community define and detect trend within their trading algorithms.
There are of course the more common approaches like moving averages or measuring percentage changes over a certain period, but I’m sure many of you are using more advanced or alternative methods.
It would be interesting to get some insight into:
What kind of logic you use to determine trend
Whether you rely on indicators, price action, or custom calculations
How you deal with ranging vs trending markets
Not looking for “right or wrong” answers, just genuinely interested in how others approach this and what has worked for you in practice.
Looking forward to hearing your perspectives!