Indicator · Pine Script v5 · Own pane

Boom Hunter - Oscillator

by kachook· code credited to veryfid

This indicator plots a separate-pane oscillator from a user-selected source.

View on GitHub

GitHub stars4on the repository
Pine versionv5runs as is
Lines of code153
Settings21inputs
LicenceNone statedfile: MPL-2.0
Last update3 years ago29 Jul 2023

Add It to Your TradingView Chart

  1. 1Copy the scriptPress Copy script above, or the copy button on the code below.
  2. 2Open the Pine EditorOpen a TradingView chart and choose Pine Editor at the bottom of the screen.
  3. 3Paste over the templateCreate a new indicator, select all of the template text and paste. Press Save and give it a name.
  4. 4Add it to the chartPress Add to chart, then adjust the settings with the gear icon next to its name.

Source Code

153 lines of Pine Script v5 from Boom Hunter - Oscillator.pine, published under MPL-2.0 (file header). Keep the author's credit and licence lines when you reuse it.

Boom Hunter - Oscillator.pine
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © veryfid
// © GordonRam(Lantzwat)

//@version=5

indicator(title='Boom Hunter - Oscillator', shorttitle='Boom Osc', overlay=false)

src = input(close,"Source")

hline(5,color = color.new(color.gray,50), linestyle = hline.style_dotted)

// BH main oscillator -------------------------------------------------------------------------------------------------------------------------------------------------------------

// Parameter table of Boom Hunter X Presets 
// for Boom Hunter Oscillator function
//                        LPPeriod            Lookback        Tr
//                        (multiplier)
//Preset 1                0.52                26                1.0
//Preset 2                pi                  157                1.0
//        Fib Smoothing    3.25                158                1.61803398502
//        Osc2            pi*13                157                1.0 
//      Osc2 Fib Smooth 2.0*13              157             1.61803398502
//Preset 3                5.1                    254                1.0
//        Smoother                            508
//        Smoothest                            762

// Osc2 must be capped at <3 and >7
// LPPeriod must be multiplied with H/D/W/M settings !!!!!!!!!

//Inputs
preset      = input.string(defval = "Preset 1", title = "Presets", options=["Preset 1", "Preset 2", "Preset 3", "Custom"], group="Boom Hunter", inline = "1")

iIntraday   = input(9.0,"H", group='Boom Hunter', inline = "p1")
iDay        = input(6.0,"D", group='Boom Hunter', inline = "p1")
iWeek       = input(3.0,"W", group='Boom Hunter', inline = "p1")
iMonth      = input(2.0,"M", group='Boom Hunter', inline = "p1")

iIntraday2   = input(3.0,"H", group='Boom Hunter', inline = "p2")
iDay2        = input(3.0,"D", group='Boom Hunter', inline = "p2")
iWeek2       = input(3.0,"W", group='Boom Hunter', inline = "p2")
iMonth2      = input(1.0,"M", group='Boom Hunter', inline = "p2")

iIntraday3   = input(5.0,"H", group='Boom Hunter', inline = "p3")
iDay3        = input(5.0,"D", group='Boom Hunter', inline = "p3")
iWeek3       = input(4.0,"W", group='Boom Hunter', inline = "p3")
iMonth3      = input(3.0,"M", group='Boom Hunter', inline = "p3")

bFibSmoothing = input.bool(false, "Fib Smoothing", group = "Boom Hunter")

LPPeriod    = input.float(.5, 'LPPeriod (custom)', step=0.05, group='Boom Hunter')
lb          = input.int(157, 'lookback (custom)', step = 1, group='Boom Hunter')
trx         = input.float(1.0, 'Tr (custom)', step=0.1, group='Boom Hunter')

if preset == "Preset 1"
    LPPeriod    := 0.52
    lb          := 26
    trx         := 1.0
else if preset == "Preset 2"  
    LPPeriod    := math.pi
    lb          := 157
    trx         := 1.0
    iIntraday   := iIntraday2
    iDay        := iDay2
    iWeek       := iWeek2
    iMonth      := iMonth2
else if preset == "Preset 3"  
    LPPeriod    := 5.1
    lb          := 254
    trx         := 1.0
    iIntraday   := iIntraday3
    iDay        := iDay3
    iWeek       := iWeek3
    iMonth      := iMonth3

if bFibSmoothing
    trx := 1.61803398502

// Detect time interval
tf_sec = timeframe.in_seconds()
multiplier = tf_sec <= 3600 ? iIntraday : tf_sec <= 3600*24 ? iDay : tf_sec <= 3600*60*7 ? iWeek : iMonth

LPPeriod := LPPeriod * multiplier

// This function has been published from veryfid several time, i.e. Boom Hunter Pro
// Source code below of eot_func is from "Boom Hunter - Entry Point Screener Alerts"
eot_func(src, LPPeriod2, lb, trx) => // aka Boom Hunter Oscillator
    alpha1222 = 0.00
    HP2 = 0.00
    a12 = 0.00
    b12 = 0.00
    c12 = 0.00
    c22 = 0.00
    c32 = 0.00
    Filt2 = 0.00
    Peak2 = 0.00
    X2 = 0.00
    Quotient3 = 0.00
    Quotient4 = 0.00
    pi = math.pi
    K12 = 0

    alpha1222 := (math.cos(.707 * trx * pi / lb) + math.sin(.707 * trx * pi / lb) - 1) / math.cos(.707 * trx * pi / lb)
    HP2 := (1 - alpha1222 / 2) * (1 - alpha1222 / 2) * (src - 2 * nz(src[1]) + nz(src[2])) + 2 * (1 - alpha1222) * nz(HP2[1]) - (1 - alpha1222) * (1 - alpha1222) * nz(HP2[2])

//SuperSmoother Filter
    a12 := math.exp(-1.414 * pi / LPPeriod2)
    b12 := 2 * a12 * math.cos(1.414 * pi / LPPeriod2)
    c22 := b12
    c32 := -a12 * a12
    c12 := 1 - c22 - c32
    Filt2 := c12 * (HP2 + nz(HP2[1])) / 2 + c22 * nz(Filt2[1]) + c32 * nz(Filt2[2])

//Fast Attack - Slow Decay Algorithm
    Peak2 := .991 * nz(Peak2[1])
    if math.abs(Filt2) > Peak2
        Peak2 := math.abs(Filt2)
        Peak2

//Normalized Roofing Filter
    if Peak2 != 0
        X2 := Filt2 / Peak2
        X2

    Quotient3 := (X2 + K12) / (K12 * X2 + 1) 
    Quotient3 := Quotient3 * 5 + 5 // scaling for compatibility reasons with BHX
    Quotient3


BHX         = eot_func(src, LPPeriod, lb, trx)
pbh         = plot(BHX, color=color.yellow, linewidth = 2)

bordercol   = BHX > 9.9 ? color.red : BHX < 0.1 ? color.red : na
pbhlimit    = plot(BHX, color = bordercol, style = plot.style_line , linewidth = 2, title ="channel limit")

// Kernel Functions (kreg) -------------------------------------------------------------------------------------------------------------------------------------------------------------
import veryfid/KernelFunctionsFilters/2
// Source code of lib published in TV

useKernelSmoothing  = input.bool(true, "Apply smoothing",group='Kreg', inline = "base")

h                   = input.int(9, 'Kreg Len', minval=2,  group="Kreg", inline="kernel")
x                   = input.int(9, 'Mod', group="Kreg", inline="kernel")

c_green = color.new(color.teal, 20)
c_red = color.new(#CC3311, 20)

kernelEstimate = KernelFunctionsFilters.gaussian(BHX, h, x, useKernelSmoothing ? "Smooth" : "No Filter")

// Plot
updncolor = BHX >= kernelEstimate ? c_green : c_red
updncolor := kernelEstimate >= kernelEstimate[1] ? c_green : c_red
preg = plot(kernelEstimate, "kreg", color=color.new(updncolor,20), linewidth=2)

Overview

Named presets and a custom mode set the low-pass period, lookback, and Tr values used by the oscillator. The period is then scaled by hour, day, week, or month multipliers selected from the chart timeframe. Optional Fibonacci smoothing replaces Tr, and kernel smoothing length and mode inputs are available. A dotted horizontal line is drawn at level five. The excerpt shows no trading entries or exits.

Details

Published by

kachook on GitHub

Code credit

veryfid, as written in the script's header

Type

Indicator, Pine Script v5

Draws

Separate pane below the chart

Category

Oscillators & momentum

Markets

Any symbol

Timeframes

Any timeframe

Risk Notes

No repainting, lookahead or stacked entries were found in its code or README. That says nothing about how well it works: test it first.

Settings

The inputs you can change from the gear icon on the chart. Defaults are the author's.

SettingTypeDefaultVariable
Sourcesourceclosesrc
PresetsstringPreset 1preset
Hfloat9.0iIntraday
Dfloat6.0iDay
Wfloat3.0iWeek
Mfloat2.0iMonth
Hfloat3.0iIntraday2
Dfloat3.0iDay2
Wfloat3.0iWeek2
Mfloat1.0iMonth2
Hfloat5.0iIntraday3
Dfloat5.0iDay3
Show all 21 settings
SettingTypeDefaultVariable
Wfloat4.0iWeek3
Mfloat3.0iMonth3
Fib SmoothingboolfalsebFibSmoothing
LPPeriod (custom)float.5LPPeriod
lookback (custom)int157lb
Tr (custom)float1.0trx
Apply smoothingbooltrueuseKernelSmoothing
Kreg Lenint9h
Modint9x
Third-party code. ForexR did not write, test or endorse this script, and the summary above was generated automatically from its code and README. Indicators describe the past, and a strategy's backtest can look better than live trading, especially when a script repaints. Check it in the Strategy Tester and on a demo account before you rely on it.

Similar Pine Scripts

Asymmetrical RSI

by everget
948 stars

Asymmetrical RSI is an indicator that computes a custom relative strength index from the rate of change of a user-selected source. It plots the resulting ARSI line in a separate pane with color coding that turns green above the overbought level and red below t

Indicator v4 Oscillators & momentum
Updated 10 days ago · GPL-3.0 GitHub repository of Asymmetrical RSI

This indicator calculates momentum setups based on the Relative Strength Index (RSI) and plots in a separate pane. It offers multiple scanning modes such as Continuous Break, Continuous Retracement, Flip Break, Flip Retracement, and both regular and hidden div

Indicator v6 Oscillators & momentumDivergence Repaints
Updated 1 year ago · MPL-2.0 GitHub repository of Momentum Setup - RSI Directional Momentum Indicator

Beep Boop

by magic8bot
409 stars

This indicator calculates a modified MACD oscillator and signal line alongside a trend EMA filter, plotting the output as a stylized column histogram in a separate pane. Instead of plotting true MACD distance, it quantifies positive and negative histogram mome

Indicator v4 Oscillators & momentumTrend
Updated 3 years ago · MIT GitHub repository of Beep Boop
261 stars

This indicator demonstrates an experimental graph-style scatter visualization within a separate pane using Pine Script arrays. It tracks two features across recent bars: the single-bar price change and a scaled 14-period Relative Strength Index. Values are loa

Indicator v4 Oscillators & momentum
Updated 4 years ago · None stated GitHub repository of Example: Graph Style - 4th Dimension RSI

KD指標

by TaichiS
219 stars

This script calculates and plots a Stochastic Oscillator (KD indicator) in a separate chart pane. It determines the fast stochastic value over a 9-period lookback, then applies a 3-period Simple Moving Average (SMA) to create the %K line, and a second 3-period

Indicator v4 Oscillators & momentum
Updated 5 years ago · None stated GitHub repository of KD指標

More indicators

Trade Your Charts With a Regulated Broker

Compare brokers that connect to TradingView, with spreads, minimum deposits and leverage side by side.

Compare brokers