"Delta Dashboard with Custom Candle Count," creates a dynamic table on a chart that shows Buying Delta, Selling Delta, and Cumulative Delta for a user-defined number of candles. It is designed to give traders an easy-to-read visual dashboard for analyzing volume-based deltas, potentially helping to identify bullish or bearish trends.
Script Overview:
Custom Timeframe Input: The user has the option to enable a custom lower timeframe (useCustomTimeframeInput). If enabled, the script uses the lowerTimeframeInput (default is 1 minute) to request data from a lower timeframe. If not enabled, the script automatically selects a timeframe based on the chart’s current settings.
Candle Count Input: The script allows the user to specify the number of candles (numCandlesInput) for which they want to track volume deltas. This input determines how many columns are included in the delta dashboard.
Proportional Buy/Sell Volume Calculation: The script calculates the buy and sell volume for each candle. The buy volume is based on how much the price has moved up from the low, while the sell volume is based on how much the price has moved down from the high. The total volume is then split between buyers and sellers for a more accurate volume-based analysis.
Lower Timeframe Volume Data: The script requests volume data from the lower timeframe and uses it to calculate the positive (buying) and negative (selling) volume arrays over the specified number of candles.
Cumulative Delta: The cumulative delta is calculated as the difference between buying volume (positiveVolume) and selling volume (negativeVolume). The delta is accumulated over the day, and it resets at the start of each new day.
Dashboard Creation: The script creates a table (deltaTable) that is displayed on the chart, showing the following for each candle:
Buying Delta: The volume of buy orders.
Selling Delta: The volume of sell orders.
Cumulative Delta: The net difference between buying and selling volumes over the course of the day.
Dynamic Table Updating: The table updates with each new candle. The current candle's data is dynamically added to the table, and older candles shift to the left. When the maximum number of candles (as defined by numCandlesInput) is reached, the table wraps around, continuously updating with the latest data.
Abnormal Volume Detection: The script highlights candles where abnormal volume is detected. If the buying or selling volume for a particular candle is greater than twice the 50-period moving average volume, it highlights the respective cells in the table with shaded background colors:
Green: Indicates abnormal buying volume.
Red: Indicates abnormal selling volume.
Blue: Highlights abnormal cumulative delta spikes.
Daily Reset: The script automatically clears the table at the start of each new day, ensuring that the dashboard only reflects data from the current trading day.
How to Use:
Adding to Chart: To use this script, apply it to your TradingView chart. The dashboard will automatically appear in the upper left corner of the chart, showing volume-based delta data for each candle.
Customizing Timeframe: If you want to use a different timeframe for delta calculation (e.g., 1-second or 1-minute chart data), enable the Use Custom Timeframe option and specify the desired timeframe in the input section.
Adjusting the Number of Candles: You can adjust the number of candles shown in the delta dashboard by changing the Number of Candles input. The script will track the volume deltas for this number of candles, displaying them in the dashboard.
Interpreting the Dashboard:
Buying Delta: A higher positive value indicates stronger buying pressure in that candle.
Selling Delta: A higher negative value indicates stronger selling pressure in that candle.
Cumulative Delta: This value gives the net result of buying versus selling pressure across the trading day. Positive cumulative delta suggests buying dominance, while negative cumulative delta suggests selling dominance.
Abnormal Volume Detection: When abnormal volume spikes occur, pay attention to highlighted rows:
Green cells show that buying volume is unusually high.
Red cells indicate unusually high selling volume.
Blue cells mark large spikes in cumulative delta.
This script can be particularly useful for traders who want to gauge market sentiment based on volume distribution and detect abnormal trading activity, which could precede significant price movements.