Re: Buy Sell Pressure indicator for MT4

11
TransparentTrader wrote: Thu Feb 09, 2023 6:11 am Just a heads up about the "Buying and Selling Pressure" indicator I've talked about here (V1) and here (V2).

The creator has now issued an update:

"Summarized formula of BP and SP. Also enabled consideration of wicks. Was a bad idea taking them down out of formula. Added tracking by def."

The code looks like this:

Code: Select all

/ © fract
//@version=5
indicator(title='Buying & Selling Pressure', shorttitle='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
ln = input.int(24, "BSP Length", 1, 200, 1)
bpma = ta.ema(bp, ln)
spma = ta.ema(sp, ln)
//}
// Colors {
bpgrow = #40af40
bpfall = #2962ff
sprise = #f23645
spfall = #f57f17
//}
//{ Plots
bpp = plot(bpma, "Buying Pressure", color= bpma > bpma[1] ? bpgrow : bpfall, linewidth= 1, trackprice = true)
spp = plot(spma, "Selling Pressure", color= spma > spma[1] ? sprise : spfall, linewidth = 1, trackprice = true)
fill(bpp, spp, bpma > spma ? color.rgb(0, 255, 0, 90) : color.rgb(255, 0, 0, 90))
//}

If my eyes are working, this version effectively simplifies the code by a few lines and restores it back to what was originally V1. I asked him what he meant by "tracking enabled" and "enabling consideration of wicks" as the input menu on TradingView is exactly the same.

Nothing for anybody to do. Thought I would write this in case anybody here is using the indicator and is interested about new changes being made by the author!
Nice attention to detail, maybe you should think about taking up coding. Seriously!
These users thanked the author mrtools for the post (total 2):
TransparentTrader, maroka


Re: Buy Sell Pressure indicator for MT4

12
mrtools wrote: Thu Feb 09, 2023 7:34 am Nice attention to detail, maybe you should think about taking up coding. Seriously!

WOW. That's a major compliment coming from you. Thanks!

I'll think about it. I'm not a coder or programmer by nature, plus it seems like a very difficult thing to learn and master. Perhaps I'll venture into coding once I master trading on a full-time basis.
These users thanked the author TransparentTrader for the post (total 3):
Chickenspicy, Jimmy, maroka

Re: Buy Sell Pressure indicator for MT4

13
TransparentTrader wrote: Thu Feb 09, 2023 6:11 am Just a heads up about the "Buying and Selling Pressure" indicator I've talked about here (V1) and here (V2).

Good news! Three hours after I sent a message to fract, the TradingView user who created the "Buying and Selling Pressure" indicator, he was kind enough to reply to me and say the following:

For the Buying Pressure (BP):
:exclaim: Green candle = body of the candle + lower wick of the candle
:exclaim: Red candle = just the lower wick of the candle

For the Selling Pressure (SP):
:exclaim: Green candle = just the upper wick of the candle
:exclaim: Red candle = upper wick of the candle + body of the candle

Before, I had this idiotic idea of taking away the wicks to make the indicator focused on just body candles, but since bullish and bearish candles alternate randomly, it's the wrong thing to do. Especially when I averaged them to output with ema.

Here's the difference between the two:



BSP on the top sub-window considers wicks into the equation, while BSP on the bottom sub-window does not.

Taking this into consideration, you can see the wicks make the signal go faster. I was really silly to eliminate wicks from the code. For BSP, the wicks are an important piece of data.

Finally, about your question of tracking: Tracking means the horizontal line with which we can relate current values to history levels.
These users thanked the author TransparentTrader for the post:
Chickenspicy

Re: Buy Sell Pressure indicator for MT4

14
TransparentTrader wrote: Thu Feb 09, 2023 10:03 am Good news! Three hours after I sent a message to fract, the TradingView user who created the "Buying and Selling Pressure" indicator, he was kind enough to reply to me and say the following:

For the Buying Pressure (BP):
:exclaim: Green candle = body of the candle + lower wick of the candle
:exclaim: Red candle = just the lower wick of the candle

For the Selling Pressure (SP):
:exclaim: Green candle = just the upper wick of the candle
:exclaim: red candle = upper wick of the candle + body of the candle

Before, I had this idiotic idea of taking away the wicks to make the indicator focused on just body candles, but since bullish and bearish candles alternate randomly, it's the wrong thing to do. Especially when I averaged them to output with ema.

Here's the difference between the two:



Image



BSP on the top sub-window considers wicks into the equation, while BSP on the bottom sub-window does not.

Taking this into consideration, you can see the wicks make the signal go faster. I was really silly to eliminate wicks from the code. For BSP, the wicks are an important piece of data.

Finally, about your question of tracking: Tracking means the horizontal line with which we can relate current values to history levels.
Buy Sell Pressure (updated by Fract, TradingView)

Did this version, not sure about the tracking though being we are using separate buy and sell periods.
These users thanked the author mrtools for the post (total 14):
Jimmy, Chickenspicy, TransparentTrader, josi, moey_dw, kvak, 太虚一毫, yoki, iPar, Mickey Abi, jng640, xard777, ppinto, Gethsemane

Re: Buy Sell Pressure indicator for MT4

15
TransparentTrader wrote: Thu Feb 09, 2023 10:03 am Good news! Three hours after I sent a message to fract, the TradingView user who created the "Buying and Selling Pressure" indicator, he was kind enough to reply to me and say the following:

For the Buying Pressure (BP):
:exclaim: Green candle = body of the candle + lower wick of the candle
:exclaim: Red candle = just the lower wick of the candle

For the Selling Pressure (SP):
:exclaim: Green candle = just the upper wick of the candle
:exclaim: red candle = upper wick of the candle + body of the candle

Before, I had this idiotic idea of taking away the wicks to make the indicator focused on just body candles, but since bullish and bearish candles alternate randomly, it's the wrong thing to do. Especially when I averaged them to output with ema.

Here's the difference between the two:


BSP on the top sub-window considers wicks into the equation, while BSP on the bottom sub-window does not.

Taking this into consideration, you can see the wicks make the signal go faster. I was really silly to eliminate wicks from the code. For BSP, the wicks are an important piece of data.

Finally, about your question of tracking: Tracking means the horizontal line with which we can relate current values to history levels.
Posted a new version above
These users thanked the author mrtools for the post:
TransparentTrader


Moving AveragesRe: Buy Sell Pressure indicator for MT4

16
The ongoing updates and efforts from TransparentTrader, Fract, Mrtools as well as our members make this code deserve it's own section so I've moved all the posts to this topic.

I find this "joint" project really cool & see great potential in this technical indicator.

PS: Fract's chart colors are really easy on the eyes so if anyone would like to use an MT4 template that resembles Fract's theme on TradingView, please try this one:
These users thanked the author Jimmy for the post (total 15):
moey_dw, yoki, Jedidiah, kvak, 太虚一毫, iPar, Mickey Abi, thomdel, maroka, jng640, xard777, TransparentTrader, Narutopips, Chickenspicy, Gethsemane
Are you looking for a Forex broker? FBS cuts spreads by up to 58%. Click here to begin your trading journey, today.
No commissions are earned by Forex-station.


Guide to the "All Averages" Filters (ADXvma, Laguerre etc.) 🆕
Use Fibonacci numbers for indicator settings + How to draw Fibonacci Extensions
An easy trick for drawing Support & Resistance

Re: Buy Sell Pressure indicator for MT4

17
mrtools wrote: Thu Feb 09, 2023 11:58 am Buy Sell Pressure (updated by Fract, TradingView)
Did this version, not sure about the tracking though being we are using separate buy and sell periods.

You are fast! I think for now this will be the definitive MT4 version of the BSP indicator unless I think of new things to be added/changed, or Fract himself comes up with his own modifications.

Jimmy wrote: Thu Feb 09, 2023 9:40 pm The ongoing updates and efforts from TransparentTrader, Fract, Mrtools as well as our members make this code deserve it's own section so I've moved all the posts to this topic.
I find this "joint" project really cool & see great potential in this technical indicator.
PS: Fract's chart colors are really easy on the eyes so if anyone would like to use an MT4 template that resembles Fract's theme on TradingView, please try this one:
Image

This is nuts. I woke up today to see not only a shoutout in the Daily Downloads section, but an entire thread dedicated exclusively to the BSP indicator.

Jimmy, I am very grateful that you went out of your way to do this. I took a look at Fract's other indicators and I think this is just the start of the thread. I anticipate many more changes and modifications that make the BSP even more of a powerhouse than it already is.

Even more impressive is how all of this started with less than 30 lines of very simple code. Hats off to mrtools, kvak, and Jimmy for all the coding work they've done free-of-charge! :Fire: :Fire:
These users thanked the author TransparentTrader for the post (total 2):
Jimmy, maroka

Re: Buy Sell Pressure indicator for MT4

18
For people who are using the Buy Sell Pressure indicator but would prefer a histogram format, you're in luck!

Turns out that two weeks ago, Fract decided to create a version of this indicator called "NET BSP".

I got the idea to search for something like this after seeing a request on this forum that went unanswered, asking for "a buy sell pressure indicator with a zero line... Essentially if its buying pressure its above the zero line and when above the zero line it shows volatility also (and vice versa)".

Anyhow, here is what Fract has to say about the NET BSP:

"NET BSP is derived from Buying & Selling Pressure, which is a volatility indicator that monitors average metrics of green and red candles separately. We can navigate more confidently through the market with a projected market balance.

The original BSP indicator allowed us to track and analyze the ongoing performance of bullish and bearish impulsive waves and their corrections.

Due to the unintuitive way of measuring decline with Selling Pressure going up, I decided to remake it into a more intuitive version with better precision. When we encounter the fall it's better to have declining values of the tool to be able to cover it visually with ease.

One of the solutions was to create a sense of balance of Buying Pressure (BP) against Selling Pressure (SP). Since we are oriented by growth, it'd be more logical to summarize the market balance with the following mathematical equation: BP - SP

When Buying and Selling Pressure are equal, NET BSP would be at 0.

NETBSP > 0 and BP > SP = 🟢
NETBSP > 0 and BP < SP = 🟡
NETBSP < 0 and BP < SP = 🔴
NETBSP < 0 and BP > SP = 🟡

Hence, we get visualized stages of the uptrends and downtrends, which allows to evaluate the chances and estimations of upcoming counter-waves. Also, it is worth noting that output clearly shows how one wave is derived from another in terms of sizing.

Feel free to adjust the NET BSP arguments so you can adapt sensitivity to the timeframe you're working on."


Here's what the NET BSP looks like in comparison to the original BSP:


Please note that the TradingView example above is using a Heikin-Ashi (HA) chart. Since TradingView allows you to change directly between candlestick charts and HA charts instead of overlaying the latter over the former, both indicators will look different if you put the charts side-by-side.

In other words, as one commenter put it: Using "Heikin Ashi" produces different values for the open, close and highs and lows than the plain "Candles".

Whereas with MetaTrader4, since the HA indicator merely acts as an overlay instead of changing the OHLC values of the candlesticks, both BSP indicators will look exactly the same on both HA and candlestick charts. The picture below illustrates what I'm talking about:


Fract had this to say about why one may choose to use the BSP indicator with HA charts instead of candlestick charts:

"The BSP indicator is grouped better with HA. However, it far doesn't yet mean it's useless for normal candles. I used HA Just because of extra smoothness and its trend-following properties. Because of gradual change it is easier to determine direction. Once again I say that it works well with normal candles too but would obviously noises, that’s I added length to adjust."

For anybody who is interested in coding NET BSP for MetaTrader4 or sees any value in doing so, the simple 30-line code is below:

Code: Select all

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

// Inputs and Formula {
ln = input.int(24, "BSP Average", 1, 200, 1)
bp = close - (math.min(low, close[1]))                      // Buying   Pressure [including wicks]
sp = (math.max(high, close[1])) - close                     // Selling  Pressure [including wicks]
bal = bp - sp
bsp =  ta.ema(bal, ln)
//}
// 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, style = plot.style_columns, trackprice = true)
hline(0, "Balance", color.black, hline.style_solid, 2)
// }
//Alerts {
//alertcondition(bspRise and bspG, "Open Long")
//alertcondition(bspG and bspFall, "Close Long")
//alertcondition(bspF and bspFall, "Open Short")
//alertcondition(bspF and bspRise, "Close Short")
// }

If you truly want to go above and beyond, turning NET BSP into the behemoths that kvak and mrtools have created for the original BSP indicator, here are the features they implemented:

  • Adding all averages via the eAverages pack
  • Adding all price options via the Price pack
  • Adding MTF/AHTF capabilities
  • Separately editing the TYPE of moving average you use for "bpma" and "spma"
  • Separately editing the PRICE OPTION you use for "bpma" and "spma"
  • Separately editing the LENGTH you use for "bpma" and "spma"
  • The slope line changes as seen in lines 16-24 of the PineScript code ("bpma" slope is green when going up and blue when going down, "spma" slope is red when going up and orange when going down)
  • The option to "fill" the space in-between the bpma/spma as seen in line 25 of the PineScript code
  • Arrows for buy/sell entries
  • Coloring the candles to reflect when the indicator reflects buying/selling pressure
  • Alerts to help us know when to look for a trade, especially on the higher timeframes
  • A button so we can turn the indicator appearance on and off when we want

Like I said before, I don't know what major difference this new version makes for anybody other than a different way of visually seeing the values generated by the indicator. But perhaps that's enough of a dealbreaker for some of the traders here!
These users thanked the author TransparentTrader for the post:
Chickenspicy

Re: Buy Sell Pressure indicator for MT4

19
TransparentTrader wrote: Fri Feb 10, 2023 10:47 am For people who are using the Buy Sell Pressure indicator but would prefer a histogram format, you're in luck!

Turns out that two weeks ago, Fract decided to create a version of this indicator called "NET BSP".

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.
These users thanked the author TransparentTrader for the post:
Chickenspicy

Re: Buy Sell Pressure indicator for MT4

20
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.
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.
These users thanked the author mrtools for the post (total 4):
josi, TransparentTrader, Jimmy, maroka


Who is online

Users browsing this forum: adriano.ecker, DotNetDotCom [Bot], TEAMTRADER, TECHHDATE07, TheJurgFX and 124 guests