OPEN-SOURCE SCRIPT

Multi-Timeframe Trend Indicator

Updated
The Multi-Timeframe Trend Indicator (MTFTI) is a trend analysis tool designed to help traders quickly and easily assess the market direction across multiple timeframes. With the help of a table to visualize the trends on different timeframes.

Key features:
  • Multi-timeframe trend indicator for the following timeframes: 5 minutes, 15 minutes, 30 minutes, 1 hour, 2 hours, 4 hours, 6 hours, 12 hours, 1 day, and 1 week and average.
  • Displays trends for selected timeframes in a table.
  • Considers short and long-term exponential moving averages (EMAs) to determine trends.
  • Calculation of the average trend for all timeframes.
  • Display of trends with appropriate coloring for better readability (green for "Up", red for "Down", and intermediate shades for neutral or strong trends).


List of Parameters
  • Customization of the table's position on the screen (top-left, top-right, middle-left, middle-right, bottom-left, bottom-right).
  • Setting the lengths of the short and long-term exponential moving averages.
  • Option to activate or deactivate the display of EMAs for better customization (true by default).



Please note that the MTFTI is not a guarantee of future market performance and should be used in conjunction with proper risk management. Always ensure that you have a thorough understanding of the indicator’s methodology and its limitations before making any investment decisions. Additionally, past performance is not indicative of future results.
Release Notes
Updated code formatting.
Release Notes
Update Note for Multi-Timeframe Trend Indicator (MTFTI)


New Features:
  1. Options to Show/Hide Specific Timeframes: Users can now choose to show or hide specific timeframes in the trend table. This is controlled by the new input variables showTf1, showTf2, ..., showTf11.
  2. Dynamic Average Trend Calculation: The script now calculates the average trend based only on the displayed timeframes, making the average more relevant to the user.


Modifications:
  1. Removal of Trend Line on Chart: The new version does not contain the trend line (plot(0, "Trend", color=color.gray, linewidth=1, style=plot.style_stepline)) that was present in the previous version.
  2. Average Trend Calculation: The calculation of the average trend (trendAvg) has been modified to account for only the active timeframes, thereby avoiding division by zero.


Code Improvements:
  1. Initialization of trendSum and activeTfs Variables: New variables have been introduced to dynamically handle the calculation of the average trend.
  2. Conditional Table Cell Filling: Conditions have been added for filling the table cells based on the displayed timeframes.




Release Notes

Update Note: Multi-Timeframe Trend Indicator (MTFTI)
The recent version of the MTFTI indicator introduces a series of technical and functional enhancements aimed at optimizing the trend analysis experience for users. This update focuses on extending analytical capabilities, advanced customization, and improving code efficiency.

Added Features and Optimizations :
  • Choice of Moving Average Type: Incorporation of an option allowing users to select among various types of moving averages (SMA, EMA, WMA, AMA). This feature enriches analysis by offering adaptability to diverse trading methodologies.
  • Extension of Timeframe Selections: Addition of extra timeframes, including shorter intervals such as 1min, 2min, and 3min, thus facilitating more detailed and granular analysis.
  • Customization of Display: Introduction of the capability for users to hide or display timeframes according to their preferences, offering a more targeted user experience and improved performance by reducing unnecessary calculations.
  • Dynamic Calculation of Moving Averages: Implementation of a dynamic approach for calculating moving averages via the calcMa function, allowing flexible selection of the moving average type and replacing the previous method based exclusively on the EMA.
  • In-depth Trend Analysis: Trends are now assessed using short-term and long-term moving averages for each selected timeframe, providing a more comprehensive perspective on market dynamics.
  • Advanced Alert System: Implementation of alert conditions based on the average trend value (trendAvg), activating notifications for various market situations from “Strong Down” to “Strong Up”.
  • Code Optimization: Streamlining of the code structure, notably by the early initialization of trend variables, to minimize errors and improve readability and script maintenance.




Release Notes
minor adjustment
Release Notes
Bug Fix: Fixed an issue reported by XRIICrypto affecting the use of the 10-minute trend. I appreciate the community feedback that helps me improve this script.

In Progress: I am currently working on enhancing user experience by greying out time units that cannot be retrieved due to chart history or TradingView limitations. This update will be made available soon.

Thank you for your support and patience as I continue to develop and refine the script.
downdowntrendEMASexponentialmovingaveragemultitimeframeTrend Analysistrendtradingup

Open-source script

In true TradingView spirit, the author of this script has published it open-source, so traders can understand and verify it. Cheers to the author! You may use it for free, but reuse of this code in publication is governed by House rules. You can favorite it to use it on a chart.

Want to use this script on a chart?

Disclaimer