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 อย่างแท้จริง ผู้เขียนสคริปต์นี้ได้เผยแพร่เป็นโอเพนซอร์ส เพื่อให้ผู้ค้าสามารถเข้าใจและตรวจสอบได้ ไชโยให้กับผู้เขียน! คุณสามารถใช้ได้ฟรี แต่การใช้รหัสนี้ซ้ำในสิ่งพิมพ์อยู่ภายใต้กฎระเบียบการใช้งาน คุณสามารถตั้งเป็นรายการโปรดเพื่อใช้บนชาร์ตได้

คำจำกัดสิทธิ์ความรับผิดชอบ

ข้อมูลและบทความไม่ได้มีวัตถุประสงค์เพื่อก่อให้เกิดกิจกรรมทางการเงิน, การลงทุน, การซื้อขาย, ข้อเสนอแนะ หรือคำแนะนำประเภทอื่น ๆ ที่ให้หรือรับรองโดย 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)