OPEN-SOURCE SCRIPT

Multi-Timeframe EMA Distance & % Change Table

Description of Multi-Timeframe EMA Distance & % Change Table

The Multi-Timeframe EMA Distance & % Change Table indicator is designed to display the distance and percentage change between the current price and the Exponential Moving Averages (EMAs) on multiple timeframes. It creates a table to show these values, with customizable options for decimal precision.

Key Features:

  • Inputs:
    - Timeframes (tf1, tf2, tf3, tf4): User-defined timeframes for EMA calculations (e.g., 1 minute, 15 minutes, daily, etc.).
    - EMA Levels (emaLevel, emaLevel2, emaLevel3): User-defined periods for three different EMAs.

  • EMA Calculations:
    - Computes EMAs for the specified levels (50, 100, 200) on each of the user-selected timeframes.

  • Plotting:
    - Plots the EMAs on the chart with distinct colors: Orange, Teal, and Green for different EMAs.

  • Display Options:
    - Checkbox (displayAsPercentage): Allows the user to toggle between displaying distances or percentage changes.
    - Decimal Precision:
    - decimalPlacesDistance: Specifies the number of decimal places for rounded distance values.
    - decimalPlacesPercentage: Specifies the number of decimal places for rounded percentage values.

  • Table Creation:
    - Location: Table is placed in the top-right corner of the chart.
    - Headers: Includes columns for each timeframe and EMA distance/percentage.

  • Distance and Percentage Calculations:
    - Distances: Calculated as the difference between the current price and the EMA values for each timeframe.
    - Percentages: Calculated as the distance divided by the EMA value, converted to a percentage.

  • Decimal Rounding:
    - Custom Rounding Function: Ensures that distance and percentage values are displayed with the user-specified number of decimal places.

  • Color Coding:
    - Distance Values: Colored green if positive, red if negative.
    - Table Entries: Display either the rounded distance or percentage, based on user selection.

  • Table Update:
    - The table is dynamically updated with either distance or percentage values based on the user's choice and rounded to the specified number of decimal places.


This indicator provides a comprehensive overview of EMA distances and percentage changes across multiple timeframes, with detailed control over the precision of the displayed values.
distancetableExponential Moving Average (EMA)EMASmulti-timeframeprice-action-analysisTechnical AnalysisTriple Exponential Moving Average (TEMA)Trend Analysis

开源脚本

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

想在图表上使用此脚本?

免责声明