Indicator · Pine Script v5 · On the chart

Day Trading Reversal System

by g-moe· code credited to goodgains

This indicator tracks the low of day and high of day during the specified RTH session hours in the New York timezone.

View on GitHub

GitHub stars3on the repository
Pine versionv5runs as is
Lines of code126
Settings3inputs
LicenceNone statedfile: MPL-2.0
Last update5 months ago27 May 2026

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

126 lines of Pine Script v5 from Tradingview/day-trading-reversal-system.pine, published under MPL-2.0 (file header). Keep the author's credit and licence lines when you reuse it.

day-trading-reversal-system.pine
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © goodgains


//@version=5
indicator("Day Trading Reversal System", overlay = true)

// @keywords: day-reversal, rth-session, low-of-day, high-of-day, session-range, lod-tracker, hod-tracker, reversal-crossover, bullish-triangle, bearish-triangle, horizontal-lines, lod-high-line, hod-low-line, crossover-signal, crossunder-signal, intraday-levels, est-session-hours, bar-index-tracking, swing-reversal, price-breakout


rth_timeinput = input.session("0900-1430", title = 'RTH Hours (EST)') 
rth =  time(timeframe.period, rth_timeinput, "America/New_York")

up_color = input.color(color.new(#19b419,10), title = 'Up Color')
down_color = input.color(color.new(#4b37af,10), title = 'Down Color')

//  lod
var float lod = na

if rth and not rth[1]
    lod := low
else if rth and low < lod[1]
    lod := low
else
    lod := lod[1]


// lod x
var float lod_x = na

if low == lod and rth
    lod_x := bar_index
else
    lod_x := lod_x[1]


// lod_h
var float lod_h = na

if low == lod 
    lod_h := high
else
    lod_h := lod_h[1]


// lod_h_line
var line lod_h_line = na

if lod != lod[1]
    line.delete(lod_h_line[1])
    lod_h_line := line.new(x1 = bar_index, y1 = lod_h, x2 = bar_index + 1, y2 = lod_h, extend = extend.right, color = up_color)
    

// upbar
var int upbar = na

// arrow up
var label arrow_up = na

if ta.crossover(close, lod_h)
    upbar := bar_index
    label.delete(arrow_up[1])
    arrow_up := label.new(x = bar_index, y = low, xloc = xloc.bar_index, yloc = yloc.belowbar, color = up_color, style = label.style_triangleup, size = size.tiny)
else
    upbar := upbar[1]




//  hod
var float hod = na

if rth and not rth[1]
    hod := high
else if rth and high > hod[1]
    hod := high
else
    hod := hod[1]


// hod x
var float hod_x = na

if high == hod and rth
    hod_x := bar_index
else
    hod_x := hod_x[1]


// hod_l
var float hod_l = na

if high == hod 
    hod_l := low
else
    hod_l := hod_l[1]


// hod_l_line
var line hod_l_line = na

if hod != hod[1]
    line.delete(hod_l_line[1])
    hod_l_line := line.new(x1 = bar_index, y1 = hod_l, x2 = bar_index + 1, y2 = hod_l, extend = extend.right, color = down_color)


// downbar
var int downbar = na

// arrow down
var label arrow_down = na

if ta.crossunder(close, hod_l)
    downbar := bar_index
    label.delete(arrow_down[1])
    arrow_down := label.new(x = bar_index, y = low, xloc = xloc.bar_index, yloc = yloc.abovebar, color = down_color, style = label.style_triangledown, size = size.tiny)
else
    downbar := downbar[1]


// delete arrows on new signal
if hod != hod[1]
    label.delete(arrow_down[1])  

if lod != lod[1]
    label.delete(arrow_up[1])

Overview

Day Trading Reversal System calculates the high at the current low of day (lod_h) and the low at the current high of day (hod_l). Horizontal lines are drawn at these levels on the price chart using the provided up and down colors. Bullish reversal signals appear as up triangle labels when price crosses above lod_h, and bearish signals appear as down triangle labels when price crosses below hod_l. The primary setting customizes the RTH session start and end times. All elements plot directly on the price chart. It operates only during the defined RTH session and provides no automatic stop loss or take profit.

Details

Published by

g-moe on GitHub

Code credit

goodgains, as written in the script's header

Type

Indicator, Pine Script v5

Draws

On the price chart

Category

Sessions & time, Support & resistance, Mean reversion, Scalping

Markets

Any symbol

Timeframes

M15-H1

Risk Notes

No repainting, lookahead or stacked entries were found in its code or README. That says nothing about how well it works: test it first.

Settings

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

SettingTypeDefaultVariable
RTH Hours (EST)session0900-1430rth_timeinput
Up Colorcolorcolor.new(#19b419,10)up_color
Down Colorcolorcolor.new(#4b37af,10)down_color
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

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

Apex Protocol v3.3

by alboogycOdR
6 stars

Apex Protocol v3.3 is a Smart Money Concepts trading indicator that plots order blocks, fair value gaps, BOS and MSS markers, auto Fibonacci levels, area of interest zones and external internal structures on the price chart. It supports multiple killzone sessi

Indicator v5 SMC / ICT / price actionScalping Repaints
Updated 7 months ago · None stated GitHub repository of Apex Protocol v3.3
5 stars

Calculates daily classical pivot points from the previous day's high, low, and close to identify intraday reversal setups within a defined trading session. Long signals fire when price comes within a configurable tick proximity to S1 and prints a bullish recla

Indicator v5 Support & resistanceMean reversion
Updated 5 months ago · Custom licence GitHub repository of Path C — Pivot-Point Bounce (Demo)
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
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 昨日高低點標示

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