pineCopyindicator('MTF Countdown with Direction - Aynet', overlay = true)
This code creates a Multiple Time Frame (MTF) countdown indicator with direction The overlay = true parameter places the indicator on top of the price chart
Timeframe Options:
Users can choose to show/hide the following timeframes:
Calculates the current time Converts Unix timestamp to seconds Calculates time since midnight Returns time broken down into hours, minutes, and seconds
Countdown Calculation:
pineCopyget_period_countdown(period_seconds)
Calculates remaining time for each timeframe Computes elapsed time in current period Returns remaining time in hours, minutes, and seconds
Direction and Closing Price Calculation:
Separate functions for each timeframe (get_direction_and_close_1m(), get_direction_and_close_5m(), etc.) Each function:
Gets current closing price Compares with previous closing price Determines direction (up: 1, down: -1, sideways: 0) Returns direction and closing price
Table Creation and Updates:
Creates a table in the top right corner Table consists of 4 columns:
Period (Timeframe) Time Left (Remaining time) Direction (Shown with arrows) Close (Closing price)
Each row has a different background color Direction arrows:
Green up arrow (▲): Price rising Red down arrow (▼): Price falling Gray line (―): Price sideways
Dynamic Data Structures:
pineCopyvar timeframes = array.new_int() var timeframe_names = array.new_string() var show_array = array.new_bool()
Uses dynamic arrays for timeframes Adds selected timeframes to arrays on first run
Key Features:
Shows remaining time until period close Displays price direction for each timeframe Shows current closing prices All information in a single, easy-to-read table
This indicator helps traders by providing a comprehensive view of:
When each timeframe will close The direction of price movement Current closing prices
across multiple timeframes in a single table, making it easier to track market movements across different time periods. The color-coding and arrow system makes it visually intuitive to understand market direction at a glance, while the countdown timer helps with timing decisions.
Dans le plus pur esprit TradingView, l'auteur de ce script l'a publié en open-source, afin que les traders puissent le comprendre et le vérifier. Bravo à l'auteur! Vous pouvez l'utiliser gratuitement, mais la réutilisation de ce code dans des publications est régie par nos Règles. Vous pouvez le mettre en favori pour l'utiliser sur un graphique.
Les informations et les publications ne sont pas destinées à être, et ne constituent pas, des conseils ou des recommandations en matière de finance, d'investissement, de trading ou d'autres types de conseils fournis ou approuvés par TradingView. Pour en savoir plus, consultez les Conditions d'utilisation.