Convert BOM indicator from TradingView?

G

GOS

New member
Can some one convert this ?

https://www.tradingview.com/script/fhjAA1Dq-Blast-Off-Momentum-DW/
Code:
//@version=3
study(title="Blast Off Momentum [DW]", shorttitle="BOM [DW]", overlay=false)
//by Donovan Wall

//This study is an alternative experimental interpretation of the Blast Off Indicator by Larry Williams.
//This formula takes positive and negative magnitudes rather than the absolute value. The result is then smoothed with an ema, and twice smoothed to provide a signal line.

//------------------------------------------------------------------------------------------------------------------------------------------------------------------
//Updates:

//Simple housekeeping. Cleaned up the code a bit.

//Aesthetic Updates:
//-> Changed BOM's plot to columns
//-> Added bar colorization

//------------------------------------------------------------------------------------------------------------------------------------------------------------------
//Inputs
//------------------------------------------------------------------------------------------------------------------------------------------------------------------

//Periods
per = input(defval=34, minval=1, title="Period")

//Signal Period
sigper = input(defval=9, minval=1, title="Signal Period")

//Threshold Distance
tdist = input(defval=10, minval=0, title="Threshold Distance")

//------------------------------------------------------------------------------------------------------------------------------------------------------------------
//Definitions
//------------------------------------------------------------------------------------------------------------------------------------------------------------------

//Blast Off Momentum
BOM(t1, t2)=>
    ocrng = close - open
    hlrng = high - low
    bo    = ocrng/hlrng*100
    BOM   = ema(bo, t1)
    SIG   = ema(BOM, t2)
    [BOM, SIG]
[bom, sig] = BOM(per, sigper)

//Thresholds
uth = tdist
lth = -tdist

//Color
bomcolor = (bom > 0) and (bom < uth) ? green : (bom < 0) and (bom > lth) ? maroon : (bom > uth) ? lime : (bom < lth) ? red : orange

//------------------------------------------------------------------------------------------------------------------------------------------------------------------
//Plots
//------------------------------------------------------------------------------------------------------------------------------------------------------------------

//Thresholds
uthplot  = plot(uth, color=lime,   title="Upper Threshold")
centplot = plot(0,   color=orange, title="Center Line")
lthplot  = plot(lth, color=red,    title="Lower Threshold")

//BOM
bomplot = plot(bom, color=bomcolor, style=columns, title="BOM")

//Signal Line
plot(sig, color=yellow, title="Signal Line")

//Bar Color
barcolor(bomcolor)
 
Last edited by a moderator:

Similar threads

Top