Sayın yetkili,
Aşağıda yazılmış olan formulün matriksteki kullanımını yazmanız mümkün mü?
Saygılarımla...
source = input(close)
responsiveness = max(0.00001, input(0.9, minval=0.0, maxval=1.0))
period = input(50)
sd = stdev(source, 50) * responsiveness
var worm = source
diff = source - worm
delta = abs(diff) > sd ? sign(diff) * sd : diff
worm := worm + delta
ma = sma(source, period)
raw_momentum = (worm - ma) / worm
current_med = raw_momentum
min_med = lowest(current_med, period)
max_med = highest(current_med, period)
temp = (current_med - min_med) / (max_med - min_med)
value = 0.5 * 2
value := value * ((temp - .5) + (.5 * nz(value[1])))
value := value > .9999 ? .9999 : value
value := value < -0.9999 ? -0.9999 : value
temp2 = (1 + value) / (1 - value)
momentum = (.25 * log(temp2))
momentum := momentum + (.5 * nz(momentum[1]))
momentum := raw_momentum
signal = nz(momentum[1])
trend = abs(momentum)<=abs(momentum[1])
hline(0)
a = plot(momentum, title="Momentum", color=momentum>=0?color.green:color.red)
b = plot(0, title="Zero", color=color.black)
fill(a, b, transp=75,color=trend?(momentum>=0?color.green:color.red):na)
fill(a, b, transp=50,color=not trend?(momentum>=0?color.green:color.red):na)
plot(signal, title="Signal", color=color.black)