Higher timeframes bollinger filter
Forums › ProRealTime English forum › ProBuilder support › Higher timeframes bollinger filter
- This topic has 11 replies, 6 voices, and was last updated 5 years ago by Vonasi.
-
-
03/15/2019 at 2:11 PM #93803
Hi all, i came up with this idea for my <= 4h systems and got some interesting results testing it out, nothing amazing but definitly interesting results.
So the idea is that you run my “Force” indicator on a higher timeframe (4h,8h,12h,daily,weekly) and u ask for Force >= n1 and Force <= n2
As i was building this i thought “maybe someone else has thought about the same thing in the forums” so here i am, anyone using a good filter on higher timeframes that they would like to share?
Was also thinking about same filter but maybe with RSI and a moving average of it.
Also aware that u can write this alot shorter, but after attempt #5 i said “fuck it” and just wrote it as basic as can be.
Btw i have very little experience in coding in probuilder so please check this code to see if its actually doing what u want it to do! I might have still fucked something up lol.
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152// CLOSE > BOLLUPi1= close >Average[t1](close)+1*std[t1](close)i2= close >Average[t1](close)+1.5*std[t1](close)i3= close >Average[t1](close)+2*std[t1](close)i4= close >Average[t1](close)+2.5*std[t1](close)i5= close >Average[t1](close)+3*std[t1](close)// CLOSE < BOLLDOWNy1= close <Average[t1](close)-1*std[t1](close)y2= close <Average[t1](close)-1.5*std[t1](close)y3= close <Average[t1](close)-2*std[t1](close)y4= close <Average[t1](close)-2.5*std[t1](close)y5= close <Average[t1](close)-3*std[t1](close)if i1 and i2 and i3 and i4 and i5 thenforce = 5endifif i1 and i2 and i3 and i4 and (not i5) thenforce = 4endifif i1 and i2 and i3 and (not i4 and not i5) thenforce = 3endifif i1 and i2 and (not i3 and not i4 and not i5) thenforce = 2endifif i1 and (not i2 and not i3 and not i4 and not i5) thenforce = 1endifif (not i1 and not i2 and not i3 and not i3 and not i4 and not i5 and not y1 and not y2 and not y3 and not y4 and not y5) thenforce = 0endifif y1 and y2 and y3 and y4 and y5 thenforce =-5endifif y1 and y2 and y3 and y4 and (not y5) thenforce =-4endifif y1 and y2 and y3 and (not y5 and not y4) thenforce =-3endifif y1 and y2 and (not y5 and not y4 and not y3) thenforce =-2endifif y1 and (not y5 and not y4 and not y3 and not y2) thenforce =-1endifreturn forceSet T1 to 20 or whatever u want.
03/15/2019 at 5:48 PM #9381903/15/2019 at 7:39 PM #93820Here’s another way to achieve the same thing. It took three attempts so I was getting close to the ‘f**k it’ moment!
1234567891011121314151617181920212223242526272829t1 = 20if close > average[t1](close) thena = 1force = 0while a <= 3if close > Average[t1](close) + a*std[t1](close) thenforce = force + 1elsebreakendifa = a + 0.5wendendifif close < average[t1](close) thena = -1force = 0while a >= -3if close < Average[t1](close) + a*std[t1](close) thenforce = force - 1elsebreakendifa = a - 0.5wendendifreturn force03/16/2019 at 12:01 AM #93829In fact with some simple modifications of this version you can check for more levels being passed and so get a very different return for force. More to optimize!
12345678910111213141516171819202122232425262728293031t1 = 20if close > average[t1](close) thena = 0.1force = 0while a <= 10if close > Average[t1](close) + a*std[t1](close) thenforce = force + 1a = a + 0.1elsebreakendifwendendifif close < average[t1](close) thena = -0.1force = 0while a >= -10if close < Average[t1](close) + a*std[t1](close) thenforce = force - 1a = a - 0.1elsebreakendifwendendifreturn force03/16/2019 at 12:36 AM #93832I couldn’t resist playing with it a little bit more. I added start, end and step variables for the STD levels and also a variable to allow different average types to be tested. Now we can optimize a whole bunch of variables! I also added rising and falling colour to the line.
I can post it to the library if you want me to Jebus89 – obviously co-crediting you with the idea!
12345678910111213141516171819202122232425262728293031323334353637383940p = 20AveType = 0 //0 to 6STDstart = 0.1STDmax = 10STDstep = 0.1if close > Average[p, AveType](close) thena = STDstartforce = 0while a <= STDmaxif close > Average[p, AveType](close) + a*std[p](close) thenforce = force + 1a = a + STDstepelsebreakendifwendendifif close < Average[p, AveType](close) thena = -STDstartforce = 0while a >= -STDmaxif close < Average[p, AveType](close) + a*std[p](close) thenforce = force - 1a = a - STDstepelsebreakendifwendendifr = 128g = 0if force > force[1] thenr = 0g = 128endifreturn 0 coloured(0,0,0), force coloured(r,g,0) as "Force!"03/16/2019 at 10:57 AM #9383703/16/2019 at 1:04 PM #93844The latest version of vonasi is fine 😉
Force indicator123456789101112131415161718192021222324252627282930313233343536373839404142434445// Force indicator | Indicator// Concept by jebus89 / Coding by Vonasi// https://www.prorealcode.com/topic/higher-timeframes-bollinger-filter/#post-93832p = (p) // Number Périod mobileAveType = 0 // type mobile average (0 to 6)STDstart = 0.1STDmax = 10STDstep = 0.1if close > Average[p, AveType](close) thena = STDstartforce = 0while a <= STDmaxif close > Average[p, AveType](close) + a*std[p](close) thenforce = force + 1a = a + STDstepelsebreakendifwendendifif close < Average[p, AveType](close) thena = -STDstartforce = 0while a >= -STDmaxif close < Average[p, AveType](close) + a*std[p](close) thenforce = force - 1a = a - STDstepelsebreakendifwendendifr = 128g = 0if force > force[1] thenr = 0g = 128endifreturn force coloured(r,g,0) style(histogram,1) as "Force"03/16/2019 at 8:49 PM #93868swapping – Thanks for adding the ITF file – I modified line 2 in the post as technically the code is mine and the idea is Jebus89’s.
In answer to Jebus89’s original question I do recall coding something similar once before for a strategy that checked how many averages in a row a closing price closed under or over and then adjusted position size based on this. I don’t think that I ever put it in live demo as some of the draw downs were massive – but that is averaging down for you!
Maybe the idea needs revisiting on standard deviations of other indicators on longer time frames as a market sentiment filter as suggested by Jebus89.
03/18/2019 at 12:15 AM #93912Great! Fantastic job Vonasi, have been busy all weekend but im looking forward to testing out your code 🙂 Im glad u like my idea.
Whole thought process behind this was “do i really want to do a mean reversion trade, if price on higher timeframe is already at an extreme point” similar to “do i want to buy this breakout if price on higher timeframe is already above an important breakout/below an important breakout level”
Im gonna tinker on more ideas regarding this, thought being if you can analyze where price is in the current timeframe, you should probably analyze a higher timeframe to make sure you are where you want to take the trade, in multiple timeframes.
Edit: add it to the library if you want to 🙂
03/18/2019 at 9:22 AM #93925Some similarity with Multi Z-Score analysis
Few points in an area represent a very abnormal behavior of price related to its distribution.
You should add this new indicator to the library!
03/24/2019 at 5:27 PM #94562Buenas tardes, no se si podre ayudar,agregarlo en conjunto con el rsi es una buena opción, una sma21 junto a otro indicador de fuerza adx niveles di/-di entre 20/26..realmente llamativo.. Me gustaría que alguien lo probara.. porque yo soy incapaz de programarlo.. Sma 21 en conjunto cruce 20/26di/-di..
03/24/2019 at 7:23 PM #94564Jose Carlos – English only in the English forums please.
-
AuthorPosts
Find exclusive trading pro-tools on