Average Penetration Filter
Forums › ProRealTime English forum › General trading discussions › Average Penetration Filter
- This topic has 9 replies, 4 voices, and was last updated 4 years ago by Vonasi.
-
-
06/15/2018 at 6:44 PM #73378
I spotted this idea in a magazine someone kindly sent me today (thanks!) and I thought it was interesting. Basically it is a sum of the number of times in a look back period that a close penetrates below an average line.
In the article the author is suggests using an average of 100 and a look back time period of 3 months – but for some reason chooses a value of 63 to represent this. He suggests that a value below 7 indicates bullishness but when I created an indicator it seemed better to say that if the returned value is falling or flat lining at zero then it is a bull market and if it starts rising then it is time to not be on the market.
The code for the indicator is very simple:
123456LBPeriod = 63AvePeriod = 100ClosePenLow = Summation[LBPeriod](close < Average[AvePeriod])Return ClosePenLowI decided that it would be interesting to see how many times the high is above and the low is below during the look back period and so this is the code for that: I feel that this is possibly a better indicator.
1234567LBPeriod = 63AvePeriod = 100LowPen = summation[LBPeriod](low < Average[AvePeriod])HighPen = summation[LBPeriod](high > Average[AvePeriod])return LowPen coloured(128,0,0), HighPen coloured(0,128,0)It is meant to be applied to daily charts but I found that as an overall trend filter on weekly charts it worked pretty well so that is what I have shown here.
Obviously the indicator code can be easily adapted to be used in a strategy as a filter.
As usual – any thoughts, ideas and improvements are welcome…..
06/15/2018 at 7:30 PM #7338106/15/2018 at 8:11 PM #7338306/15/2018 at 8:44 PM #7338606/15/2018 at 9:00 PM #7338706/15/2018 at 9:43 PM #73388I decided to turn the high and low average penetration filter into a histogram so as to more quickly see what it is telling us without having to analyse the lines.
If green line is above red line but gap is reducing then it switches to bearish and if red line is above green line but gap is reducing then it switches to bullish. Otherwise green above red = bullish and red above green = bearish
Here is the code:
12345678910111213141516171819202122232425262728293031LBPeriod = 63AvePeriod = 100LowPen = summation[LBPeriod](low < Average[AvePeriod])HighPen = summation[LBPeriod](high > Average[AvePeriod])IF HighPen > LowPen thenFlag = 2endifIF HighPen < LowPen thenFlag = -2endifIf flag = 2 and Highpen - LowPen < HighPen[1] - LowPen[1] thenFlag = -2endifIF flag = -2 and LowPen - HighPen < LowPen[1] - HighPen[1] thenFlag = 2endifIf flag > 0 thenR = 0G = 128elseR = 128G = 0endifreturn Flag coloured(R,G,0) style(Histogram,2) as "Average Penetration"1 user thanked author for this post.
06/16/2018 at 4:14 PM #73436Do you think it is worthy of the indicator library or is it a bit too simple?
Been published in TASC magazine, so why not in our codes library? 😉
06/16/2018 at 6:26 PM #73446Been published in TASC magazine, so why not in our codes library?
OK – I will submit something when I get some time to do it.
07/26/2020 at 6:19 PM #14015007/29/2020 at 8:18 PM #140404Gigi – There are some simple forum rules one of which you have failed to follow. If you want to ask a question in the English speaking forums then ask it in English. If you want to communicate in French then ask the same question in a new topic in the French forums.
-
AuthorPosts
Find exclusive trading pro-tools on