Re: Buy Sell Pressure indicator for MT4

21
mrtools wrote: Fri Feb 10, 2023 5:38 pm This will be easy to make a histo version, in the code wherever it says close I replaced it with buy and sell prices, what I am thinking is maybe to add pre -smoothing to the prices to maybe add smoothing without too much lag, the good thing is the smoothing will be an option if you set it to greater than 1. Anyway, kind of late here now will do the histo version tomorrow with the smoothing option.

mrtools, just so I understand you correctly:

1) Replacing the "close" with "buy and sell prices" refers to the price pack you were able to add to V1 and V2 of the original BSP?

2) With your smoothing idea, the menu will give you the option to have smoothing or to not have smoothing depending on the numerical value you use?

Have a good night. Can't wait to see what this looks like on MetaTrader4!


Re: Buy Sell Pressure indicator for MT4

23
TransparentTrader wrote: Fri Feb 10, 2023 3:05 pm Ok, so an update to the code from Fract that got released just a half hour ago. If anybody has started working on this indicator and sees this message now, my sincerest apologies.

This pertains to the discussion about using NET BSP on Heikin-Ashi (HA) charts vs. candlestick charts in the quoted message above.

Here is the update from Fract himself:

"To smooth things out for normal candles I found a good solution. With this new script we can use different types of MA's (moving averages). Default is set to HMA because it groups well the NORMAL candlesticks and is reactive even with 24 (length?). Change to SMA or EMA when it comes to dealing with HA candles."

And below is the new code:

Code: Select all

// © fract
//@version=5
indicator(title='NET BSP', overlay=false, timeframe="")

// Inputs and Formula {
bp = close - (math.min(low, close[1]))                      // Buying   Pressure
sp = (math.max(high, close[1])) - close                     // Selling  Pressure
bal = bp - sp
// }
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)

typeMA = input.string(title = "MA Type", defval = "HMA", options=["SMA", "EMA", "HMA", "SMMA (RMA)", "WMA", "VWMA"])
smoothingLength = input.int(title = "Length", defval = 24, minval = 1, maxval = 200)
bsp = ma(bal, smoothingLength, typeMA)
//}
// Conditions {
bspRise = bsp > bsp[1]
bspFall = bsp < bsp[1]
bspG  = bsp > 0
bspF  = bsp < 0
//}
// Colors {
col = bspG ? (bspRise ? color.new(#00aa49, 0) : color.new(#9a9a00, 0)) : (bspFall ? color.new(#ff2929, 0) : color.new(#9a9a00, 0))
// }
// Plots {
plot(bsp, "NETBSP", col, 1, plot.style_columns, true, 0, 0)
// }

Hopefully this is helpful to anybody who wants to code this indicator! I'll make sure to keep this forum as soon as any new updates are announced.
Made the histo version, wasn't able to add the pre-smoothing it would invert the values, so not sure if i messed up somewhere with it or not, but if I figure out what was wrong will add it.
These users thanked the author mrtools for the post (total 8):
Chickenspicy, TransparentTrader, thomdel, kvak, maroka, talaate, andrei-1, 太虚一毫

Re: Buy Sell Pressure indicator for MT4

24
mrtools wrote: Sat Feb 11, 2023 6:18 am Made the histo version, wasn't able to add the pre-smoothing it would invert the values, so not sure if i messed up somewhere with it or not, but if I figure out what was wrong will add it.
Image

mrtools, I have two questions about the arrows provided by this indicator.

1) Why does the sell arrow in this picture appear a bar later than the first bearish signal? I feel like it should be on the bar where the signal first appears.

2) Is there any way to change the arrow from a dot to an actual arrow or another shape?

Re: Buy Sell Pressure indicator for MT4

25
TransparentTrader wrote: Sat Feb 11, 2023 7:10 am mrtools, I have two questions about the arrows provided by this indicator.

1) Why does the sell arrow in this picture appear a bar later than the first bearish signal? I feel like it should be on the bar where the signal first appears.

2) Is there any way to change the arrow from a dot to an actual arrow or another shape?
Coded the arrows for zero cross, which is the same as the non-histo version, the arrow type can be changed in the user settings.
Attachments
These users thanked the author mrtools for the post (total 2):
Chickenspicy, 太虚一毫


Re: Buy Sell Pressure indicator for MT4

28
mrtools wrote: Sat Feb 11, 2023 7:46 am Didn't change anything in it. The zero cross is the same as the buy/sell pressure cross.

The reason I ask is because in the original picture of the NET BSP indicator you provided, you can look at the red dot arrow and see it appears one bar later than it is supposed to.

I managed to fix this by re-adding the indicator to my chart, only allowing arrows on chart to be "true" while setting arrows on mtf bar to be "false".

As a side note, I saw that you can make the up arrows and down arrows appear as alternate symbols instead of the same thing. Pretty neat!


Who is online

Users browsing this forum: BeatlemaniaSA, Bing [Bot], ChatGPT [Bot], Yandex [Bot] and 48 guests