Indicator · Pine Script v4 · On the chart

TPCharts Daily Opens

by TPCharts

This indicator draws horizontal open-price levels on the price chart for the current day.

View on GitHub

Repaints

GitHub stars10on the repository
Pine versionv4older, still runs
Lines of code121
Settings8inputs
LicenceGPL-3.0
Last update5 years ago1 Dec 2020

Add It to Your TradingView Chart

  1. 1Copy the scriptPress Copy script above, or the copy button on the code below.
  2. 2Open the Pine EditorOpen a TradingView chart and choose Pine Editor at the bottom of the screen.
  3. 3Paste over the templateCreate a new indicator, select all of the template text and paste. Press Save and give it a name.
  4. 4Add it to the chartPress Add to chart, then adjust the settings with the gear icon next to its name.

Source Code

121 lines of Pine Script v4 from TPCharts-Daily-Opens.pine, published under GPL-3.0. Keep the author's credit and licence lines when you reuse it.

TPCharts-Daily-Opens.pine
//@version=4

study(title="TPCharts Daily Opens", overlay=true)

isNYOpenShown = input(title="Show NY Open?", type=input.bool, defval=true)
isNYOpenPriceShown = input(title="Show NY Open Price?", type=input.bool, defval=false)
isSTDOpenShown = input(title="Show Standard Open?", type=input.bool, defval=true)
isSTDOpenPriceShown = input(title="Show Standard Open Price?", type=input.bool, defval=false)
isTuEntryShown = input(title="Show Tu Entry?", type=input.bool, defval=true)
isTuEntryOpenPriceShown = input(title="Show Tu Entry Open Price?", type=input.bool, defval=false)
isMoEntryShown = input(title="Show Mo Entry?", type=input.bool, defval=true)
isMoEntryOpenPriceShown = input(title="Show Mo Entry Open Price?", type=input.bool, defval=false)


stdDayOpenTime = security(syminfo.tickerid, "D", time, lookahead=barmerge.lookahead_on) 
stdDayOpenPrice = security(syminfo.tickerid, "D", open) 

// Get NY open price
nyOpenTime = timestamp(year(timenow), month(timenow), dayofmonth(timenow), 0, 0)
float l = na
if time >= nyOpenTime and na(l[1])
    l := open
else
    l := l[1]

openPriceNY = l[0]

// Get TU entry price
float tuEntry = na
int tuEntryTimestamp = timestamp(year(timenow), month(timenow), dayofmonth(timenow) - dayofweek(timenow) + dayofweek.tuesday, 4, 0)
if dayofweek(timenow) > dayofweek.monday
    if time >= tuEntryTimestamp and na(tuEntry[1])
        tuEntry := open
    else
        tuEntry := tuEntry[1]

openPriceTuEntry = tuEntry[0]

// Get Mo entry price
float moEntry = na
int moEntryTimestamp = timestamp(year(timenow), month(timenow), dayofmonth(timenow) - dayofweek(timenow) + dayofweek.monday, 4, 0)
if dayofweek(timenow) > dayofweek.sunday
    if time >= moEntryTimestamp and na(moEntry[1])
        moEntry := open
    else
        moEntry := moEntry[1]

openPriceMoEntry = moEntry[0]
    

isCurrentDay = security(syminfo.tickerid, "D", barstate.islast)

var labelNY = "DO (NY)"
var labelSTD = "DO (STD)"
var labelTuEntry = "Tu Entry"
var labelMoEntry = "Mo OSOK Entry"

line lineMo = na
label labelMo = na

line lineTu = na
label labelTu = na

line lineDOSTD = na
label labelDOSTD = na

line lineDONY = na
label labelDONY = na

if isCurrentDay and timeframe.isintraday
   
    if isNYOpenShown and not dayofweek(timenow) == dayofweek.saturday or dayofweek(timenow) == dayofweek.sunday
  
        lineDONY := line.new(x1=nyOpenTime, y1=openPriceNY, x2=nyOpenTime+86400000, y2=openPriceNY, extend=extend.none, color=color.black, xloc=xloc.bar_time)
        line.delete(lineDONY[1])

        if isNYOpenPriceShown
            labelNY := labelNY + " [" + tostring(openPriceNY) + "]"
        
        labelDONY := label.new(nyOpenTime+86400000, openPriceNY, labelNY, style=label.style_none, xloc=xloc.bar_time)
        label.delete(labelDONY[1])

    if isSTDOpenShown
        lineDOSTD := line.new(x1=stdDayOpenTime, y1=stdDayOpenPrice, x2=stdDayOpenTime+86400000, y2=stdDayOpenPrice, extend=extend.none, color=color.black, xloc=xloc.bar_time)
        line.delete(lineDOSTD[1])

        if isSTDOpenPriceShown
            labelSTD := labelSTD + " [" + tostring(stdDayOpenPrice) + "]"
        
        labelDOSTD := label.new(stdDayOpenTime+86400000, stdDayOpenPrice, labelSTD, style=label.style_none, xloc=xloc.bar_time)
        label.delete(labelDOSTD[1])

    if isTuEntryShown
        tuEntryOffset = (86400000/24*31)
        lineTu := line.new(x1=tuEntryTimestamp, y1=openPriceTuEntry, x2=tuEntryTimestamp+tuEntryOffset, y2=openPriceTuEntry, extend=extend.none, color=color.black, xloc=xloc.bar_time)
        line.delete(lineTu[1])

        if isTuEntryOpenPriceShown
            labelTuEntry := labelTuEntry + " [" + tostring(openPriceTuEntry) + "]"
        
        label.new(tuEntryTimestamp+tuEntryOffset, openPriceTuEntry, labelTuEntry, style=label.style_none, xloc=xloc.bar_time)
        label.delete(labelTu[1])

    if isMoEntryShown
        moEntryOffset = (86400000*4 + 86400000/24*13)
        line.new(x1=moEntryTimestamp, y1=openPriceMoEntry, x2=moEntryTimestamp+moEntryOffset, y2=openPriceMoEntry, extend=extend.none, color=color.black, xloc=xloc.bar_time)
        line.delete(lineMo[1])

        if isMoEntryOpenPriceShown
            labelMoEntry := labelMoEntry + " [" + tostring(openPriceMoEntry) + "]"
        
        label.new(moEntryTimestamp+moEntryOffset, openPriceMoEntry, labelMoEntry, style=label.style_none, xloc=xloc.bar_time)
        label.delete(labelMo[1])

alertcondition(crossover(high, openPriceNY) or crossunder(low, openPriceNY), title="NY D Open Cross", message="NY D Open Cross")
alertcondition(crossover(high, stdDayOpenPrice) or crossunder(low, stdDayOpenPrice), title="Standard D Open Cross", message="Standard D Open Cross")
alertcondition(crossover(high, openPriceTuEntry) or crossunder(low, openPriceTuEntry), title="Tu Entry Open Cross", message="Tu Entry Open Cross")
alertcondition(crossover(high, openPriceMoEntry) or crossunder(low, openPriceMoEntry), title="Mo Entry Open Cross", message="Mo Entry Open Cross")

// DEBUG
//label.new(bar_index, open, tostring(openPriceNY), style=label.style_none)

Overview

TPCharts Daily Opens plots a New York midnight open, the daily standard open, a Tuesday 04:00 entry, and a Monday 04:00 OSOK entry, each as a time-anchored line with an optional price label. Boolean inputs turn each level and its price text on or off. Lines appear only on intraday charts for the current day. Daily time is requested with lookahead enabled, so the standard-open placement can use future higher-timeframe data.

Details

Published by

TPCharts on GitHub

Type

Indicator, Pine Script v4

Draws

On the price chart

Category

Support & resistance, Sessions & time

Markets

Any symbol

Timeframes

M1-M5, M15-H1

Risk Notes

  • Signals can change on the live bar or after it closes (repainting)
  • Reads higher-timeframe data with lookahead on, so the history can show signals that were not there in real time

Settings

The inputs you can change from the gear icon on the chart. Defaults are the author's.

SettingTypeDefaultVariable
Show NY Open?booltrueisNYOpenShown
Show NY Open Price?boolfalseisNYOpenPriceShown
Show Standard Open?booltrueisSTDOpenShown
Show Standard Open Price?boolfalseisSTDOpenPriceShown
Show Tu Entry?booltrueisTuEntryShown
Show Tu Entry Open Price?boolfalseisTuEntryOpenPriceShown
Show Mo Entry?booltrueisMoEntryShown
Show Mo Entry Open Price?boolfalseisMoEntryOpenPriceShown
Third-party code. ForexR did not write, test or endorse this script, and the summary above was generated automatically from its code and README. Indicators describe the past, and a strategy's backtest can look better than live trading, especially when a script repaints. Check it in the Strategy Tester and on a demo account before you rely on it.

Similar Pine Scripts

575 stars

This indicator builds Market Profile Time Price Opportunity (TPO) structures across defined session timeframes directly on the main price chart. It visualizes the Point of Control (POC) and Value Area boundaries using dynamic box drawings. An integrated multi-

Indicator v5 Support & resistanceScreeners & dashboards
Updated 1 year ago · MPL-2.0 GitHub repository of Market Profile with Screener
257 stars

This indicator plots auto trade signals for E-mini S&P 500 futures on the price chart. It computes an EMA200 filter along with day ETH RTH session levels and percentage-based entry zones. Signals trigger CALL or PUT cases when price crosses defined thresholds

Indicator v6 TrendSupport & resistance
Updated 6 weeks ago · None stated GitHub repository of Auto Trade Futures ES
219 stars

This indicator plots reference levels for previous daily high and low prices directly on the price chart. It requests daily timeframe data using the security function and plots the offset values as continuous lines, displaying resistance in red and support in

Indicator v4 Support & resistanceSessions & time
Updated 5 years ago · None stated GitHub repository of 昨日高低點標示

Golden Bullet Strategy

by TradersPost
218 stars

The Golden Bullet Strategy is an overlay signal indicator based on Smart Money Concepts and time-based liquidity models. It identifies liquidity sweeps of a designated reference session range during a specified hunt window. It then confirms Market Structure Sh

Indicator v6 SMC / ICT / price actionSessions & time
Updated 3 months ago · None stated GitHub repository of Golden Bullet Strategy

Moon Dev GEX Arrows

by moondevonyt
92 stars

This overlay indicator plots option strike walls and an optional session VWAP on the price chart for SPY or ES. It spaces major strikes by the selected instrument, draws a set number of strikes on each side, and marks wall-trap and sweep events after a cooldow

Indicator v5 Support & resistanceSessions & time
Updated 8 weeks ago · Custom licence GitHub repository of Moon Dev GEX Arrows

Key Levels

by cryptorife
75 stars

This indicator plots reference levels and session markers directly on the price chart. It calculates and draws lines for the daily open, weekly open, monthly open, previous day OHLC, and previous week extremes, along with a selectable day-of-week range and ini

Indicator v4 Support & resistanceSessions & time Repaints
Updated 3 years ago · GPL-3.0 GitHub repository of Key Levels

More indicators

Trade Your Charts With a Regulated Broker

Compare brokers that connect to TradingView, with spreads, minimum deposits and leverage side by side.

Compare brokers