Buongiorno , su TradingView è inserito e condiviso l’indicatore in questione, questo il codice dall’autore:
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © alexgrover
//@version=4
study("Percentage Price Over SMA","%PMA's")
min = input(14,"Minimum MA Length Value",minval=1)
max = input(28,"Maximum MA Length Value",minval=1)
smooth = input(14)
src = input(close)
//------------------------------------------------------------------------------
csum = cum(src),p = 0
for i = min to max
ma = (csum - csum[i])/i
p := src > ma ? p + 1 : p
per = p/(max - min + 1)*100
//------------------------------------------------------------------------------
plot(per,"%Price Over SMA",#2157f3)
plot(ema(per,smooth),"Smoothed Result",#e65100)
a = hline(80),b = hline(20),fill(a,b,#2157f3)
Ringraziando anticipatamente per la traduzione.
Saluti
mini = 14
maxi = 28
smooth = 14
src = close
//------------------------------------------------------------------------------
p = 0
for i = mini to maxi
ma = average[i](src)
if src> ma then
p=p+1
else
endif
next
per = p/(maxi - mini + 1)*100
ema=exponentialaverage[smooth](per)
return per as "%Price Over SMA",ema as "Smoothed Result",80 as "superior",20 as "inferior"