TRND_C - Gold 20-Pip Levels

1 038
This indicator draws horizontal price levels every X pips from a chosen entry price.

It is designed specifically for Gold (XAUUSD).

Default logic:

1 pip = 0.10

Levels every 20 pips

So each level = $2.00 move

Example if entry = 2650

Levels become:

2652 (+20 pips)
2654 (+40 pips)
2656
2658
2660
...

and

2648 (-20 pips)
2646
2644
2642
2640
...
Main parts of the script
1️⃣ Entry line

It draws a solid yellow line at your entry.

Example:

ENTRY 2650

Code:

line.new(bar_index - lineLength, adjustedEntry, bar_index + 10, adjustedEntry)

It also places a label next to the line.

2️⃣ Pip levels above entry

Loop:

for i = 1 to levelsAbove

Each level is calculated:

levelPrice = entry + (pipValue * i)

If:

pipValue = 2

then levels become:

+20p
+40p
+60p
+80p
...

These lines are green dotted lines.

3️⃣ Pip levels below entry

Same logic but subtracting:

levelPrice = entry - (pipValue * i)

These are red dotted lines.

4️⃣ Spread adjustment

You can shift the entry slightly:

+0.33 for buys
-0.33 for sells

Example:

entry = 2650
spread = +0.33

adjusted entry = 2650.33

All pip levels are then calculated from that.

5️⃣ Price scale labels

It optionally prints prices on the right side of the chart.

Example:

2652
2654
2656

This is controlled by:

showPriceScale
6️⃣ Important design feature

Everything only draws on the last bar:

if barstate.islast

This keeps the chart clean and prevents thousands of lines from being created.

The script also deletes previous objects:

line.delete(...)
label.delete(...)

So it constantly refreshes the grid.

What this script is useful for

This is actually very good for gold scalping or session trading, because it shows:

20 pip targets

distance from entry

quick TP / SL reference

Example:

Entry: 2650
TP1: 2652
TP2: 2654
TP3: 2656

or

SL: 2648
SL2: 2646

Disclaimer

The information and publications are not meant to be, and do not constitute, financial, investment, trading, or other types of advice or recommendations supplied or endorsed by TradingView. Read more in the Terms of Use.