HPotter

Bandpass Filter Strategy

The related article is copyrighted material from
Stocks & Commodities Mar 2010
You can use in the xPrice any series: Open, High, Low, Close, HL2, HLC3, OHLC4 and ect...
Remove from Favorite Scripts Add to Favorite Scripts
////////////////////////////////////////////////////////////
//  Copyright by HPotter v1.0 02/10/2014
// The related article is copyrighted material from
// Stocks & Commodities Mar 2010
// You can use in the xPrice any series: Open, High, Low, Close, HL2, HLC3, OHLC4 and ect...
////////////////////////////////////////////////////////////
study(title="Bandpass Filter Strategy")
Length = input(20, minval=1)
Delta = input(0.5)
TriggerLevel = input(0)
xPrice = hl2
hline(TriggerLevel, color=blue, linestyle=line)
beta = cos(3.14 * (360 / Length) / 180)
gamma = 1 / cos(3.14 * (720 * Delta / Length) / 180)
alpha = gamma - sqrt(gamma * gamma - 1)
BP = 0.5 * (1 - alpha) * (xPrice - xPrice[2]) + beta * (1 + alpha) * nz(BP[1]) - alpha * nz(BP[2])
pos =	iff(BP > TriggerLevel, 1,
	    iff(BP <= TriggerLevel, -1, nz(pos[1], 0))) 
barcolor(pos == -1 ? red: pos == 1 ? green : blue )
plot(BP, color=red, title="Bandpass Filter Strategy")
DONATE/TIP

BTC: 1Lo1GoTNsPbrjGAgPgF4MYZPhBFdoVHaTm
Thanks so much.
Reply
United States
United Kingdom
India
Deutschland
España
France
Việt Nam
Italia
Polska
Brasil
Россия
Türkiye
Indonesia
Malaysia
日本
한국
简体
繁體
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
Profile Profile Settings Account and Billing Support Priority Support Report Issue Ideas Published Followers Following Private Messages Chat Sign Out