Average Penetration Indicator

v10.3
Average Penetration Indicator

Thank you to Markos Katsanos and his article in the June 2018 edition of Technical Analysis of Stocks and Commodities magazine for this idea.

This indicator counts the number of times that a candles high or low penetrates a simple moving average line. The period of average and look back period can be adjusted to suit the market being traded.

The author was using an average of 100 and a look back period of 3 months. He was also only counting the number of times that the close penetrates the average line but I decided that high and low penetration gave more interesting results. On the line chart the red line is number of times the low is below the average line during the look back period and the green line is the number of times the high is above the average line. So green above red = bullish market and red above green = bearish market.

It can also be seen that when the red and green are converging that a bull run or bear run may be coming to an end. I converted the indicator into a histogram to more easily show this. The histogram switches to bullish or bearish if the lines start converging but otherwise is bullish if green is above red and bearish if the opposite.

The author calls his version his ‘Stiffness’ filter. I will let your own imagination work out why!

Both codes are included here along with ITF files to import. I recommend importing over cut and paste to get full functionality.

Share this

Risk disclosure:

No information on this site is investment advice or a solicitation to buy or sell any financial instrument. Past performance is not indicative of future results. Trading may expose you to risk of loss greater than your deposits and is only suitable for experienced investors who have sufficient financial means to bear such risk.

ProRealTime ITF files and other attachments : How to import ITF files into ProRealTime platform?

PRC is also on YouTube, subscribe to our channel for exclusive content and tutorials

  1. Vonasi • 06/21/2018 #

    Forum discussion on these indicators can be found here: https://www.prorealcode.com/topic/average-penetration-filter/

  2. jennr29 • 06/21/2018 #

    Hi. Is it possible to convert this code to an mq4 file?

    • Nicolas • 06/21/2018 #

      Sorry but our website is dedicated to prorealtime programming. However, you can ask for private coding job here: https://www.prorealcode.com/trading-programming-services/

avatar
Register or

Likes

avatar avatar avatar avatar avatar avatar
Related users ' posts
Rory Dryden Thank you. Experimenting with it now.
Wolf Hi Vonasi. Thank for this indicator. I like this calculate concept. I think that line 16 thi...
Vonasi Well spotted! It is just a safety check to ensure that no value below 1 can be used otherwis...
Stockastiss Can this code be simply transferred into Backtestingcode so one doesnt need to use call ? (i...
Vonasi Sorry for the late reply. Add the code to your strategy and remove line 5 and line 39. Chang...
viktorthunss Hi! How many averages are there? Can I see the somewhere?
leofi https://www.prorealcode.com/topic/simple-average-with-visual-color/
leofi Go visit www.prorealcode.com/topic/simple-average-with-visual-color/ and watch 2em post
Dritan Hi,I am new on Prorealtime and coding.I downloaded the indi but I have it on a separate wind...
Marie-Eve Vergoz Bonsoir - Voici l'erreur qui est signalée lorsque je souhaite utiliser cet indicateur : il...
Om Hello, thanks for sharing! Getting a message that Variable P is undefined?
matin Intraday Average Volume Indicator Not working, what can i do plz
Byggtrader Hi Nicolas! How do I get the indicator in the price chart? It only stays under i new chart.
Nicolas Just add it on the price chart by using the wrench on the left upper side of the chart (pric...
Dom Hello, hello....je commence le trading et découvre par la même occasion le codage....et ce n...
Nicolas Merci, ça fait plaisir !
Be-n Bonjour tout le monde ! Dans l'indicateur de tendance, j'ai du mal à saisir la nuance entre ...
Vonasi Sure that is possible. I will code it and make a post in the English ProBuilder forum and pu...
Vonasi Vama v2 with Hull moving average included can be found here: https://www.prorealcode.com/top...
JMat45 Thank you, Vonasi.
manchokcity can we have it in mql4 platform? or how or which platform do we use it?
camporan I don't use MetaTrader so I won't be able to do the translation myself. Sorry!
Alexander9 This can for amibroker ? . Thanks
ggolfet Thanks Nicolas, I imported the itf file and solved the problem.
Hasardeur Hallo Nicolas, i tried to code the multi period heat map in combination with the Ehler’s ...
Nicolas Please open a new topic with the code in forum.
winnie37 yes. "No ground breaking math here, but I am finding very useful and some algo based on it i...
Jan Wind Also interesting to know what does not work, which set up you use, saves me investigating ! ...
winnie37 i just set the proorder like this: buy when 50/100/200 phase >0 and sell when under 0, go...
Vinks_o_7
5 years ago
IV Mcm I've always wondered how to make the ADX faster, thank you!
Vinks_o_7 You welcome !
Vinks_o_7 Another variation that may be more accurate : we calculate the average of normalized DI's in...
nfulcher Please could someone explain how the following code is calculated:- iDI = TEMA[3](DI[DI2]...
oakenstream Jan, I find sometimes that the priceexit variable is never set. It seems to happen when the ...
Matt66612 I do not understand the first time I launch the backtest I got the same result as you. but ...
avatar
unkown ;-) sfido chiunque a riuscirci!
avatar
unkown infatti basta leggere i post degli altri....
nicola papangelo ciao Francesco vorrei contattarti su facebook o in privato. Grazie
Janfi Hello, I'm new to ProRealCode and I do not understand the following summation[n](indicator...
Kaci It seems he's just checking that the previous MACD is < 0 for maximum one period ? I'...
Daniel Martin Hi do you know how have and entry after the second cross? There is crosses below 0 and cross...
3agl3 voglio l indicatore
XXXXVII Excellent indicateur ! Déterminer une tendance est devenu un jeu d'enfants ! Félicitation......
gregoire bonjour nicolas j ai cherché partout sur le net et impossible de trouvé ce que je recherch...
Nicolas Merci de poster une demande dans le forum des indicateurs, ainsi on pourra le coder dans ce ...
Vonasi Discussion on this indicator/filter can be found here: https://www.prorealcode.com/topic/121...
snow_onar Very interesting indicator. Thanks for contributing it. What volume node or volume profile i...

Top