Bollinger band contraction in programming

Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
    Posts
  • #190668 quote
    ZeroCafeine
    Participant
    Senior

    Hi all,

    How to detect a Bollinger band contraction in Probuilder programming, I haven’t started yet, do you have any leads or ideas, I thought for example to measure the angles of the moving average that constitute the Bollinger bands, or perhaps an average angle calculation of the upper or upper and lower bands at the same time

    Best Reguards

    BB-Contraction.png BB-Contraction.png
    #190674 quote
    Nicolas
    Keymaster
    Master

    Have you tried Bollinger Band Width ? BollingerBandWidth

    and measure a statistical width with a long term average applied to it.

    ZeroCafeine thanked this post
    #190676 quote
    Nicolas
    Keymaster
    Master

    another usual way to check bandwidth contraction is the “bollinger squeeze”: TTM Squeeze Oscillator and On price version

    it checks if current standard deviation of volatility (Bbands) is located inside the average of candlesticks true range (keltner bands).

    ZeroCafeine thanked this post
    #190684 quote
    ZeroCafeine
    Participant
    Senior

    Have you tried Bollinger Band Width ? BollingerBandWidth

    and measure a statistical width with a long term average applied to it.

    tks you Nicolas, I tried quickly the result of the search indicator and I found the “BandWith”, I think it’s the same you showed me (the second indicator in the picture), the third one it’s the same but I removed the BBwidthSlow = BollingerBandWidth[30](close) and calculate just an Average on the the bandwith with 9 periode like a signal line, I will also check the history discus on the page indicator,

    how to detect the flat part of the indicator ? I will try this methode of you on youtube and see what king of result I will find

    Capture-décran-2022-03-28-à-21.58.12.png Capture-décran-2022-03-28-à-21.58.12.png Capture-décran-2022-03-28-à-22.03.57.png Capture-décran-2022-03-28-à-22.03.57.png
    #190699 quote
    Nicolas
    Keymaster
    Master

    Bollingerbandwidth is an internal instruction I gave you the link above 🙂

    BollingerBandWidth

    It returns the value of the bollinger bands width in price. There is a also a normalized version named %BBands: https://www.prorealcode.com/prorealtime-indicators/b-bollinger/

    ZeroCafeine thanked this post
    #190704 quote
    ZeroCafeine
    Participant
    Senior

    It returns the value of the bollinger bands width in price. There is a also a normalized version named %BBands: https://www.prorealcode.com/prorealtime-indicators/b-bollinger/

    tks you, I add it in the last in the photo and drawed a 0 ligne because I saw that the value can  be negative, at first glance I do not see how we can detect a compression with this indicator, again thank you for all your answers I will search more and see what I can do

    Best Reguards

    BB-.png BB-.png
    #190865 quote
    ZeroCafeine
    Participant
    Senior

    when you said a statistical width with a long term average applied to it. I don’t understand a statistical ?
    I do for exemple the the difference betwen the BBwidth  and BBwidthSlow  (it’s the differnce between the Slow and fast average like the MACD betwen 2 average),

    but after if I do an average of this variabl I get the same problem of how to determinate the good value of contraction, I do for exemple trying to get my maximum and minimum and try to find the condition is true when theis last value is under 10% from the highest value, but not working correctly

    exemple :

    BBwidth = BollingerBandWidth[20](close)
    BBwidthSlow = BollingerBandWidth[21](close)
    
    BBMACD = ABS( BBwidth - BBwidthSlow )
    
    MMABS = Average[10](BBMACD)
    Return MMABS

    second solution, I’m trying to get the highest value of the difference between the slow and the fast with and try to find the contraction, sorry for my code is a mess (it’s not the final code ) :

    BBwidth = BollingerBandWidth[20](close)
    BBwidthSlow = BollingerBandWidth[21](close)
    ZeroLine = 0 
    
    // LEs Extremes
    //BBHighest = Highest[200](BBwidthSlow)
    //BBLowest  = Lowest[200](BBwidthSlow)
    BBMACD = ABS( BBwidth - BBwidthSlow )
    BBMACDHighest = 0
    ABSHighest = 0
    ABSHighest = Highest[20](BBMACD)
    ABSLowest  = Lowest[50](BBMACD)
    //BBLowest2 = Min(BBLowest,0)
    
    XPourcent = 10
    ContractionBB = (XPourcent / 100) * ABSHighest
    
    C1 = BBMACD < ContractionBB
    Condition1 = summation[10](C1) = 30
    
    IF Condition1 Then
    BACKGROUNDCOLOR (0, 255, 10, 25)
    ENDIF
    
    RETURN BBwidth AS "Fast", BBwidthSlow AS "Slow", BBMACD AS "BB ABS MACD", ABSHighest AS "ABS Highest", ABSLowest AS "ABS Lowest", ContractionBB AS "Contraction BB"
    //MMABS = Average[10](BBMACD)
    //Return MMABS

     

    any new idea for find the contraction is welcom

    Best Reguards

    BB-01.png BB-01.png BB03.png BB03.png BB-04.png BB-04.png
Viewing 7 posts - 1 through 7 (of 7 total)
  • You must be logged in to reply to this topic.

Bollinger band contraction in programming


ProBuilder: Indicators & Custom Tools

New Reply
Author
Summary

This topic contains 6 replies,
has 2 voices, and was last updated by ZeroCafeine
3 years, 10 months ago.

Topic Details
Forum: ProBuilder: Indicators & Custom Tools
Language: English
Started: 03/28/2022
Status: Active
Attachments: 7 files
Logo Logo
Loading...