3

TradingView has an indicator in their standard/built-in library called "Pivot Points High Low." When combined with Renko, it gives a really clean signal and I'd like to use it in code.

enter image description here

The problem is, this indicator wasn't coded in Pine script. It's probably being calculated on their backend. I want to use whatever algorithm they used in my Python code so I ask you all here: Do you know what's in use there?

xendi
  • 131
  • 1
  • 2
  • Look up how pivot points are calculated, there are several variations but from there you should be able to replicate it on your own. Technical indicators are not hard to reverse engineer. – NuWin Jun 12 '18 at 05:18
  • 4
    I'm voting to close this question as off-topic because this is not directly related to personal finance but more of building a software – Dheer Jun 12 '18 at 13:50
  • 1
    looking at that graph it seems like it's trivially easy.... determine the streak you have and check if it ended. It's like 5 lines of code (if you have the underlying data instead of just the graph). –  Jun 12 '18 at 16:57
  • That's not exactly true @Dheer but I did not know there is a quantitative finance stack. – xendi Jun 25 '18 at 16:22

2 Answers2

1

here you are bro

study("Pivots HL",overlay = true)
x = input(title = "left", type = input.integer, defval = 100)
y = input(title = "right", type = input.integer, defval = 100)
source = input(title = "Source", type = input.string, defval="High/Low", options = ["High/Low","Close"])

src_high = source == "Close" ? close : high src_low = source == "Close" ? close : low

pivot_high = pivothigh(src_high,x,y) pivot_low = pivotlow(src_low,x,y) hbars = highestbars(src_high,x) lbars = lowestbars(src_low,x)

if na(pivot_high) pivot_high := pivot_high[1] if na(pivot_low) pivot_low :=pivot_low[1]

if pivot_high != pivot_high[1] line.new(bar_index + hbars, pivot_high, bar_index, pivot_high, xloc = xloc.bar_index, color = color.lime) if pivot_low != pivot_low[1] line.new(bar_index + lbars, pivot_low, bar_index, pivot_low, xloc = xloc.bar_index, color = color.red)

Bob Jansen
  • 8,552
  • 5
  • 37
  • 60
durotan
  • 21
  • 1
0

I'm not a gourou in finiancial trading indicators but the algo seams simple to implement.

It uses a sliding window on the data.

Lets say the sliding window is 3 and you first trying to find the High pivot points:

You slide your window from the begining and whenever the middle (out of the 3) figure is a Max value, it is labelled as a pivot point.

For the lows, you are looking for the middle to be a Min instead of Max.

If im right you should have such a configuration on the indicator (length of the sliding window maybe).

OTmn
  • 1