OPEN-SOURCE SCRIPT

Enhanced Trend Arrows with Moving Average [ST]

От ArionSoteTrader
Enhanced Trend Arrows with Moving Average

Description in English:

This indicator is designed to identify market trends using a moving average and displays arrows after three consecutive closes above or below the moving average. It helps traders visualize confirmed trends and make informed decisions.

Detailed Explanation:

Configuration:

Length: Defines the period over which the moving average is calculated. The default value is 14.

MA Type: Allows choosing between a Simple Moving Average (SMA) and an Exponential Moving Average (EMA).

Uptrend Color: Sets the color of the arrows indicating an uptrend. The default color is green.

Downtrend Color: Sets the color of the arrows indicating a downtrend. The default color is red.
Moving Average Calculation:

The moving average (MA) is calculated based on the selected type (SMA or EMA) and period. The SMA is the simple arithmetic mean of the closing prices over the specified period, while the EMA gives more weight to recent prices.

Trend Identification:

The script detects when the price crosses above (crossover) or below (crossunder) the moving average.

When a crossover occurs (price moves above the MA), it indicates a potential uptrend, and the trend variable is set to 1.

When a crossunder occurs (price moves below the MA), it indicates a potential downtrend, and the trend variable is set to -1.

The script tracks the closing price at the crossover or crossunder point using the trendPrice variable.

It also counts consecutive bars above or below the moving average to confirm the trend, using above_count for uptrend and below_count for downtrend.

Arrow Display:

The script displays an up arrow ("▲") after three consecutive closes above the moving average, indicating a confirmed uptrend.

Similarly, it displays a down arrow ("▼") after three consecutive closes below the moving average, indicating a confirmed downtrend.

The arrows are displayed at the trendPrice level to clearly indicate the point at which the trend was confirmed.

Indicator Benefits:

Trend Identification: Helps traders identify market trends using moving averages, which are widely used in technical analysis.

Visual Cues: The arrows provide clear visual signals for confirmed trends, making it easier for traders to make informed decisions.

New Features and Enhancements:

This script has been enhanced to provide more accurate trend identification by ensuring arrows are only displayed after three consecutive closes above or below the moving average.

The color customization options for uptrend and downtrend arrows have been added for better visualization.

Improved description and explanations to make the functionality and usage of the indicator clearer.
forecastingMoving Averagessentiment
ArionSoteTrader

Скрипт с открытым кодом

В истинном духе TradingView автор этого скрипта опубликовал его с открытым исходным кодом, чтобы трейдеры могли понять, как он работает, и проверить на практике. Вы можете воспользоваться им бесплатно, но повторное использование этого кода в публикации регулируется Правилами поведения. Вы можете добавить этот скрипт в избранное и использовать его на графике.

Хотите использовать этот скрипт на графике?

Отказ от ответственности