PROTECTED SOURCE SCRIPT
تم تحديثه

CBA BLOCK CHARTING VERSION 1

151
Script Summary
Purpose: The script—titled CBA BLOCK CHARTING VERSION 1—visually segments a price chart into “blocks” based on a fixed number of bars. Each block is analyzed to determine the maximum (high) and minimum (low) prices within that span, and these levels are marked with horizontal and vertical lines. Optionally, the script can also group multiple blocks into larger clusters to highlight broader market ranges.

Core Functionality:

Block Calculation:

Block Definition: A block is defined as a fixed number of consecutive bars (set by the user, e.g., 10 bars per block).

Block End Determination: The script checks when the current bar is the last of the block (using a modulo operation on the bar index).

Price Extremes: It calculates the block's high and low manually over the defined number of bars.

Drawing on the Chart:

Horizontal Lines:

Drawn at the block’s high and low levels.

If grouping is enabled, additional horizontal lines denote the high and low for a group of blocks.

Vertical Lines:

Drawn at the start and end of each block to visually bracket the block area.

For a grouped set of blocks, vertical lines mark the group’s boundaries.

Grouping Feature:

Optional Grouping: You can enable grouping to aggregate a preset number of blocks (e.g., 10 blocks per group) and compute group-wide high and low values.

Group Boundaries: Similar to individual blocks, the group’s price extremes are highlighted with horizontal and vertical lines.

Customization Options:

Input Parameters:

Bars per Block: Sets how many bars constitute one block.

Enable Grouping & Group Size: Toggle the grouping feature and set the number of blocks to include in a group.

Drawing Style Settings:

Vertical Line Style & Width: Choose between “solid,” “dotted,” or “dashed” styles and adjust the width.

Horizontal Line Widths: Separate settings for block and group horizontal lines.

Color Settings:

Customize the colors for lines representing block/group tops, bottoms, and vertical boundaries.

Performance Settings:

Cleanup Option: Automatically remove old drawing objects if they exceed a set maximum (e.g., 300 objects) to prevent performance issues.

Instructions of Use
Parameter Setup:

Define Block Size:

Set the number of bars that make up a block using the "Bars per Block" input.

Enable or Disable Grouping:

If you want to aggregate blocks into larger groups, toggle “Enable Grouping Blocks” and specify the “Blocks per Group.”

Configure Visual Style:

Choose your preferred vertical line style (solid, dotted, or dashed) and adjust both vertical and horizontal line widths.

Select Colors:

Customize individual colors for the high and low levels of blocks/groups as well as for the starting and ending vertical lines.

Performance Options:

Ensure that old drawing objects are cleared by keeping “Auto Clean Up Old Drawings” enabled and set an appropriate maximum limit.

Adding to Your TradingView Chart:

Copy and paste the script into your TradingView Pine Editor.

Save and add the indicator to your chart.

The script will automatically detect the end of each block and draw the corresponding horizontal and vertical lines. If grouping is activated, it will also highlight the group boundaries based on your defined inputs.

Interpreting the Visuals:

Block Lines:

Horizontal Lines: Represent the highest and lowest prices within each individual block.

Vertical Lines: Mark the starting and ending points of each block.

Group Lines (if enabled):

These lines summarize the overall price range for a group of blocks, providing a broader market perspective.

Additional Considerations
Flexibility: Adjusting the input settings lets you tailor the indicator to your trading style and the time frame you analyze.

Performance: The cleanup function is an essential feature for preventing chart clutter if many blocks or groups accumulate over time.

Customization: The script’s modular design means you can further tweak or expand it. For instance, you might add alerts based on block breakouts or combine it with other indicators for enhanced analysis.
ملاحظات الأخبار
UPDATE: Added volume table data.
Added green and red triangles noting down or up vol per bar on the bar itself.
ملاحظات الأخبار
UPDATED: Made a few minor script changes to increase user ability to make color and line choices.
ملاحظات الأخبار
Changed the table location to bottom left of chart.
ملاحظات الأخبار
Table now shows Highs and lows for the bars and blocks. The highs and lows for the group block is the average set by the users input on how many bars in a block and how many blocks in a group block.
Table Dimensions Expanded: The original table was 7 columns by 3 rows. We expanded it to 7 columns by 5 rows by adding two extra rows.

Preserved Original Volume Data: The first two data rows (after the header) continue to display “Vol Up” and “Vol Down” values with the same color coding as before (green for volume up, red for volume down).

Added HIGHS and LOWS Rows: Two new rows have been added below the original volume rows:

HIGHS Row: Displays the high values. In block columns, it shows the average high over the block (or the partial block if active), and in bar columns it shows the actual high. If a computed value rounds to 0 (an unlikely event), that cell displays an empty string.

LOWS Row: Similarly, it shows the block’s average low or the actual low for bars, with a check to omit a 0 value.

Updated Color Coding:

All header cells in the top row (Row 0) have been set to blue.

The HIGHS row’s header cell (the leftmost cell in the HIGHS row) is now explicitly set to green, and the rest of the row is also colored green.

The LOWS row remains with red text for consistency with the volume down coloring.

Adjustment to Volume Aggregation Logic: To ensure that “Active Block Vol Down” (and similar down-volume calculations) never shows 0 when there’s a nonzero volume, the logic was modified so that when two consecutive volume values are equal, the volume is split evenly between the “up” and “down” totals.

Cleanup Function Retained: The cleanup function for drawing objects remains part of the script, ensuring that the array of drawn lines is kept within the defined limits.

These changes preserve the originally intended volume information while augmenting the table with HIGHS and LOWS rows—and they introduce updated color coding and logic adjustments to ensure no impossible (zero) values are displayed.
ملاحظات الأخبار
Added a user input for trading symbols under $0.01 by allowing the user to input decimal places for the table to post accurate values. Default is 4 decimal places.

إخلاء المسؤولية

لا يُقصد بالمعلومات والمنشورات أن تكون، أو تشكل، أي نصيحة مالية أو استثمارية أو تجارية أو أنواع أخرى من النصائح أو التوصيات المقدمة أو المعتمدة من TradingView. اقرأ المزيد في شروط الاستخدام.