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.
Skript med en öppen källkod

I sann TradingView-anda har författaren publicerat detta skript med öppen källkod så att andra handlare kan förstå och verifiera det. Hatten av för författaren! Du kan använda det gratis men återanvändning av den här koden i en publikation regleras av våra ordningsregler. Du kan ange den som favorit för att använda den i ett diagram.

Frånsägelse av ansvar

Informationen och publikationerna är inte avsedda att vara, och utgör inte heller finansiella, investerings-, handels- eller andra typer av råd eller rekommendationer som tillhandahålls eller stöds av TradingView. Läs mer i Användarvillkoren.

Vill du använda det här skriptet i ett diagram?
//@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)