kvak, mrtools, there has been a brand new upgrade to this indicator from fract and I was wondering if it was possible to apply the changes towards the code we already have.
The new changes published on June 17 are as follows:
- Ability to change the type of MA
- Removed maxval limits
- Separate fills coloring different stages of the market
Here is the updated code:
Code: Select all
// © fract
//@version=5
indicator(title='Buying & Selling Pressure', shorttitle='BSP', overlay=false, timeframe = "")
// Inputs and Formula {
sw = input(false, 'No Wicks', 'Focus on body candles')
uw = high - math.max(open, close)
lw = math.min(open, close) - low
bp = close - (math.min(low, close[1])) - (sw? lw : 0) //buying_pressure
sp = (math.max(high, close[1])) - close - (sw? uw : 0) //selling_pressure
typeMA = input.string(title = "MA Type", defval = "HMA", options=["SMA", "EMA", "HMA", "RMA", "WMA", "VWMA"])
ln = input.int(24, "BSP Length", 1)
//}
ma(source, length, type) =>
switch type
"SMA" => ta.sma(source, length)
"EMA" => ta.ema(source, length)
"HMA" => ta.hma(source, length)
"RMA" => ta.rma(source, length)
"WMA" => ta.wma(source, length)
"VWMA" => ta.vwma(source, length)
bpma = ma(bp, ln, typeMA)
spma = ma(sp, ln, typeMA)
// Conditions {
//del
//}
// Colors {
bpgrow = #40af40
bpfall = #2962ff
spgrow = #f23645
spfall = #f57f17
//}
//{ Plots
bpp = plot(bpma, "BP", color= bpma > bpma[1] ? bpgrow : bpfall, linewidth= 1, trackprice = true)
spp = plot(spma, "SP", color= spma > spma[1] ? spgrow : spfall, linewidth = 1, trackprice = true)
//fill(bpp, spp, bpma > spma ? color.rgb(0, 255, 0, 90) : color.rgb(255, 0, 0, 90))
fill(bpp, spp, bpma > spma and bpma > bpma[1] ? color.rgb(0, 255, 0, 90) : na)
fill(bpp, spp, bpma > spma and bpma < bpma[1] ? color.rgb(0, 68, 255, 90) : na)
fill(bpp, spp, bpma < spma and spma > spma[1] ? color.rgb(255, 0, 0, 90) : na)
fill(bpp, spp, bpma < spma and spma < spma[1] ? color.rgb(255, 172, 48, 90) : na)
//}
As a result, here is what the indicator now looks like:
I believe the default settings are now a period length of 24 using the Hull Moving Average.
Always appreciate the efforts you guys undertake to make my indicator requests a reality.