Higher time Frame Bollinger Band
Forums › ProRealTime English forum › ProBuilder support › Higher time Frame Bollinger Band
- This topic has 10 replies, 3 voices, and was last updated 4 years ago by Vonasi.
Tagged: bollinger bands, standard deviation
-
-
04/15/2020 at 12:55 AM #12619104/15/2020 at 8:55 AM #126209
Multi Time Frame is not currently available for indicators. It was due for release quite soon but Covid-19 has put a delay on most new releases on the platform.
As a work around you can create a dummy MTF strategy which draws the weekly bollinger bands on the daily chart.
Also if you are using v11 which has arrays then it should be possible to create an array of recent weekly closing prices and then calculate our own standard deviation of them to use to calculate our own bollinger bands.
04/15/2020 at 9:50 AM #126216Here is the dummy MTF strategy:
1234567891011timeframe(weekly)p = 20upper = bollingerup[p]lower = bollingerdown[p]middle = average[p]buy at -close limitgraphonprice uppergraphonprice lowergraphonprice middle1 user thanked author for this post.
04/15/2020 at 12:13 PM #126260Here is the code for an indicator on PRTv11 that draws weekly bollinger bands on the daily chart. It updates the lines on Monday.
123456789101112131415161718192021222324252627282930313233343536//Weekly Bollinger Bands On Faster Time Frame chart//PRTv11//By Vonasi//Date: 20200415p = 20deviations = 2//store each weeks closeif opendayofweek < opendayofweek[1] thena = a+1$price[a] = close[1]if a >= p then//get a mean of last p weeks close pricetotal = 0for b = a downto a-p+1total = total + $price[b]nextavg = total/p//calculate standard deviationtotal = 0for b = a downto a-p+1total = total + (square($price[b]-avg))nextstdev = sqrt(total/p)//calculate bandsupper = avg + (stdev*deviations)lower = avg - (stdev*deviations)endifendifreturn upper as "upper", lower as "lower", avg as "avg"04/16/2020 at 2:51 AM #12634404/17/2020 at 6:51 PM #126638Here is a version of the above code that instead of updating only on the first day of the week just like TIMEFRAME(WEEKLY,UPDATEONCLOSE) behaves more like TIMEFRAME(WEEKLY,DEFAULT) and updates every candle.
PRTv11 only due to the use of arrays.
12345678910111213141516171819202122232425262728293031323334353637383940//Weekly Bollinger Bands on Faster Time Frame updating every candle.//By Vonasi//Date: 20200415//p = 20//deviations = 2once upper = undefinedonce lower = undefinedonce avg = undefined//store each occuranceif opendayofweek < opendayofweek[1] thena = a+1$price[a] = close[1]endifif a+1 >= p then$price[a+1] = close//get a mean of last p weeks close pricetotal = 0for b = a+1 downto a-p+2total = total + $price[b]nextavg = total/p//calculate standard deviationtotal = 0for b = a+1 downto a-p+2total = total + (square($price[b]-avg))nextstdev = sqrt(total/p)//calculate bandsupper = avg + (stdev*deviations)lower = avg - (stdev*deviations)endifreturn upper as "upper", lower as "lower", avg as "avg"04/19/2020 at 10:55 PM #12696604/19/2020 at 11:18 PM #126967Yes you need to add them as external variables that you can then change the value of in the indicator configure window or remove the // before them on lines 5 and 6.
I plan to submit to the library two indicators that can display MTF standard deviation bands and MTF simple moving averages to any chart just as if we had MTF indicators – plus some other Bollinger band array based indicators that are quite interesting. PRT were doing maintenance today so I could not submit them but hopefully I will find time tomorrow but we will also have to wait for Nicolas to give them a five star review and make sure that they are colourful enough before they are released! (private joke)
04/20/2020 at 11:33 AM #127039the question is:
is there a way to calculate MTF moving average/bollinger via probacktest, but by choosing the close observations. Exemple: close of the day, or the week, at a specific time (to replicate cash markets on indexes), instead of the last candle of the chart for that day/week.
04/20/2020 at 11:47 AM #127044Yes that should be possible. With arrays you can fill the array with whatever values you want so if you fill it with the closing price at 1630 every day then you can calculate an average of the last p values in the array and then calculate standard deviation bands off this average.
I’ve just published an MTF simulating indicator to the library that might be of interest to you:
Multi Time Frame Simple Moving Averages and Standard Deviation Bands
04/20/2020 at 11:54 AM #127045This code should do it. Not tested as I don’t have faster than daily charts on my v11 at the moment). It updates on every new candle just like TIMEFRAME(x,DEFAULT) would do.
1234567891011121314151617181920212223242526272829303132333435363738394041//Time of day Bollinger Bands//By Vonasi//Date: 20200420p = 20deviations = 2mytime = 163000once upper = undefinedonce lower = undefinedonce avg = undefined//store each occuranceif opentime = mytime thena = a+1$price[a] = close[1]endifif a+1 >= p then$price[a+1] = close//get a mean of last p weeks close pricetotal = 0for b = a+1 downto a-p+2total = total + $price[b]nextavg = total/p//calculate standard deviationtotal = 0for b = a+1 downto a-p+2total = total + (square($price[b]-avg))nextstdev = sqrt(total/p)//calculate bandsupper = avg + (stdev*deviations)lower = avg - (stdev*deviations)endifreturn upper as "upper", lower as "lower", avg as "avg" -
AuthorPosts
Find exclusive trading pro-tools on