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)