![MQL5 - Language of trade strategies built-in the MetaTrader 5 client terminal](https://c.mql5.com/i/registerlandings/logo-2.png)
You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
Hi all,
I have been trying to code the following but I am really to bad at that:
n=50;//lookback period as extern int
Period=21;//default BB setting
BandWidth=Upper-Lower (more exactly= pips between high and low)
AvgBandwidth=Average bandwidth over the last n period
SqueezeRatio=BandWidth/AvgBandwidth
That is: if the squeeze ratio gets very low you'll have a breakout.
Can somebody help?
Thanks
NickNick, if you are trying to see the squeeze as in the "Senters squeeze"
which can be found on tradethemarkets.com.
then simply load the BBands on your charts, then load the keltner channels on the same chart, change the colors on either the BBands or keltner so you can tell them apart.
Next make the line width on either larger, I used to like the keltner to be larger.
You should now be able to see when the squeeze happens
Hi!
I fixed it. It had some bugs.
Can U post here how U want to use it?
Regards
Kalei find this tool very useful, thanks for sharing
streamyx
Sounds interesting but I am quite new with Bollinger. Does it work like that : you detect bollinger squeeze to a certain level and when a candle breaks it, you put orders depending on whether it goes up or down ? And if my question is totally silly, please tell me![](https://c.mql5.com/forextsd/smiles/smile.png)
Quote:
Originally Posted by nicogris
Hi all,
I have been trying to code the following but I am really to bad at that:
n=50;//lookback period as extern int
Period=21;//default BB setting
BandWidth=Upper-Lower (more exactly= pips between high and low)
AvgBandwidth=Average bandwidth over the last n period
SqueezeRatio=BandWidth/AvgBandwidth
That is: if the squeeze ratio gets very low you'll have a breakout.
Can somebody help?
Thanks
Nick
BB squeeze indis works on effect StdDeviation (bb) getting lower than ATR (BB contracts before expending) - you can take it as example and play wit nuances
p.s. dem ...it was 2006 post
i might be a bit late...
Been fooling around with bollinger, and got something like this...
An ugly bugger
, but it seems to be showing some useful info (mostly on longer time frames).
So if anyone finds it useful ... good luck with it
Petor
Been fooling around with bollinger, and got something like this...
An ugly bugger
, but it seems to be showing some useful info (mostly on longer time frames).
So if anyone finds it useful ... good luck with itNice and effective is this BB. Thank You!![](https://c.mql5.com/forextsd/smiles/hail.png)
A way to make BBWidth universally applicable
One of the problems I see in using BBWidth is that width sizes are different for each pair so defining what is "low" is somewhat arbitrary and at the least has to be individually identified. A solution is to make the calculation based on a percentage of where the current BBWidth fits within the range of largest BBWidth(100) and Smallest BBWidth(100) of the last 100 bars. The indicator can be applied universally and you can look for readings of 10% or less. In other words, current reading is in the bottom 10% of the last 100 BBWidth readings. I checked directly with John Bollinger and he agreed with the wisdom of this approach...
I have coded this in Genesis Trade Navigator and it is very effective! However, I have no experience coding in Metatrader4 so perhaps MLaden or another of the Geniuses could assist. Here is my Genesis code if helpful:
((Bollinger BandWidth (Close, Bars used in average , Num Std Dev) - (Lowest (Bollinger BandWidth (Close, Bars used in average , Num Std Dev) , 100))) / (Highest (Bollinger BandWidth (Close, Bars used in average , Num Std Dev) , 100) - (Lowest (Bollinger BandWidth (Close, Bars used in average , Num Std Dev) , 100)))) * 100
Cheers!
This should be the simplified (and normalized, as proposed by jttrader) BB width indicator.
Some explanation : after some math, it turns out that when the width of the Bollinger bands is normalized it entirely depends on standard deviation values (it does not matter at all what are the multipliers used for bands since their relative values are always going to be independent on the constant multiplier and the only variable value that stays is the deviation itself) so this is in fact a standard deviation normalized to a 0-100 range, but for the sake of keeping the spirit of it left the name of bb width normalized
Here is the indicator compared to Bollinger band 20 and compared to Standard deviation 20 too _________________________________PS: above examples are both with Normalization period 100. Maybe other normalization periods are as interesting : here is one with normalization period 50 and as you can see, the similarity to standard deviation itself when shorter normalization period is used is much less now
In re:
I have it on my charts but depending on the size of my chart, the current value changes. For instance, when I have a full screen
chart, the value of the current period is 40. But when I make the chart smaller to fit lots of charts on my screen, the value of the
current plot shows a much different value for instance 80. Is there a way to have the values the same not matter the size of the chart
window? When I'm scanning lots of charts this is very deceiving. Excuse me if I'm not doing something correctly with a setting, etc.
Thanks very much for the indi as it does solve a real problem with bandwidth indi's not normalized. Great idea.