xel_arjona

BUY & SELL PRESSURE XeLMod V2

BUY & SELL PRESSURE Oscillator
Ver. 2.0 XelMod

WHAT'S THIS?

This is an UPDATED version of a previous script already posted.

List of changes from previous script:
  • Separated as Column Histogram just the Regressive (Rate-Of-Change) Force of the indicator which gives a faster response of the trend.
  • Default period is now set to 81, as better Oscillator swing lagging.

This is an excelent momentum indicator very similar to ADX but in a candle weighting distribution rather than ranges.

For additional reference:
Karthik Marar BUY AND SELL PRESSURE INDICATORS.

Cheers!
Any feedback will be welcome...
@XeL_Arjona

Open-source script

In true TradingView spirit, the author of this script has published it open-source, so traders can understand and verify it. Cheers to the author! You may use it for free, but reuse of this code in a publication is governed by House Rules. You can favorite it to use it on a chart.

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.

Want to use this script on a chart?
//@version=2
study("BUY & SELL PRESSURE by Regression", shorttitle="BSPbR",overlay=false,precision=2)
so = input(title="Buy&Sell Pressure Oscillator:", defval=true)
p  = input(title="Lookback Window:", defval=81)
tev = input(title="Use External Volume?:", defval=false)
evt = input(title="External Volume Ticker:", type=symbol, defval="TVOL")
// Fixed Variables
volsym = tev ? evt : tickerid
vol = nz(security(volsym,period,volume),security(volsym,period,close))
V = vol == 0 ? 1 : nz(vol,1)
C = close
H = high
L = low
Hi  = max(H,C[1])
Lo  = min(L,C[1])
// XeL Rate Of Change MoD (Regressional)
SProc = abs((Hi-C)/Hi)
BProc = abs((C-Lo)/Lo)
SPprc = Hi-C
BPprc = C-Lo
BPs = sum(BProc,p)
SPs = sum(SProc,p)
BPa = sma(BProc,p)
BPap = sma(BPprc,p)
SPa = sma(SProc,p)
SPap = sma(SPprc,p)
BPn = (BProc/BPa)*12
SPn = (SProc/SPa)*12
BPnp = (BPprc/BPap)*12
SPnp = (SPprc/SPap)*12
Va = sma(V,55)
Vn = V/Va
BPo = linreg(BPn * Vn,9,0)
SPo = linreg(SPn * Vn,9,0)
nbf = sma(BPnp * Vn,9)
nsf = sma(SPnp * Vn,9)
regH = (BPo-SPo)
// Plot Directives
OCol = BPo > SPo ? blue : fuchsia
_1hs = BPs > SPs ? BPs : -BPs
_2hs = SPs > BPs ? SPs : -SPs
plot(so?regH:na,color=OCol,style=columns,transp=81,title="RegForce")
plot(so?na:_1hs,color=green,style=columns,transp=72,title="BProc")
plot(so?na:_2hs,color=red,style=columns,transp=72,title="SProc")
plot(so?nbf:na,color=green,style=line,transp=0,title="BPprice")
plot(so?nsf:na,color=red,style=line,transp=0,title="SPprice")