MC2021TM

Dynamic 5-Day Moving Average

The Dynamic 5-Day Moving Average (MA) indicator is designed to provide traders with a consistent, time-adjusted moving average line across various timeframes. This indicator is especially useful for traders who switch between multiple timeframes and want a moving average that represents a fixed 5-day period, ensuring that the MA reflects a consistent lookback period relative to the amount of trading time each candle represents.

Features:

  • Timeframe Adaptability: Automatically adjusts the MA period to correspond to a 5-day lookback, regardless of the selected timeframe.
  • Intraday Precision: For intraday charts (5m, 15m, 30m, 1h, 2h, 4h), the indicator calculates the number of periods within the 5-day span based on the chart's timeframe.
  • Daily and Weekly Timeframe Compatibility: Sets the period to 5 for daily charts to maintain the 5-day MA, and to 1 for weekly charts, where each candlestick represents a week's worth of trading days.

Calculation Logic:

  • The indicator begins by defining the total number of trading minutes in 5 days, based on a standard 6.5-hour trading day.
  • A dynamic period calculation function then determines the number of those intervals that fit into the 5-day minute total for the selected timeframe.
  • For daily charts, the period is a straightforward 5, while for weekly charts, the period is set to 1, reflecting the average of the past 5 trading days.
開源腳本

本著真正的TradingView精神,該腳本的作者將其開源發布,以便交易者可以理解和驗證它。為作者喝彩吧!您可以免費使用它,但在出版物中重複使用此代碼受網站規則的約束。 您可以收藏它以在圖表上使用。

免責聲明

這些資訊和出版物並不意味著也不構成TradingView提供或認可的金融、投資、交易或其他類型的意見或建議。請在使用條款閱讀更多資訊。

想在圖表上使用此腳本?