# BUY & SELL PRESSURE by Regression

349 0
BUY & SELL PRESSURE by Regression Analysis at candle price/volume (Rate-Of-Change)
Ver. 3 By Ricardo M Arjona @XeL_Arjona

DISCLAIMER:

The Following indicator/code IS NOT intended to be a formal investment advice or recommendation by the author, nor should be construed as such. Users will be fully responsible by their use regarding their own trading vehicles/assets.

The embedded code and ideas within this work are FREELY AND PUBLICLY available on the Web for NON LUCRATIVE ACTIVITIES and must remain as is.

WHAT'S THIS?

This is my 3rd. revision of the original implementation for AmiBroker by Karthik Marar's of it's BUY AND SELL PRESSURE INDICATORS but this time, constructed under a complete REGRESSIVE ANALYSIS premise based in Rate Of Change (A kind of Slope but measured in % Performance).

• Instead of simple Range calculation at price, Rate Of Change (Regressive) is used.
• Oscillator of Pressure can be deactivated in favor of a simple RoC Cumulative Pressures at candle.
• Oscillator can read Volume data from external tickers for accurate Index calculation. ( NYA             can use TVOL as example.)
• Code is small, cleaner and faster =) !

Cheers!
Any feedback will be welcome...
@XeL_Arjona
```//@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=9)
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
// // Karthik Marar's XeL Rate Of Change MoD (Regressional)
Hi  = max(H,C[1])
Lo  = min(L,C[1])
SP  = ((Hi-C)/C)*100
BP  = ((C-Lo)/Lo)*100
BPs = sum(BP,p)
SPs = sum(SP,p)
BPa = ema(BP,p)
SPa = ema(SP,p)
BPn = (BP/BPa)*10
SPn = (SP/SPa)*10
//BSPd = BPn - SPn
Va = ema(V,p)
Vn = V/Va
BPo = linreg(BPn * Vn,9,0)//linreg(BPn*Vn,9,0)//
SPo = linreg(SPn * Vn,9,0)//linreg(SPn*Vn,9,0)//
BSPh = BPo - SPo
// Plot Directives
HCol = BPo > SPo ? green : red
_1os = SPo > BPo ? SPo : BPo
_2os = BPo > SPo ? BPo : SPo
plot(so?_1os:na,color=HCol,style=columns,transp=81,title="SP")
plot(so?_2os:na,color=HCol,style=columns,transp=81,title="BP")
plot(so?SPo:na,color=red,style=line,transp=0,title="SP",editable=false)
plot(so?BPo:na,color=green,style=line,transp=0,title="BP",editable=false)
plot(so?na:BPs,color=green,style=columns,transp=55,title="BProc")
plot(so?na:-SPs,color=red,style=columns,transp=55,title="SProc")
//plot(so?na:BPs-SPs,color=HCol,style=line,linewidth=3,transp=0,title="Forze")```
EN English
EN English (UK)
EN English (IN)
DE Deutsch
FR Français
ES Español
IT Italiano
PL Polski
TR Türkçe
RU Русский
PT Português
ID Bahasa Indonesia
MS Bahasa Melayu
TH ภาษาไทย
VI Tiếng Việt
JA 日本語
KO 한국어
ZH 简体中文
ZH 繁體中文
AR العربية
Home Stock Screener Forex Signal Finder Cryptocurrency Signal Finder Economic Calendar How It Works Chart Features House Rules Moderators Website & Broker Solutions Widgets Stock Charting Library Feature Request Blog & News FAQ Help & Wiki Twitter