Zero repainting TB_PriceAction


TB_PriceAction

Platform: Tickblaze 2 · Type: Overlay Indicator · Language: C# / .NET 10


What it does

TB_PriceAction automatically labels every confirmed swing high and swing low on your price chart with a market structure tag. At a glance you can see whether the market is building higher highs and higher lows (uptrend), lower highs and lower lows (downtrend), or forming a potential reversal via double tops and double bottoms.

Six labels:

Label

Full name

Meaning

HH

Higher High

Swing high above the previous swing high — bullish

LH

Lower High

Swing high below the previous swing high — bearish

DT

Double Top

Two consecutive swing highs at the same price level — potential reversal

HL

Higher Low

Swing low above the previous swing low — bullish

LL

Lower Low

Swing low below the previous swing low — bearish

DB

Double Bottom

Two consecutive swing lows at the same price level — potential reversal


Parameters

Hover over any parameter in the settings panel to see a full description — every field has an inline tooltip built in.

Parameter

Default

Description

Strength

3

How many bars to the left and right the swing bar must dominate. Strength = 3 means the bar must be the extreme of 7 consecutive bars. Higher = fewer, more significant swings.

Text Offset (ticks)

3

Vertical gap between the label and the swing price. Increase if labels overlap with wicks.

DTB Strength (%)

15

Tolerance for Double Top / Double Bottom, as a percentage of ATR(14). Two highs within 15% of ATR of each other → labelled DT, not HH/LH.

Font

Arial 12

Font for all chart labels.

HH / HL Color

Green

Color for bullish structure labels.

LH / LL Color

Red

Color for bearish structure labels.

DT / DB Color

Yellow

Color for double top / double bottom labels.


Technical highlights

✦ Zero repainting Swing confirmation is shifted back Strength + 1 bars from the current bar. The algorithm only examines fully closed, historically frozen bars — never the forming candle. Once a label appears on the chart it will never move or disappear. This makes the indicator safe for strategy backtesting and live alert triggers.

✦ ATR-adaptive Double Top / Bottom detection Most indicators define a fixed tick tolerance for equality checks ("within 5 ticks = double top"). TB_PriceAction uses ATR(14) × DTBStrength% instead. On a volatile daily chart ATR may be 50 ticks; on a quiet 1-minute chart it may be 3. The same percentage threshold adapts automatically to both — no manual re-tuning when you switch timeframes or instruments.

✦ Optimised rendering Labels are computed once in Calculate() and stored in two internal lists — one for highs, one for lows. The OnRender() method does nothing but iterate those lists and skip anything outside the visible window. No search loops, no recalculation on every frame. Scrolling and zooming remain instant even on charts with thousands of bars.

✦ Clean state on reload All internal collections are fully cleared in Initialize(). If you change Strength, colors, or timeframe while the chart is live, the indicator resets instantly with no leftover labels, no duplicates, and no memory accumulation.

✦ Precise warmup The calculation starts after exactly ATR period (14) + Strength + 1 bars — the minimum mathematically required to have a valid ATR reading and a confirmed first swing. Not a single bar is wasted.


Strategy integration

TB_PriceAction exposes four hidden plots that any Tickblaze strategy can read directly:

HighType[i]       →   1 = HH,  -1 = LH,  2 = DT,  0 = no swing high this bar
LowType[i]        →   1 = HL,  -1 = LL,  2 = DB,  0 = no swing low this bar
SwingHighPrice[i] →   price of the confirmed swing high  (NaN if none)
SwingLowPrice[i]  →   price of the confirmed swing low   (NaN if none)

Signals fire on the confirmation bar — the bar where the swing becomes mathematically certain, Strength + 1 bars after the actual swing peak/trough. This matches the no-repaint guarantee: by the time the strategy sees a non-zero value, all bars used to confirm it are already closed.

Example strategy usage:

var pa = Indicators.Get<TB_PriceAction>();

if ((int)pa.HighType[index] == -1)   // Lower High just confirmed → bearish shift
if ((int)pa.LowType[index]  ==  1)   // Higher Low just confirmed → bullish continuation

Works on any timeframe and instrument

Because the Double Top/Bottom tolerance scales with ATR, and because Strength is adjustable, TB_PriceAction requires no re-configuration between instruments or timeframes. A single set of defaults works sensibly on tick charts, Renko, 1-minute, and daily bars alike.

TB_PriceAction.zip
17.68KB
1