PROTECTED SOURCE SCRIPT

PnF Chart

42
Point and Figure (P&F) charts are a time-independent technical analysis tool that focuses purely on price movements, filtering out noise like minor price fluctuations and time. Unlike candlestick or bar charts, P&F charts ignore time and only record significant price changes based on predefined rules.

Key Characteristics of P&F Charts

No Time Axis

Only price movements matter; time is irrelevant.

Columns form based on reversals, not fixed time periods.

Uses X's and O's

X = Rising prices (demand in control)

O = Falling prices (supply in control)

Box Size (Price Increment)

Defines the minimum price change required to plot a new X or O.

Example: If the box size is **1∗∗,astockmustmoveatleast1∗∗,astockmustmoveatleast1 to record a new X or O.

Reversal Amount

Determines how much the price must reverse to switch from X's to O's (or vice versa).

Common reversal settings: 3-box reversal (price must reverse by 3x the box size).

How P&F Charts Work
1. Rising Prices (X-Columns)

A new X is added if the price rises by the box size.

If the price reverses down by the reversal amount, a new O-column starts.

2. Falling Prices (O-Columns)

A new O is added if the price falls by the box size.

If the price reverses up by the reversal amount, a new X-column starts.

Example of a P&F Chart

Suppose:

Box Size = $1

Reversal Amount = 3-box (i.e., $3)

Price Movement Chart Update
Stock rises from 10→10→11 X at $11
Rises to $12 X at $12
Drops to 9(9(12 → 9=9=3 drop) New O-column starts at 11,11,10, $9
Rises again to 12(12(9 → 12=12=3 rise) New X-column at 10,10,11, $12

About the Script:This Script uses columns instead of traditional X and O boxes.Column Printing (Red vs Green)
This Point and Figure chart alternates between two states:

X columns (green): Represent upward price movements
O columns (red): Represent downward price movements

When Green Columns (X) Are Printed:
A green column is printed when:

The script is in "X mode" (is_x is true)
A new column is created (new_column_created is true)
This happens after the price has reversed upward by at least the "reversal boxes" threshold from a previous O column

When Red Columns (O) Are Printed:
A red column is printed when:

The script is in "O mode" (is_x is false)
A new column is created (new_column_created is true)
This happens after the price has reversed downward by at least the "reversal boxes" threshold from a previous X column


How Trendlines Are Created
The script can draw two types of trendlines when the show_trendlines option is enabled:
Green Trendlines (Uptrend):
A green trendline is created when:

There's a transition from O to X columns (cond2 is true but wasn't true on the previous bar)
This represents the beginning of a potential uptrend
The trendline is solid and extends to the right

Red Trendlines (Downtrend):
A red trendline is created when:

There's a transition from X to O columns (cond1 is true but wasn't true on the previous bar)
This represents the beginning of a potential downtrend
The trendline is dashed and extends to the right

The script maintains two trendline objects - current_trendline and previous_trendline - and deletes the oldest one when a new trendline is created to prevent cluttering the chart.
In summary, this Point and Figure chart tracks price movements in discrete boxes and changes column types (and creates trendlines) when price reverses by a significant amount (defined by the reversal_boxes parameter). The chart also generates alerts when these trend changes occur, helping traders identify potential trend reversals.

Declinazione di responsabilità

Le informazioni ed i contenuti pubblicati non costituiscono in alcun modo una sollecitazione ad investire o ad operare nei mercati finanziari. Non sono inoltre fornite o supportate da TradingView. Maggiori dettagli nelle Condizioni d'uso.