JayRogers

Previous Period Levels

Description:
  • It's just levels of previous periods, with the inclusion of 4 hour and and month. Nothing special.
Setup:
  • Should be mostly self explanatory... but selecting either the 4 hour or month check boxes will override the dropdown selection.
  • Checking both the 4 hour and month boxes together will cause it to default to whatever has been selected in the dropdown.
สคริปต์โอเพนซอร์ซ

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

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

ข้อมูลและบทความไม่ได้มีวัตถุประสงค์เพื่อก่อให้เกิดกิจกรรมทางการเงิน, การลงทุน, การซื้อขาย, ข้อเสนอแนะ หรือคำแนะนำประเภทอื่น ๆ ที่ให้หรือรับรองโดย TradingView อ่านเพิ่มเติมที่ เงื่อนไขการใช้บริการ

ต้องการที่จะใช้สคริปต์นี้บนชาร์ตใช่ไหม?
//@version=2

study(title="Previous Period Levels", shorttitle="Previous Levels", overlay=true)

// Revision:        1
// Author:          @JayRogers
//
// Description:
//  - It's just levels of previous periods, with the inclusion of 4 hour and and month. Nothing special.
// Setup:
//  - Should be mostly self explanatory... but selecting either the 4 hour or month check boxes will override the dropdown selection.
//  - Checking both the 4 hour and month boxes together will cause it to default to whatever has been selected in the dropdown.

openLevel   = input(defval = true, title = "Show Open Level")
highLevel   = input(defval = true, title = "Show High Level")
lowLevel    = input(defval = true, title = "Show Low Level")
closeLevel  = input(defval = true, title = "Show Close Level")

hl2Level    = input(defval = false, title = "Show hl2 Level")
hlc3Level   = input(defval = false, title = "Show hlc3 Level")
ohlc4Level  = input(defval = false, title = "Show ohlc4 Level")

timeFrame   = input(defval = "D", title = "Select Time Frame ( or choose single option below ) ", type = resolution)
use4hour    = input(defval = false, title = "Use 4 hour?")
useMonth    = input(defval = false, title = "Use Month?")

// === BASE FUNCTIONS ===
// security wrapper for repeat calls
reso(exp, res) => security(tickerid, res, exp)
// === /BASE FUNCTIONS ===

tf() => use4hour and not useMonth ? "240" : useMonth and not use4hour ? "M" : timeFrame

openPrev    = change(time(tf())) ? na : reso(open[1], tf())
highPrev    = change(time(tf())) ? na : reso(high[1], tf())
lowPrev     = change(time(tf())) ? na : reso(low[1], tf())
closePrev   = change(time(tf())) ? na : reso(close[1], tf())

hl2Prev     = change(time(tf())) ? na : reso(hl2[1], tf())
hlc3Prev    = change(time(tf())) ? na : reso(hlc3[1], tf())
ohlc4Prev   = change(time(tf())) ? na : reso(ohlc4[1], tf())

plot(openLevel ? openPrev : na, title = "Open", color = silver, linewidth = 2, style = linebr, transp = 50)
plot(highLevel ? highPrev : na, title = "High", color = silver, linewidth = 2, style = linebr, transp = 50)
plot(lowLevel ? lowPrev : na, title = "Low", color = silver, linewidth = 2, style = linebr, transp = 50)
plot(closeLevel ? closePrev : na, title = "Close", color = silver, linewidth = 2, style = linebr, transp = 50)

plot(hl2Level ? hl2Prev : na, title = "hl2", color = silver, linewidth = 2, style = linebr, transp = 50)
plot(hlc3Level ? hlc3Prev : na, title = "hlc3", color = silver, linewidth = 2, style = linebr, transp = 50)
plot(ohlc4Level ? ohlc4Prev : na, title = "ohlc4", color = silver, linewidth = 2, style = linebr, transp = 50)