RicardoSantos

[RS]Timed Percentual Change V0

EXPERIMENTAL: time based percentual change.

note: each series uses it self as base reference so there's a bit a divergence.
오픈 소스 스크립트

이 스크립트의 오써는 참된 트레이딩뷰의 스피릿으로 이 스크립트를 오픈소스로 퍼블리쉬하여 트레이더들로 하여금 이해 및 검증할 수 있도록 하였습니다. 오써를 응원합니다! 스크립트를 무료로 쓸 수 있지만, 다른 퍼블리케이션에서 이 코드를 재사용하는 것은 하우스룰을 따릅니다. 님은 즐겨찾기로 이 스크립트를 차트에서 쓸 수 있습니다.

면책사항

이 정보와 게시물은 TradingView에서 제공하거나 보증하는 금융, 투자, 거래 또는 기타 유형의 조언이나 권고 사항을 의미하거나 구성하지 않습니다. 자세한 내용은 이용 약관을 참고하세요.

차트에 이 스크립트를 사용하시겠습니까?
study(title='[RS]Timed Percentual Change V0', overlay=false)
yyyy = input(2015)
mm = input(08)
dd = input(01)
SHOW_EXTREME = input(title='Show Extreme Range:', type=bool, defval=true)
f_get_percentual_src(_yyyy, _mm, _dd, _srctype)=>
    //--> remove data prior to date.
    _src = year < _yyyy or (year <= _yyyy and month < _mm) or (year <= _yyyy and month <= _mm and dayofmonth < _dd)  ? na : _srctype
    _basis_ad = valuewhen( na(_src[1]), _src, 0)
    _return = (_src/_basis_ad)*100

_open = f_get_percentual_src(yyyy, mm, dd, open)
_high = f_get_percentual_src(yyyy, mm, dd, high)
_low = f_get_percentual_src(yyyy, mm, dd, low)
_close = f_get_percentual_src(yyyy, mm, dd, close)
fc = close>open?lime:close<open?red:gray
plotcandle(_open, _high, _low, _close, color=fc, wickcolor=black)
hline(100, color=black)

top_extreme = na(top_extreme[1]) ? _high : max(max(_high, max(_open, _close)), top_extreme[1])
bot_extreme = na(bot_extreme[1]) ? _low : min(min(_low, min(_open, _close)), bot_extreme[1])

plot(not SHOW_EXTREME ? na : top_extreme, color=change(top_extreme)!=0?na:black)
plot(not SHOW_EXTREME ? na : bot_extreme, color=change(bot_extreme)!=0?na:black)
plot(not SHOW_EXTREME ? na : avg(top_extreme, bot_extreme), color=change(avg(bot_extreme, top_extreme))!=0?silver:black)