shardison

Herrick Payoff Index for Quandl Data

Update to my previous Herrick Payoff Index script. This script pulls Quandl futures data with daily open interest. The prior version only used the weekly Commitment of Traders open interest data so could only be used on weekly bars. Note: Must use Quandl Symbol methodology in chart (i.e. enter symbol as QUANDL:CHRIS/CME_FC2, QUANDL:CME/FCX2016, ect.). Unfortunately, I haven't been able to program this to pull from the embedded futures data.

Need seasonals for futures data on NQ, ES, YM, or other commodities. Check out www.agresticresearch.com.
Open-source Skript

Ganz im Spirit von TradingView hat der Autor dieses Skripts es als Open-Source veröffentlicht, damit Trader es besser verstehen und überprüfen können. Herzlichen Glückwunsch an den Autor! Sie können es kostenlos verwenden, aber die Wiederverwendung dieses Codes in einer Veröffentlichung unterliegt den Hausregeln. Sie können es als Favoriten auswählen, um es in einem Chart zu verwenden.

Haftungsausschluss

Die Informationen und Veröffentlichungen sind nicht als Finanz-, Anlage-, Handels- oder andere Arten von Ratschlägen oder Empfehlungen gedacht, die von TradingView bereitgestellt oder gebilligt werden, und stellen diese nicht dar. Lesen Sie mehr in den Nutzungsbedingungen.

Möchten Sie dieses Skript auf einem Chart verwenden?
////////////////////////////////////////////////////////////
//  Copyright by shardison v2.0 03/17/2016

//NOTE: I have only been able to figure out how to pull open interest data from Quandl datasets. So you will need to use the Quandl method to pull data into the chart (i.e. QUANDL:CHRIS/CME_CL1).

// Attention:
//The Herrick Payoff Index (HPI) was developed by John Herrick and is the only well known indicator that uses price, volume, and open interest.
// The Herrick Payoff Index is designed to show the amount of money flowing into or out of a futures contract. 
//The Index uses open interest during its calculations, therefore, the security being analyzed must contain open interest.


//Interpretation
//
//When the Herrick Payoff Index is above zero, it shows that money is flowing into the futures contract (which is bullish). 
//When the Index is below zero, it shows that money is flowing out of the futures contract (which is bearish).
//
//The interpretation of the Herrick Payoff Index involves looking for divergences between the Index and prices.
////////////////////////////////////////////////////////////

study(title="Herrick Payoff Index for Quandl Data", shorttitle="HPI")
valueofonecentmove = input(100, minval=1)
multiplyingfactor = input(10, minval=1)
wmaperiod = input(21, minval=1)

oi = security(tickerid+"|7", "D", close)

openinterestdiff = oi - oi[1]
I = abs(openinterestdiff)
G = max(oi, oi[1])
S = multiplyingfactor
C = valueofonecentmove
V = volume
M = (high + low) / 2
My = M[1]
K1 = (C*V*(M - My))*(1 + ((2 * I)/(G)))
K2 = (C*V*(M - My))*(1 - ((2 * I)/(G)))
K = M > My ? K1 : K2
Ky = K[1]
HPI = ((Ky +(K - Ky)) * S)/100000
HPI_Index = 100 * (HPI - lowest(HPI,100))/(highest(HPI,100) - lowest(HPI,100))
wma = wma(HPI, wmaperiod)
plot(HPI, color=green, title="HPI")
plot (wma, color=orange, title="HPI Weighted Moving Average")
plot(HPI_Index, color=aqua, title="HPI Index-Turn off all others")

hline(0, color=gray, title="Zero", linestyle=dashed)
plot(oi, color = gray, title="OI")