OPEN-SOURCE SCRIPT

Tape [LucF]

Cập nhật
█ OVERVIEW

This script prints an ersatz of a trading console's "tape" section to the right of your chart. It displays the time, price and volume​  of each update of the chart's feed. It also calculates volume​ delta for the bar. As it calculates from realtime information, it will not display information on historical bars.


█ FEATURES

Calculations
Each new line in the tape displays the last price/volume​ update from the TradingView feed that's building your chart. These updates do not necessarily correspond to ticks from the originating broker/exchange's matching engine. Multiple broker/exchange ticks are often aggregated in one  chart update.

The script first determines if price has moved up or down since the last update. The polarity of the price change, in turn, determines the polarity of the volume​​ for that specific update. If price does not move between consecutive updates, then the last known polarity is used. Using this method, we can calculate a running volume​ delta accumulation for the bar, which becomes the bar's final volume​ delta value when the bar closes (you can inspect values of elapsed realtime bars in the Data Window or the indicator's values). Note that these values will all reset if the script re-executes because of a change in inputs or a chart refresh.

While this method of calculating volume​ delta is not perfect, it is currently the most precise way of calculating volume​ delta available on TradingView at the moment. Calculating more precise results would require scripts to have access to bid/ask levels from any chart timeframe. Charts at seconds timeframes do use exchange/broker ticks when the feeds you are using allow for it, and this indicator will run on them, but tick data is not yet available from higher timeframes, for now. Also note that the method used in this script is far superior to the intrabar inspection technique used on historical bars in my other "Delta Volume​" indicators. This is because volume​ delta here is calculated from many more realtime updates than the available intrabars in history.

Inputs
You can use the script's inputs to configure:
 • The number of lines displayed in the tape.
 • If new lines appear at the top or bottom.
 • If you want to hide lines with low volume​.
 • The precision of volume​ values.
 • The size of the text and the colors used to highlight either the tape's text or background.
 • The position where you want the tape on your chart.
 • Conditions triggering three different markers.

Display
Deltas are shown at the bottom of the tape. They are reset on each bar. Time delta displays the time elapsed since the beginning of the bar, on intraday timeframes only. Contrary to the price change display by TradingView at the top left of charts, which is calculated from the close of the previous bar, the price delta in the tape is calculated from the bar's open, because that's the information used in the calculation of volume​ delta. The time will become orange when volume​ delta's polarity diverges from that of the bar. The volume  delta value represents the current, cumulative value for the bar. Its color reflects its polarity.

When new realtime bars appear on the chart, a ↻ symbol will appear before the volume​ value in tape lines.

Markers
There are three types of markers you can choose to display:
 • Marker 1 on volume​ bumps. A bump is defined as two consecutive and increasing/decreasing plus/minus delta volume​  values,
  when no divergence between the polarity of delta volume​ and the bar occurs on the second bar.
 • Marker 2 on volume​ delta for the bar exceeding a limit of your choice when there is no divergence between the polarity of delta volume​ and the bar. These trigger at the bar's close.
 • Marker 3 on tape lines with volume​ exceeding a threshold. These trigger in realtime. Be sure to set a threshold high enough so that it doesn't generate too many alerts.
  These markers will only display briefly under the bar, but another marker appears next to the relevant line in the tape.

The marker conditions are used to trigger alerts configured on the script. Alert messages will mention the marker(s) that triggered the specific alert event, along with the relevant volume​ value that triggered the marker. If more than one marker triggers a single alert, they will overprint under the bar, which can make it difficult to distinguish them.

For more detailed on-chart analysis of realtime volume​ delta, see my Delta Volume Realtime Action.


█ NOTES FOR CODERS

This script showcases two new Pine features:
 • Tables, which allow Pine programmers to display tabular information in fixed locations of the chart. The tape uses this feature.
  See the Pine User Manual's page on Tables for more information.
 • varip-type variables which we can use to save values between realtime updates.
  See the "Using `varip` variables" publication by PineCoders for more information.
Phát hành các Ghi chú
v2.0
Updated comments.
Phát hành các Ghi chú
v3.0
Added an option to count, in Volume Delta, the volume of consecutive updates where price does not change. When the option is selected (which is the default), the volume of updates where price does not change is added/subtracted to the volume delta depending on whether the last movement was up/down.
Phát hành các Ghi chú
v4.0
• Updates of volume less than a threshold can now be hidden. When they are, their volume values are still taken into account in volume delta calculations.
• You can now display a trace of the bar's final volume delta on elapsed bars.
• You can control the precision of volume values.
• New tape lines can now be added from the top down.

Thanks to Albertoil and sam_m400 for your suggestions.
Phát hành các Ghi chú
v5.0
• You can now control not only how many lines of tape are printed, but how many POC levels or volume  delta values you want to display on elapsed realtime bars.
 You can eliminate any of these displays by using a zero value. A value of one  only displays the repainting realtime POC or delta volume .
• The display of the tape has been improved by eliminating empty lines when it has not yet filled.
• Because the line of the average closes is by default now weighed using the volume  of each price update, it is now called the Point of Control (POC).
 While the calculation combines price levels and volume​, it is different than the one​ used to calculate the POC in a Volume Profile. You can turn off the volume-weighing.
• You can show divergences on both the POC line and the volume  delta.
 A POC divergence occurs when, for example, an up bar closes below the POC. A volume  delta divergence occurs when its polarity does not match the bar's direction.
• Volume  delta bumps are now identified as brighter-colored volume  delta values under the bar, with an arrow in the direction of the bump.
 A bump is defined as two consecutive and increasing/decreasing plus/minus delta volume  values, when no divergence occurs on the second bar.
 Bumps can occur when a movement is gathering strength, but they can also occur at pauses or tops/bottoms.
 For that reason, it is best to adopt a conservative interpretation of bumps, and price action should be used to complement their interpretation.
 For example, be wary of bumps that occur on long wicks, on small bodies, or when price action does not correlate them, by not making higher highs or lower lows, for example.
 Prefer bumps that occur on solid bodies with small wicks.
• You can configure alerts on bumps. Before creating an alert on the script, you must configure the alert triggering conditions at the bottom of the script's inputs.
 Alerts only trigger at the bar's close, so they never repaint.
 Note that discrepancies are to be expected between alert triggers and the larger triangles that appear on bumps when an alert condition is detected.
 This is because the alert and the indicator are running two distinct instances of the script, and exchange/broker ticks are not always aggregated the same way for both.
Phát hành các Ghi chú
v6.0
• The volume​ delta value for each bar now displays in the Data Window.
• Added markers on two new events:
 • Volume​ delta for the bar when it exceeds a threshold and no volume​ delta divergence occurs on the bar. These trigger at the bar's close.
 • Tape lines with volume​ exceeding a threshold. These trigger in realtime. Be sure to set a threshold high enough so that it doesn't generate too many alerts.
  These markers will only display briefly under the bar, but another marker appears next to the relevant line in the tape.
 With the existing marker on volume​ bumps, that's three different conditions that can be used to trigger a single alert configured on the script.
 Alert messages will mention the marker(s) that triggered the specific alert event, along with the relevant volume​ value that triggered the marker.
 If more than one marker triggers a single alert, they will overprint under the bar, which can make it difficult to distinguish them.
 In those cases, the alert message will contain information from multiple events.

Note that whereas the volume​ delta bump markers displayed by default in the previous version of the script, you now have to turn them on explicitly in the inputs' "Markers" section, along with the other markers you want to display.

Remember that discrepancies are to be expected between alert triggers and the on-chart display, as calculations for both use different feeds for which exchange/broker ticks may be aggregated differently. The smaller the chart's TF, the more discrepancies are to be expected.
Phát hành các Ghi chú
v7.0
• I have streamlined the indicator. It was suffering from feature creep, so I moved the POC line and bar by bar volume​ delta functionality
 in a more powerful new script dedicated to that purpose, which will make this one run faster.
 This script will keep the "tape" functionality, with its existing alerts.
• Traders interested in having realtime volume​ delta information on charts to trade small timeframes
 can look up my new Delta Volume​ Realtime Action.
• This version of the script uses the new tables feature in Pine to display the tape. It makes for a much more flexible display,
 as you can move the tape around the periphery of the chart's space, and it won't move as you scroll or scale your chart.
 Using the new feature allowed me to color the tape lines on price changes, which should increase its usability.
• The tape now grows only once and from then on the lines simply scroll, continuing when new bars come up.
 A circular arrow marks the tape lines where new bars come in.
• As usual, I tried to provide traders with lots of options, which you will find in the script's inputs. I hope you find them useful.v4.0
• Updates of volume less than a threshold can now be hidden. When they are, their volume values are still taken into account in volume delta calculations.
• You can now display a trace of the bar's final volume delta on elapsed bars.
• You can control the precision of volume values.
• New tape lines can now be added from the top down.
Phát hành các Ghi chú
v8
Added an input to hide the "Time" column from the tape.
Phát hành các Ghi chú
v9
A new "Timezone" field in the inputs allows you to adjust the displayed time.
deltaVolume IndicatorVolume

Mã nguồn mở

Theo tinh thần TradingView thực sự, tác giả của tập lệnh này đã xuất bản dưới dạng nguồn mở để các nhà giao dịch có thể hiểu và xác minh. Chúc mừng tác giả! Bạn có thể sử dụng miễn phí. Tuy nhiên, bạn cần sử dụng lại mã này theo Quy tắc nội bộ. Bạn có thể yêu thích nó để sử dụng nó trên biểu đồ.

Bạn muốn sử dụng tập lệnh này trên biểu đồ?


"The stock market is a device for transferring money from the impatient to the patient."
— Buffet

tradingview.com/u/PineCoders/
tradingview.com/u/TradingView/
Ngoài ra, trên:

Thông báo miễn trừ trách nhiệm