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. اقرأ المزيد في شروط الاستخدام.

هل تريد استخدام هذا النص البرمجي على الرسم البياني؟