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.
Open-source Skript

Ganz im Spirit von TradingView hat der Autor dieses Skripts es als Open-Source veröffentlicht, damit Trader es besser verstehen und überprüfen können. Herzlichen Glückwunsch an den Autor! Sie können es kostenlos verwenden, aber die Wiederverwendung dieses Codes in einer Veröffentlichung unterliegt den Hausregeln. Sie können es als Favoriten auswählen, um es in einem Chart zu verwenden.

Haftungsausschluss

Die Informationen und Veröffentlichungen sind nicht als Finanz-, Anlage-, Handels- oder andere Arten von Ratschlägen oder Empfehlungen gedacht, die von TradingView bereitgestellt oder gebilligt werden, und stellen diese nicht dar. Lesen Sie mehr in den Nutzungsbedingungen.

Möchten Sie dieses Skript auf einem Chart verwenden?
//@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)