Percentage Price Over SMA

Return the percentage of closing prices greater than SMA's with periods within a user-selected range. An exponential moving average applied to these results is also displayed (in orange).


  • Min : Minimum period of the SMA in the range
  • Max : Maximum period of the SMA in the range
  • Smooth : Period of the EMA
  • Src : Input series of the indicator


The indicator is a normalized oscillator. A value of 100 indicates that 100% of the current closing price is over SMA's with periods ranging from min to max, this indicates a bullish market, while a value of 0 would indicate a bearish market.

In this image the indicator use min = 50 and max = 200, here AMD has been strongly bullish at the start, and ended being strongly bearish at the end, during this bullish period the indicator is over its overbought level, while it is under its oversold level during the bearish period.

In case the market is ranging we can expect the indicator to be around 50%, using the smoothed result might be more useful to detect ranging markets with this indicator.

If the smoothed result is within the overbought/oversold levels, then we can say that the market is either ranging or transitioning from a bullish / bearish market to an opposite one.
Open-source script

In true TradingView spirit, the author of this script has published it open-source, so traders can understand and verify it. Cheers to the author! You may use it for free, but reuse of this code in a publication is governed by House Rules. You can favorite it to use it on a chart.

Want to use this script on a chart?

Become a Patreon and get access to exclusive technical indicators!

You can also check out some of the indicators I made for luxalgo :


This is above average :) :) :)
+2 Svara
alexgrover syrinxflunki
@syrinxflunki, Ooo, I wasn't expecting that, amazing. Thx a lot for always leaving a comment :D
i like your brilliant ideas how you filter the price action zones
+1 Svara
Cool, simple and effective indicator, appreciated alexgrover for shared <3
+1 Svara
I really like this Alex!
+1 Svara
Great idea Alex! I'm going to have a play with it now! Thanks again for sharing the high quality ideas and code with great explanations, they really are appreciated.
+1 Svara
Very cool! You just keep on pushing such interesting ideas - thank you for sharing this!
+1 Svara
@nilux, Thank you for your comment, it means a lot. Next indicators should be way more impressive :D
+1 Svara
Hem Aktie-screener Forex-screener Krypto-screener Ekonomisk kalender Om Diagramfunktioner Priser Tipsa en vän Ordningsregler Hjälpcenter Webbsidor och mäklarlösningar Widgets Diagramlösningar Lightweight Charting Library Blogg och nyheter Twitter