OPEN-SOURCE SCRIPT

Multi Timeframe Trend Strength

This code is an advancement of my previous percentile-based trend strength. It follows the same concept, except this code display the trend and trend strength in multiple timeframe (1 min, 5 min, 15 min, 1hr and 4hr).

This gives an indication of the trend is evolving and allows to see how short-term trend matches with the long-term trend.

How it works:
The script assesses trend strength through percentile values derived from high and low prices across various time periods. It categorizes the current trend as either Bullish, Bearish, or N/A (No Trend) with the following steps:

Percentile Calculations: The code calculates the 75th percentile of high prices (e.g., percentile_13H) and the 25th percentile of low prices (e.g., percentile_13L) for specified Fibonacci-based periods (13, 21, 34, 55, 89, and 144). These percentiles serve as thresholds for identifying strong trends.

Calculate Highest High and Lowest Low: It computes the highest high (75th percentile high price of the longest period) and lowest low (25th percentile low price of the longest period), referred to as highest_high and lowest_low. These values establish critical price levels.

Trend Strength Conditions: For each percentile and period, the code checks if the percentile exceeds the highest high (trendBull) or falls below the lowest low (trendBear). These conditions gauge the strength of bullish and bearish trends.

Count Bull and Count Bear: Variables countBull and countBear tally the number of bullish and bearish conditions met, helping assess trend strength.

Weak Bull and Weak Bear Count: The code calculates weak bullish and bearish conditions, occurring when percentiles fall within the range defined by highest_high and lowest_low but don't meet strong trend criteria.

Bull Strength and Bear Strength: bullStrength and bearStrength are calculated based on counts of bullish, bearish, weak bullish, and weak bearish conditions, representing overall trend strength.

Strong Bull and Bear Conditions: These conditions arise when the 75th percentile of high prices (bull conditions) or the 25th percentile of low prices (bear conditions) surpass or dip below the highest high or lowest low, respectively, for the specified period. Strong conditions indicate robust trends with significant price movements.

Weak Bull and Bear Conditions: Weak conditions occur when percentiles fall within the range between highest_high and lowest_low, suggesting some bullish or bearish tendencies without reaching extreme levels. These imply less decisive trends.

Current Trend Identification: The current trend is determined by comparing bullStrength and bearStrength. A greater bullStrength indicates a Bull trend, greater bearStrength implies a Bear trend, and equal values denote No Trend (N/A).
multitimeframepercentileTrend Analysistrendstrength

开源脚本

本着真正的TradingView精神,此脚本的作者已将其开源,以便交易者可以理解和验证它。向作者致敬!您可以免费使用它,但在出版物中重复使用此代码受网站规则约束。 您可以收藏它以在图表上使用。

想在图表上使用此脚本?

免责声明