OPEN-SOURCE SCRIPT

Daily Moving Average for Intraday Timeframes

codehotep의
This indicator provides a dynamic tool for visualizing the Daily Moving Average (DMA) on intraday timeframes.

It allows you to analyze how the price behaves in relation to the daily moving average in timeframes from 1 minute up to 1 day.


KEY FEATURES

DMA on Intraday timeframes only: This indicator is designed to work exclusively on intraday charts with timeframes between 1 minute and 1 day. It will not function on tick, second-based, or daily-and-above charts.

Color-Coded Zones for Trend Identification:
  • Green Zone: The price is above a rising DMA, signaling a bullish momentum.
  • Red Zone: The price is below a falling DMA, signaling a bearish momentum.
  • Yellow Zone: Signaling uncertainty or mixed conditions, where either the price is above a falling DMA or below a rising/flat DMA.


Configurable DMA Period: You can adjust the number of days over which the DMA is calculated (default is 5 days). This can be customized based on your trading strategy or market preferences.

24/7 Market Option: For assets that trade continuously (e.g., cryptocurrencies), activate the "Is trading 24/7?" setting to ensure accurate calculations.



WHAT IS THE DMA AND WHY USE IT INTRADAY?

The Daily Moving Average is a Simple Moving Average indicator used to smooth out price fluctuations over a specified period (in days) and reveal the underlying trend.

Typically, a SMA takes price value for the current timeframe and reveal the trend for this timeframe. It gives you the average price for the last N candles for the given timeframe.

But what makes the Intraday DMA interesting is that it shows the underlying trend of the Daily timeframe on a chart set on a shorter timeframe. This helps to align intraday trades with broader market movements.

HOW IS THE DMA CALCULATED?

If we are to build a N-day Daily Moving Average using a Simple Moving Average, we need to take the amount of candles A needed in that timeframe to account for a period of a day and multiply it by the number of days N of the desired DMA.

So for instance, let say we want to compute the 5-Day DMA on the 10 minute timeframe :
  • In the 10 minute timeframe there are 39 candles in a day in the regular session.
  • We would take the 39 candles per day and then multiply that by 5 days. 39 x 5 = 195.
  • So a 5-day moving average is represented by a simple moving average with a period of 195 when looking at a 10 minute timeframe.


So for each period, to create a 5-day DMA, you would have to set the period of your simple moving average like so :
- 195 minutes = 10 period
- 130 minutes = 15 period
- 65 minutes = 30 period
- 30 minutes = 65 period
- 15 minutes = 130 period
- 10 minutes = 195 period
- 5 minutes = 390 period
and so on.

This indicator attempts to do this calculation for you on any intraday timeframe and whatever the period you want to use is for your DMA. You can create a 10-day moving average, a 30-day moving average, etc.
dailymovingaverageDMAintradayMoving AveragesSimple Moving Average (SMA)Trend Analysis

오픈 소스 스크립트

진정한 TradingView 정신에 따라, 이 스크립트의 저자는 트레이더들이 이해하고 검증할 수 있도록 오픈 소스로 공개했습니다. 저자에게 박수를 보냅니다! 이 코드는 무료로 사용할 수 있지만, 출판물에서 이 코드를 재사용하는 것은 하우스 룰에 의해 관리됩니다. 님은 즐겨찾기로 이 스크립트를 차트에서 쓸 수 있습니다.

차트에 이 스크립트를 사용하시겠습니까?

면책사항