Help with Code Bollinger bands
Forums › ProRealTime English forum › ProBuilder support › Help with Code Bollinger bands
- This topic has 4 replies, 2 voices, and was last updated 5 years ago by Dominicg01.
-
-
10/01/2019 at 10:10 AM #108967
HI All
Firstly i want to be upfront i have no idea how to code! I would like to have an indicator when the upper and lower bollinger band 3SD is hit on a 5 min,10 min 15, min and hourly chart all at the same time ie across a number of time frames . So could be say 5,10 & 1 hour and another for 5,15 & 1 hour etc same for the lower bollinger band 3SD. If we could tie it in with RSI over say 65 or below 30 on the lower band that would also be beneficial.
This would tell me when the market is short term over stretched – Ideally i would like to get an alert when this happens as well. I would use this for trading index futures such as FTSE, DOW SPX etc . Feel free to contact me. Thank you Dominic
10/01/2019 at 11:04 AM #108970ProBuilder does not support Multiple Time Frames, so it is impossible to make an indicator with more than one TF, the only one supported is the one on the chart where it’s been added.
So you need to open more charts at the same time, each one with different TF, then set an alert or use a screener to accomplish what you want.
Will this meet your goals?
10/01/2019 at 11:27 AM #108972HI Roberto
Thank you for getting back to me. So what you are saying is I could have an alert per time frame essentially and we would need the same code on all the time frames. So the same piece of code say on the 5 min, 10min,15 min and 1 Hour. that would probably work as if i got an alert from all time frames at the same time it would give me what i am looking for. Coudl i also tie it in with RSI reading above or below certain reading? Thanks dom
10/02/2019 at 9:56 AM #109056Here’s the code:
Rsi & BB overbought or oversold12345678910111213BBper = 20 //20 periodsBBdev = 3.0 //3.0 deviationBBavg = average[BBper,0](close) //BB mean (middle line)BollUP = BBavg + ((std[BBper](close)) * BBdev) //BB Upper BandBollDN = BBavg - ((std[BBper](close)) * BBdev) //BB Lower BandUPhit = high >= BollUPDNhit = low <= BollDNMyRSI = Rsi[14](close)RsiOB = MyRSI > 65RsiOS = MyRSI < 30LongCond = UPhit AND RsiOBShortCond = DNhit AND RsiOSRETURN LongCond AS "Long", -ShortCond AS "Short"unfortunately PRT doesn’t allow to set more than 5 conditions for an alert, so if you need 3 different TF’s you’ll have to set two conditions for two of them and only one for the third TF. In your case you only need ONE condition per TF, since the above indicator returns a signal when BOTH Rsi and Bollinger Bands return valid signals.
You’ll have to create two different alerts, one for LONG conditions and one for SHORT conditions.
Anyway, this is a screener that returns a valid scan with a beep:
12345678910111213141516171819202122232425262728293031323334353637383940414243444546TIMEFRAME(1 hour)BBper1 = 20 //20 periodsBBdev1 = 3.0 //3.0 deviationBBavg1 = average[BBper1,0](close) //BB mean (middle line)BollUP1 = BBavg1 + ((std[BBper1](close)) * BBdev1) //BB Upper BandBollDN1 = BBavg1 - ((std[BBper1](close)) * BBdev1) //BB Lower BandUPhit1 = high >= BollUP1DNhit1 = low <= BollDN1MyRSI1 = Rsi[14](close)RsiOB1 = MyRSI1 > 65RsiOS1 = MyRSI1 < 30//TIMEFRAME(15 minute)BBper2 = 20 //20 periodsBBdev2 = 3.0 //3.0 deviationBBavg2 = average[BBper2,0](close) //BB mean (middle line)BollUP2 = BBavg2 + ((std[BBper2](close)) * BBdev2) //BB Upper BandBollDN2 = BBavg2 - ((std[BBper2](close)) * BBdev2) //BB Lower BandUPhit2 = high >= BollUP2DNhit2 = low <= BollDN2MyRSI2 = Rsi[14](close)RsiOB2 = MyRSI2 > 65RsiOS2 = MyRSI2 < 30//TIMEFRAME(5 minute)BBper3 = 20 //20 periodsBBdev3 = 3.0 //3.0 deviationBBavg3 = average[BBper3,0](close) //BB mean (middle line)BollUP3 = BBavg3 + ((std[BBper3](close)) * BBdev3) //BB Upper BandBollDN3 = BBavg3 - ((std[BBper3](close)) * BBdev3) //BB Lower BandUPhit3 = high >= BollUP3DNhit3 = low <= BollDN3MyRSI3 = Rsi[14](close)RsiOB3 = MyRSI3 > 65RsiOS3 = MyRSI3 < 30//TIMEFRAME(default)LongCond = (UPhit1 AND RsiOB1) AND (UPhit2 AND RsiOB2) AND (UPhit3 AND RsiOB3)ShortCond = (DNhit1 AND RsiOS1) AND (DNhit2 AND RsiOS2) AND (DNhit3 AND RsiOS3)x = 0IF LongCond THENx = 1ELSIF ShortCond THENx = 2ENDIFSCREENER[x](x AS "1=↑,2=↓")10/03/2019 at 9:24 AM #109158Wow thanks Roberto that is very kind of you ! Sorry i didn’t get back to you yesterday, i was offline all day. Let me play around with this over the next few days and I’ll revert back to you. Once again many thanks Dom
-
AuthorPosts
Find exclusive trading pro-tools on