CodeBuy Sell Pressure indicator for MT4

1
Buy Sell Pressure indicator for MT4, project by Fract, TransparentTrader & Mrtools

@kvak and @mrtools, I have a request that involves modifying the "Buying and Selling Pressure (BSP)" indicator on TradingView I originally requested to convert into MT4 back in December.


mrtools was the first to convert the indicator to its original form and even provided the source code.



mrtools then provided an updated version that came with price options, MTF, and the ability to have separate average types and lengths for the bpma/spma. However, the price pack works for BOTH the bpma/spma and you can't change it separately (for instance, I'd like to see one price option for bpma and a separate one for spma). It also does not have candle coloring, alerts, or arrows.



kvak provided his version of the BSP indicator that came with eAverages, MTF, ability to edit length of bpma/spma individually, ability to change the type of moving average used by bpma/spma separately, arrows and alerts. Only thing missing is the price pack.



There are features from the version of kvak that are missing in the version from mrtools, and likewise there are features from the version of mrtools that are missing in the version from kvak. If you look at the pictures, you will also notice they are visually different. While mrtools focuses on the blue and red lines crossing one another, kvak has his set up in a way where there's one green/red line to reflect the trend and another dotted line to reflect the crossover.

I bring all of this up because over the weekend, the indicator's author provided a major update to the code:

"Now BSP is based on candle's actual body without excluding wick measurement out of formula. It was very sensitive to market noises, giving us confusing signals. Eliminating wicks metrics contributed to more accurate capture of bullish and bearish market and their timing. For example capture of covid19 lockdown 📉 bearish wave."

Here is the code:

Code: Select all

// © fract
//@version=5
indicator(title='Buying & Selling Pressure', shorttitle='BSP', overlay=false, timeframe = "")

// Inputs and Formula {
high_ = math.max(high, close[1])
low_ = math.min(low, close[1])
uw = high - math.max(open, close)
lw = math.min(open, close) - low
bp = close - low_ - lw //raw_body_buying_pressure
sp = high_ - close - uw //raw_body_selling_pressure
ln = input(24, "BSP Length")
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)
spp = plot(spma, "Selling Pressure", color= spma > spma[1] ? sprise : spfall, linewidth = 1)
fill(bpp, spp, bpma > spma ? color.rgb(0, 255, 0, 90) : color.rgb(255, 0, 0, 90))
//}

And this is what it's supposed to look like on the charts:


Which brings me to the point of my request: Could we perhaps create a "BSP v2.0" indicator that addresses the change in the indicator's code and combine the features from the mrtools version and the kvak version?

As a recap, here is what I would like to see in the order of highest importance to lowest importance:

  • 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

It would be really awesome to see what this simple yet powerful indicator could do with all of the above features. Thanks to mrtools, kvak, and all the programmers here again for their tireless hard work.

PS - mrtools I know you are recovering from illness. Please take your time because I'm in no rush and your health is most important.
These users thanked the author TransparentTrader for the post (total 9):
Krunal Gajjar, BeatlemaniaSA, Jedidiah, chris006, Chickenspicy, Jimmy, ChuChu Rocket, saishala, 太虚一毫


ChartRe: Buy Sell Pressure indicator for MT4

2
TransparentTrader wrote: Tue Jan 31, 2023 8:58 am @kvak and @mrtools, I have a request that involves modifying the "Buying and Selling Pressure (BSP)" indicator on TradingView I originally requested to convert into MT4 back in December.

mrtools was the first to convert the indicator to its original form and even provided the source code.

buy sell pressure.mq4

mrtools then provided an updated version that came with price options, MTF, and the ability to have separate average types and lengths for the bpma/spma. However, the price pack works for BOTH the bpma/spma and you can't change it separately (for instance, I'd like to see one price option for bpma and a separate one for spma). It also does not have candle coloring, alerts, or arrows.

buy sell pressure avgs (mtf).ex4

kvak provided his version of the BSP indicator that came with eAverages, MTF, ability to edit length of bpma/spma individually, ability to change the type of moving average used by bpma/spma separately, arrows and alerts. Only thing missing is the price pack.

buy sell pressure (eAverages).ex4

There are features from the version of kvak that are missing in the version from mrtools, and likewise there are features from the version of mrtools that are missing in the version from kvak. If you look at the pictures, you will also notice they are visually different. While mrtools focuses on the blue and red lines crossing one another, kvak has his set up in a way where there's one green/red line to reflect the trend and another dotted line to reflect the crossover.

I bring all of this up because over the weekend, the indicator's author provided a major update to the code:

"Now BSP is based on candle's actual body without excluding wick measurement out of formula. It was very sensitive to market noises, giving us confusing signals. Eliminating wicks metrics contributed to more accurate capture of bullish and bearish market and their timing. For example capture of covid19 lockdown 📉 bearish wave."

Here is the code:

Code: Select all

// © fract
//@version=5
indicator(title='Buying & Selling Pressure', shorttitle='BSP', overlay=false, timeframe = "")

// Inputs and Formula {
high_ = math.max(high, close[1])
low_ = math.min(low, close[1])
uw = high - math.max(open, close)
lw = math.min(open, close) - low
bp = close - low_ - lw //raw_body_buying_pressure
sp = high_ - close - uw //raw_body_selling_pressure
ln = input(24, "BSP Length")
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)
spp = plot(spma, "Selling Pressure", color= spma > spma[1] ? sprise : spfall, linewidth = 1)
fill(bpp, spp, bpma > spma ? color.rgb(0, 255, 0, 90) : color.rgb(255, 0, 0, 90))
//}

And this is what it's supposed to look like on the charts:

Image


Which brings me to the point of my request: Could we perhaps create a "BSP v2.0" indicator that addresses the change in the indicator's code and combine the features from the mrtools version and the kvak version?

As a recap, here is what I would like to see in the order of highest importance to lowest importance:

  • 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

It would be really awesome to see what this simple yet powerful indicator could do with all of the above features. Thanks to mrtools, kvak, and all the programmers here again for their tireless hard work.

PS - mrtools I know you are recovering from illness. Please take your time because I'm in no rush and your health is most important.
Buy Sell Pressure indicator with Averages Filters

No E-averages, but think I got most everything else and added an option to double smooth either or both the buy pressure averages and sell pressure averages, so a lot of different possibilities.

Re: Buy Sell Pressure indicator for MT4

3
TransparentTrader wrote: Tue Jan 31, 2023 8:58 am @kvak and @mrtools, I have a request that involves modifying the "Buying and Selling Pressure (BSP)" indicator on TradingView I originally requested to convert into MT4 back in December.


mrtools was the first to convert the indicator to its original form and even provided the source code.


buy sell pressure.mq4



mrtools then provided an updated version that came with price options, MTF, and the ability to have separate average types and lengths for the bpma/spma. However, the price pack works for BOTH the bpma/spma and you can't change it separately (for instance, I'd like to see one price option for bpma and a separate one for spma). It also does not have candle coloring, alerts, or arrows.


buy sell pressure avgs (mtf).ex4

kvak provided his version of the BSP indicator that came with eAverages, MTF, ability to edit length of bpma/spma individually, ability to change the type of moving average used by bpma/spma separately, arrows and alerts. Only thing missing is the price pack.


buy sell pressure (eAverages).ex4



There are features from the version of kvak that are missing in the version from mrtools, and likewise there are features from the version of mrtools that are missing in the version from kvak. If you look at the pictures, you will also notice they are visually different. While mrtools focuses on the blue and red lines crossing one another, kvak has his set up in a way where there's one green/red line to reflect the trend and another dotted line to reflect the crossover.

I bring all of this up because over the weekend, the indicator's author provided a major update to the code:

"Now BSP is based on candle's actual body without excluding wick measurement out of formula. It was very sensitive to market noises, giving us confusing signals. Eliminating wicks metrics contributed to more accurate capture of bullish and bearish market and their timing. For example capture of covid19 lockdown 📉 bearish wave."

Here is the code:

Code: Select all

// © fract
//@version=5
indicator(title='Buying & Selling Pressure', shorttitle='BSP', overlay=false, timeframe = "")

// Inputs and Formula {
high_ = math.max(high, close[1])
low_ = math.min(low, close[1])
uw = high - math.max(open, close)
lw = math.min(open, close) - low
bp = close - low_ - lw //raw_body_buying_pressure
sp = high_ - close - uw //raw_body_selling_pressure
ln = input(24, "BSP Length")
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)
spp = plot(spma, "Selling Pressure", color= spma > spma[1] ? sprise : spfall, linewidth = 1)
fill(bpp, spp, bpma > spma ? color.rgb(0, 255, 0, 90) : color.rgb(255, 0, 0, 90))
//}

And this is what it's supposed to look like on the charts:


Image



Which brings me to the point of my request: Could we perhaps create a "BSP v2.0" indicator that addresses the change in the indicator's code and combine the features from the mrtools version and the kvak version?

As a recap, here is what I would like to see in the order of highest importance to lowest importance:

  • 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

It would be really awesome to see what this simple yet powerful indicator could do with all of the above features. Thanks to mrtools, kvak, and all the programmers here again for their tireless hard work.

PS - mrtools I know you are recovering from illness. Please take your time because I'm in no rush and your health is most important.
Check here
These users thanked the author mrtools for the post (total 2):
TransparentTrader, talaate

Re: Buy Sell Pressure indicator for MT4

4
mrtools wrote: Wed Feb 01, 2023 6:24 am No E-averages, but think I got most everything else and added an option to double smooth either or both the buy pressure averages and sell pressure averages, so a lot of different possibilities.

Image

Beautiful. Looks and operates exactly the way I expect. I may ask for eAverages in the future alongside some very minor changes, but for now there are enough types of moving averages for me to experiment with.

Thank you again for taking the time to fulfill my indicator request and so quickly too!
These users thanked the author TransparentTrader for the post:
Chickenspicy

Re: Buy Sell Pressure indicator for MT4

5
TransparentTrader wrote: Wed Feb 01, 2023 2:14 pm Beautiful. Looks and operates exactly the way I expect. I may ask for eAverages in the future alongside some very minor changes, but for now there are enough types of moving averages for me to experiment with.

Thank you again for taking the time to fulfill my indicator request and so quickly too!
And what do you think eAverage has advantages over Mrtools average pack???


Re: Buy Sell Pressure indicator for MT4

7
TransparentTrader wrote: Thu Feb 02, 2023 9:30 am I was under the impression that eAverages had a wider selection of moving averages to choose from than the mrtools average pack. The only source I could find is this link for the mrtools pack but perhaps I don't know about the difference.

How is eAverages different from mrtools average pack?
Some things is hard to code for me, Mrtools is miles, miles far from me and my knowledges....
I trying clone averages pack, that all....
For now you'll have to settle for his version, because in this modified new calculation, code I can't get everything to be like the Mrtools version yet...
Attachments
These users thanked the author kvak for the post (total 8):
Chickenspicy, sylvester21, TransparentTrader, RodrigoRT7, Jimmy, Jedidiah, talaate, 太虚一毫

Re: Buy Sell Pressure indicator for MT4

8
kvak wrote: Thu Feb 02, 2023 11:53 am Some things is hard to code for me, Mrtools is miles, miles far from me and my knowledges....
I trying clone averages pack, that all....
For now you'll have to settle for his version, because in this modified new calculation, code I can't get everything to be like the Mrtools version yet...
Image

No worries kvak. If you can include eAverages, great. If not, that's ok too. Thank you for your continued efforts!

But just so I understand, what is the difference between eAverages and mrtools' moving averages pack? I don't see a dedicated thread or post explaining how the two are different.
These users thanked the author TransparentTrader for the post:
sylvester21

LikeRe: Buy Sell Pressure indicator for MT4

9
TransparentTrader wrote: Tue Jan 31, 2023 8:58 am
mrtools was the first to convert the indicator to its original form and even provided the source code.
I would just like to say thank you TransparentTrader for this immensely informative post. It's probably the best "request" I've seen on this site so far which even had nicely spaced lists, clickable links and images.

Good info was shared and posted 👏
These users thanked the author ChuChu Rocket for the post (total 2):
TransparentTrader, Chickenspicy
Important: The worst forex brokers of all time 👎

Re: Buy Sell Pressure indicator for MT4

10
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!
These users thanked the author TransparentTrader for the post (total 3):
kvak, Jimmy, Jozo


Who is online

Users browsing this forum: alex4x, Amazon [Bot], ChatGPT [Bot], kvak, msbh, Ruby [Bot], Telegram [Bot], WhatsApp [Bot] and 75 guests