OPEN-SOURCE SCRIPT

Pip distance by Jim Belardi

39
//version=5
indicator("Pip-Distanz zum Hoch/Tief (EURUSD)", overlay=true)

// Pip-Faktor fix for EURUSD (5 Nachkommastellen, 1 Pip = 0.0001)
pip_factor = 10000.0

// live candle
current_price = close
candle_high = high
candle_low = low

// calculate distance in pips
dist_high_pips = (candle_high - current_price) * pip_factor
dist_low_pips = (current_price - candle_low) * pip_factor

// create table (once)
var table pipTable = table.new(position.bottom_right, 2, 2, border_width=1, frame_color=color.gray)

// updating table
if barstate.islast
table.cell(pipTable, 0, 0, "Distanz zum Hoch", text_color=color.red, text_size=size.large)
table.cell(pipTable, 1, 0, str.tostring(dist_high_pips, format.mintick) + " Pips", text_color=color.red, text_size=size.large)

table.cell(pipTable, 0, 1, "Distanz zum Tief", text_color=color.green, text_size=size.large)
table.cell(pipTable, 1, 1, str.tostring(dist_low_pips, format.mintick) + " Pips", text_color=color.green, text_size=size.large)

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.