Bridge Bands are an implementation of the work done by Joe Catanzaro (joecat808) to produce a risk range for a security.
The basic idea is to calculate Mandelbrot’s “Bridge Range”. ( Pg . 179 of Misbehavior of Markets)
It then calculates Bollinger Bands .
Then next step is to calculate the Hurst Exponent .
The last step is to merge the Bridge Range and the Bollinger Bands . The basic concept is if H = .5 we use the Bollinger Bands and the farther away we move from .5 in either direction the Bridge Range takes more precedent.
There is a Trend value that is the mid-point of a 3 month Donchian Channel. If price is above we’re bullish , if price is below we’re bearish.
(description of original author: calebsandfort)
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 |
//PRC_Bridge Bands | indicator //01.03.2021 //Nicolas @ www.prorealcode.com //Sharing ProRealTime knowledge // --- settings length = 15 //Length trendLength = 63 //Trend Length resolution = 0 //Resolution //topRiskRangePositionSizePtg = 25 //Top RR Position Size % //midRiskRangePositionSizePtg = 75 //Mid RR Position Size % //bottomRiskRangePositionSizePtg = 125 //Bottom RR Position Size % // --- end of settings //topRiskRangePositionSizePtg = topRiskRangePositionSizePtg/100 //midRiskRangePositionSizePtg = midRiskRangePositionSizePtg/100 //bottomRiskRangePositionSizePtg = bottomRiskRangePositionSizePtg/100 timeframe(daily,updateonclose) securityclose = close[resolution] securityhigh = high[resolution] securitylow = low[resolution] lengthMinus1 = length - 1 slope = (securityclose[0] - securityclose[lengthMinus1]) / lengthMinus1 //min diff m = 100000000.0 for i = 0 to lengthMinus1 m = min(m, securityclose[lengthMinus1 - i] - (securityclose[lengthMinus1] + (slope[0] * i))) next mindiff=m //max diff m = -100000000.0 for i = 0 to lengthMinus1 m = max(m, securityclose[lengthMinus1 - i] - (securityclose[lengthMinus1] + (slope[0] * i))) next maxdiff=m bridgerangebottom = securityclose + mindiff bridgerangetop = securityclose + maxdiff ATR = AverageTrueRange[length](close) logLength = log(length) hurst = (log(highest[length](securityhigh) - lowest[length](securitylow)) - log(ATR)) / logLength sd = std[length](securityclose) WMA = WeightedAverage[length](securityclose) bbbottom = WMA - (sd * 2) bbtop = WMA + (sd * 2) bridgebandbottom = bbbottom + ((bridgerangebottom - bbbottom) * abs((hurst * 2) - 1)) bridgebandtop = bbtop - ((bbtop - bridgerangetop) * abs((hurst * 2) - 1)) bridgebandmid = bridgebandbottom + ((bridgebandtop - bridgebandbottom) / 2) trend = lowest[trendlength](securitylow) + ((highest[trendlength](securityhigh) - lowest[trendlength](securitylow)) / 2) bullish = securityclose > trend if bullish then r=0 g=255 else r=255 g=0 endif timeframe(default) //Band Fills drawtriangle(barindex[1],bridgebandtop[1],barindex,bridgebandbottom,barindex[0],bridgebandtop[0]) coloured(r,g,0,25) bordercolor(r,g,0,0) drawtriangle(barindex[1],bridgebandtop[1],barindex[1],bridgebandbottom[1],barindex[0],bridgebandbottom[0]) coloured(r,g,0,25) bordercolor(r,g,0,0) return trend coloured(r,g,0),bridgebandbottom coloured(r,g,0) style(line,3),bridgebandtop coloured(r,g,0) style(line,3) |
Share this
No information on this site is investment advice or a solicitation to buy or sell any financial instrument. Past performance is not indicative of future results. Trading may expose you to risk of loss greater than your deposits and is only suitable for experienced investors who have sufficient financial means to bear such risk.
ProRealTime ITF files and other attachments :PRC is also on YouTube, subscribe to our channel for exclusive content and tutorials
Thanks Nicolas,
when I imported the code, it gave me syntax error….
You might have made a bad copy/paste; you should download and import the itf file instead.
Bonjour Nicolas, tout d’abord je tiens a vous féliciter pour le travail que vous apportez a la communauté de trading.
J’ai une question concernant les ea, pourriez vous me conseiller le meilleur ea dont vous ayez connaissance, je suis prêt a mettre le prix qu’il faudra pour un robot qui fonctionne bien et sur le long terme. comme on dit par chez moi, tout travail mérite salaire, je suis originaire de la bourgogne. Merci Nicolas
Je ne peux pas donner de conseil sur les robots de trading. Sur le site tout est gratuit.
Sachez néammoins qu’un “marketplace” pour les développeurs d’indicateurs et de robots de trading sera bientôt disponible, abonnez vous à la newsletter pour en être informé.
Sir.I imported this utility in the normal manner and then I add the indicator to the price screen in PRT ver 11.1 but the Bridge indicator does not appear in the price window even though it is in the list of indicators.
Do I need to change the default settings to make it work ?
Add it on the price chart by using the wrench on the left upper side of your price chart.
I’m facing the exact same issue : even if I follow the correct path (import the its file and add it on the price chart by using the wrench on the left upper side of the price chart.) nothing appears…?
Sorry there was a small issue in the code, i have changed the attached itf file and updated the code of the page.
Hi Nicholas, apologies, I am usually fairly good at implementing your creations (for which I am thankful). But, when adding this one, it gets stuck due to ‘TIMEFRAME’ used in the code. Only used for ProBacktest programming, apparently! As in the cliche when breaking up with my girlfriend, it’s not you it’s me – I am sure I am missing something, but if you could explain, I’d appreciate it.
Are you using PRT version pre-v11? TIMEFRAME for indicators is possible since months for prorealtime version 11.