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)
//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)
You must be logged in to post a comment.
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 ?
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
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.