Market structure
Prior Day High, Low and Close
Yesterday's high, low, close and midpoint drawn across today, which are among the few levels every participant can see and therefore among the few that reliably attract activity.
indicator
//@version=6
indicator("Prior Day High, Low and Close", "PD Levels", overlay = true)
showMid = input.bool(true, "Show midpoint", group = "Settings")
lineCol = input.color(#787B86, "Lines", group = "Style")
prevHigh = request.security(syminfo.tickerid, "D", high[1], lookahead = barmerge.lookahead_on)
prevLow = request.security(syminfo.tickerid, "D", low[1], lookahead = barmerge.lookahead_on)
prevClose = request.security(syminfo.tickerid, "D", close[1], lookahead = barmerge.lookahead_on)
mid = (prevHigh + prevLow) / 2
plot(prevHigh, "Prior high", color = lineCol, style = plot.style_linebr)
plot(prevLow, "Prior low", color = lineCol, style = plot.style_linebr)
plot(prevClose, "Prior close", color = color.new(lineCol, 40), style = plot.style_linebr)
plot(showMid ? mid : na, "Prior midpoint", color = color.new(lineCol, 65), style = plot.style_linebr)
brokeHigh = ta.crossover(close, prevHigh)
brokeLow = ta.crossunder(close, prevLow)
plotshape(brokeHigh, "Above prior high", location = location.belowbar, style = shape.triangleup, color = color.new(#26A69A, 0), size = size.tiny)
plotshape(brokeLow, "Below prior low", location = location.abovebar, style = shape.triangledown, color = color.new(#EF5350, 0), size = size.tiny)
alertcondition(brokeHigh, "Above prior high", "Price crossed above the prior day high")
alertcondition(brokeLow, "Below prior low", "Price crossed below the prior day low")
This runs in TradingView, not here
Pine Script only executes inside TradingView. Paste the source into the Pine Editor and add it to a chart to see it plotted.
What it will not do
- Levels attract activity; they do not create direction. A break of the prior high is a location, not a signal.
- On a daily or higher chart these lines simply track the previous bar and tell you nothing new.
Written from this description
Draw the previous day's high, low and close as horizontal lines on an intraday chart, plus the midpoint between the high and low, and alert when price crosses the prior high or low.
Educational only, not financial advice. The maths is simple arithmetic on the numbers you enter; it knows nothing about your broker, fees, slippage or the market. Something wrong with it? Say so in Site Feedback.